Recent

Author Topic: [SOLVED] Two instances of same application can not open same SQLite3 database?  (Read 17173 times)

ludob

  • Hero Member
  • *****
  • Posts: 1173
Quote
So all this time, my real problem has not been refreshes, nor commitretainings, but simply and more fundamentally the fact that in Windows7, when SQLite1 is ON in Instance1, Instance2 can not at all even connect to DatabaseX.
Completely and fundamentally wrong.
Quote
I found the inability to open Instance2 a while back and asked about it, but since I had no idea of the cause, the issue got very confused.
There is only one person confused here because he is not listening.

Did you try the code in  http://forum.lazarus.freepascal.org/index.php/topic,17759.msg98683.html#msg98683 ? You couldn't get it compiled? I have the full program attached. In case that is still too difficult I have the executable and my sqlite3.dll uploaded to http://dl.dropbox.com/u/61365485/concurrentexe.zip. No initial database needed, the program will create it for you. It is called testconcurrent.sq3 and will be created in the dir of the program.

Quote
My Lazarus installation is the latest, for 32 bits. But my windows is Win-7 64 bit.

So, does any one know whether this might be a problem on this?
I have also such a configuration. Attached win 32 program ran fine a few minutes ago on that config with 3 simultaneous connections inserting lines in all 3 at the same time. 

The Connect and Disconnect buttons are to show how to use a database without being connected. That is not needed for this demo!!! It was added because you said in the previous thread that this was non possible. I repeat, the buttons are not related to your question in this thread.   
I rephrase, the demo is not based on disconnecting from the database. You can work with the table in all instances while remaining connected. Remove them from the form and delete the code if you don't believe me.

Elmug

  • Hero Member
  • *****
  • Posts: 849
Ludob,

I've had this for a long time:

SQLQuery1.open; // := True;
SQLTransaction1.CommitRetaining;

The Grid fills up.
Instance 2 does not open the database.
I have a button that disconnects SQLite3Connection1 and THEN Instance2 can open the database.
This was explained in my previous post.

ALSO:
My application I have made to stop exactly at the moment the database opens, with no query yet made, and no grid yet.
At that point: SQLiteConnection1 = Connected, Transaction = Off, Query = Off, and Instance2 CAN NOT open the database.
If I disconnect with the button the SQLite3 Connection1, THEN the database connects.

So, as said, the problem here is CONNECTING the database by Instance2, you see?

I will download your example and let you know what I find.

I don't mind being confused, wrong, and WHATEVER you want to call me. I'd be all that and be happy if I get it to work as supposed.
 

Elmug

  • Hero Member
  • *****
  • Posts: 849
Ludob,

I downloaded your zip, unzipped it, and clicked on .lpi

I get this error:
Stream=Tform1.Root=:Tform1
Component Claass: TDBNavigator
Error reading DBNavigator1.Options: Unknown property: "Options".
Stream position: 1644

I told it to continue loading:

Debugger: Identifier not found: RequireDerivedFormResource

I discarded changes.




« Last Edit: August 21, 2012, 11:25:45 am by Elmug »

ludob

  • Hero Member
  • *****
  • Posts: 1173
I'm getting so tired of this  :'(
Quote
My Lazarus installation is the latest, for 32 bits. But my windows is Win-7 64 bit.
Quote
Identifier not found: RequireDerivedFormResource
RequireDerivedFormResource was introduced in Lazarus in Feb 2011.   >:( http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-February/060229.html


Elmug

  • Hero Member
  • *****
  • Posts: 849
I'm getting so tired of this  :'(
Quote
My Lazarus installation is the latest, for 32 bits. But my windows is Win-7 64 bit.
Quote
Identifier not found: RequireDerivedFormResource
RequireDerivedFormResource was introduced in Lazarus in Feb 2011.   >:( http://lists.lazarus.freepascal.org/pipermail/lazarus/2011-February/060229.html

I will try a simple project tomorrow on my old XP all 32 bit laptop and see what happens.

I thank you for your kindness in helping out.

geno

  • Full Member
  • ***
  • Posts: 198
@elmug
Open the concurrent.lpr file and either comment out or remove the line:

Quote
RequireDerivedFormResource := True;

and then load the project.  Even after doing so, and then trying to compile/run will throw error messages.  (*)Ignore this and run it again - maybe even a third time, but the project will eventually compile and execute as it should.   Now, you will see what we have been trying to tell you - running multiple instances is possible, no matter your OS, 32bit, 64bit, 2bit, moon is in wrong location in relation to Venus, or even Global Warming. :D

   I am using version .9.30.4 dated 27June2012, and I also had a problem loading the project because of this one line, but it is not a show stopper - improvise, adapt and overcome!

According to the message referenced by ludob, using this parameter should be normal behaviour, however, even when I create a new project from scratch, I do not see RequreDerivedFormResource inserted into my .lpr.  Oh well, its all good 'cause it still works for me!

  regards
      geno

edit:  (*) I forgot to mention - the error you see from the DBNavigator1 control can be fixed by removing the control - it is not necessary for the demo. 
« Last Edit: August 21, 2012, 05:08:36 pm by geno »
version:      Lazarus 1.9   FPC 3.0.4
   
widget set:  x-86_64-linux-gtk 2
OS:             ArchLinux/ Xfce 4.12

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
RequireDerivedFormResource was introduced in Lazarus in Feb 2011
And is documented here.

ludob

  • Hero Member
  • *****
  • Posts: 1173
Quote
I am using version .9.30.4 dated 27June2012, and I also had a problem loading the project because of this one line, but it is not a show stopper - improvise, adapt and overcome!
The message I referred to was indeed for trunk. I just double checked and the change didn't make it in version .9.30.4 which was released 5 months ago.  RC1 released end last month, the latest, does have RequireDerivedFormResource.

Elmug

  • Hero Member
  • *****
  • Posts: 849
"Now, you will see what we have been trying to tell you - running multiple instances is possible, no matter your OS, 32bit, 64bit, 2bit, moon is in wrong location in relation to Venus, or even Global Warming. :D"

Thanks Geno.

If I wouldn't believe in all these things, I wouldn't be here.

But do you all believe what I say about my own particular case?>:D

geno

  • Full Member
  • ***
  • Posts: 198
ludob said:
Quote
The message I referred to was indeed for trunk. I just double checked and the change didn't make it in version .9.30.4 which was released 5 months ago.  RC1 released end last month, the latest, does have RequireDerivedFormResource.
That's good news; at least for me.  It means I didn't bone something on my end!! :)

elmug said:
Quote
But do you all believe what I say about my own particular case?
Not really, not until someone else running  Win7 can confirm there may be an issue here.  Now, I am not trying to insult you by implying that you don't know what you are talking about; its just that over the years I have learned not to rely on just one source of information.
Maybe I will get the chance to sneak in and install Lazarus on my wife's laptop while she not looking, and I can give it a try myself, but I am not going to count on that! :D

  v/r
     geno
version:      Lazarus 1.9   FPC 3.0.4
   
widget set:  x-86_64-linux-gtk 2
OS:             ArchLinux/ Xfce 4.12

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Quote
But do you all believe what I say about my own particular case?
Buy me a Win 7 and let me test :P

Elmug

  • Hero Member
  • *****
  • Posts: 849
Hi everyone.

I found the problem:

I had an initiation procedure that used the file reset function to check for the file to open, to avoid creating empty SQLite3 databases, on the old understanding that reset "opens to read".

However, if the file is already open, reset does not return zero.

Thanks every one!

ludob

  • Hero Member
  • *****
  • Posts: 1173
Quote
I found the problem:

I had an initiation procedure that used the file reset function ...
That is exactly the reason why we keep insisting on a simple test program that shows the problem. If you think something is not working, test your suspicion with a small test program that does nothing else. If the test program is working the problem is something else.
Writing a test program seems a lot of work but compared to how much time this issue has cost you (and others ;) ) it is almost always the best solution in the long term.

The multiple "show us some code" requests is for exactly the same reason. People asking for that suspect there is probably something else wrong.

Elmug

  • Hero Member
  • *****
  • Posts: 849
The thing is the application is 500 lines long.

teos

  • Full Member
  • ***
  • Posts: 157
Glad is is solved.

500 lines as attached file(s) is not that long :-)

 

TinyPortal © 2005-2018