Can't reconnect

Ivan Smahin ivan_smahin at paradigmasoft.com
Tue Oct 15 03:14:59 CDT 2013


Hi,

On Oct 15, 2013, at 2:39 AM, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:

> Hi,
> 
> Now I have a complete script for testing. I wrote it in such a way that it will make debugging a larger project much easier for me. It opens a connection, opens a database, does a simple query, closes the database(s), and disconnects.
> 
> The problem is that despite closing the databases and disconnecting, I still can't connect more than 5 times. I should be able to connect more than 5 times if I close old connections before making new ones. Whenever I try to connect for the 6th time, I have to wait an eternity until the error 0x82501 appears.
> 
> Why can't I connect more than 5 times, despite closing all connections first?
> 
> My script follows here. You need a stack with a button for the script and a field to display the log.
> 
> // keep local variables in memory
> local lDatabaseConnection,lDatabase
> 
> // do the test
> on mouseUp
>   put empty into fld 1 // log field
>   initValentina
>   createDatabase
>   query
>   closeAllDatabases
>   closeConnection
> end mouseUp
> 
> // standard stuff, returns nothing in log
> on initValentina
>   log valentina_initClient() //(19*1024*1024)
>   log valentina_debugLevel("kLogErrors")
> end initValentina
> 
> // more standard stuff
> on createDatabase
>   put vConnection_Constructor("localhost","sa","sa",15432) into lDatabaseConnection
>   log lDatabaseConnection
>   put vDatabase_Constructor(lDatabaseConnection) into lDatabase
>   log lDatabase
>   log vDatabase_Open(lDatabase,"myDatabase.vdb")
>   log vDatabase_DateFormat(lDatabase,"kYMD")
>   log vDatabase_DateSep(lDatabase,"-")
> end createDatabase
> 
> // obvious stuff
> on query
>   log dataFromTable(lDatabase,"mytable","myfield")
> end query
> 
> // used by the query handler, not important
> function dataFromTable theDatabaseID,theTable,theField
>   put vDatabase_table(theDatabaseID,theTable) into myTableID
>   put vTable_field(myTableID,theField) into myFieldID
>   put vField_Value(myFieldID) into myData
>   return myData
> end dataFromTable
> 
> // closing all dtabases, important stuff
> on closeAllDatabases
>   put valentina_databasecount() into myDatabaseCount
>   repeat with myDatabaseNr = 1 to myDatabaseCount
>      put Valentina_Database(myDatabaseNr) into myDatabaseID
>      put myDatabaseID & cr after fld 1
>      if "ERROR" is not in myDatabaseID then
>         if "ERROR" is not in vDatabase_Close(myDatabaseID) then
>            put vDatabase_Destructor(myDatabaseID) into myDatabaseID
>            put myDatabaseID & cr after fld 1 // 0
>         else
>            beep
>            answer error "Can't close database."
>         end if
>      else
>         beep
>         answer error "Can't get a reference to the database."
>      end if
>   end repeat
> end closeAllDatabases
> 
> // obvious
> on closeConnection
>   log valentina_shutdown(lDatabaseConnection)
> end closeConnection
> 
> on log theData
>   put theData & cr after fld 1
> end log
> 
> Did I forget something in my script or is it a bug in Valentina?
> 

I suppose we are talking about vServer which is limited to 5 similar connections.
Firstly - there is no call for VConnection_Open - the only VConnection_Constructor is called.
Also there is no VConnection_Close.

Hmm, it seems connection will be opened by vDatabase_Constructor(lDatabaseConnection) (in case of closed connection). But you have to close connection calling VConnection_Close himself.


-- 
Best regards,
Ivan Smahin
Senior Software Engineer
Paradigma Software, Inc
Valentina - The Ultra-Fast Database
http://www.valentina-db.com



More information about the Valentina mailing list