accessing an open database

jda jda at his.com
Tue Mar 22 06:51:27 CST 2005


>John, then I simply not understand.
>
>     db = new mydb
>
>thread1
>     db.open
>
>-------------
>Threadi
>
>     mutex.access
>     if( db.IsOpen = false )
>         db.Open()
>    
>     ...
>
>I think this way should work with no problems...
>
>
>And why you CLOSE db ?
>Or you in fact have many dbs ?
>I am lost


Then let me explain.

I have many database files. If I get a request, an HTTPSocket thread 
is spawned that opens the correct database file, grabs the data, 
manipulates it, and sends it back. It then closes the file. It has 
its own cursor and its own *local* copy of the database.

If I get a second request before the first is done, the new thread 
tries to open the file -> -61 error. That's OK. I do a try/catch 
loop, and when .open request no longer throws an exception the file 
is supposedly "opened" and my code proceeds.

BUT, even though there was no error, and even though 
myDatabase.isOpen = true, the next line throws a -61 exception:

myCursor = myDatabase.SQLSelect("select *,** from thereferences where 
" + searchString, EVCursorLocation.kServerSide, EVLockType.kNolocks)

A -61 exception has no meaning here!

Clearly, the file is still in use (even though Valentina thinks it is 
correctly opened).

There are probably better strategies, but the one I tried should work, no?

Jon


More information about the Valentina-beta mailing list