Re: [Cppcms-users] CPPDB - connection time out
Brought to you by:
artyom-beilis
|
From: <la...@sa...> - 2012-07-09 12:41:19
|
Hi,
I runned with strace, but does not say much.
It fails on stat.exec ( for updates ).
I am working with multi/thread, can this be a problem?
I am doing only one time (before starting the threads) ->
cppdb::session sql("sqlite3:db=/home/common/source/DB/Mdata.db");
And now i also have for each thread:
///////////////////////////////////
sql.open("sqlite3:db=/home/common/source/DB/Mdata.db");
...
sql.close();
////////////////////////////////
This change helps a little, because now instead of having the error at
aproximatly 600 seconds i have the error at aproximatly 700 seconds.
Thanks!
Leandro
Quoting Artyom Beilis <art...@ya...>:
> Try to run the program with strace:
>
> strace ./program_name
>
> And see what exactly happens - why sqlite fails to open the DB.
> Maybe something happens there that you are not aware of?
>
> See why open() fails.
>
> Artyom Beilis
> --------------
> CppCMS - C++ Web Framework: http://cppcms.com/
> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>
>>
>> -------------------------
>> FROM: "la...@sa..." <la...@sa...>
>> TO: Artyom Beilis <art...@ya...>; cpp...@li...
>> SENT: Friday, July 6, 2012 6:16 PM
>> SUBJECT: Re: [Cppcms-users] CPPDB - connection time out
>>
>>
>> The error I am having is: "Error: Unable to open database file".
>>
>> I have a connection -> cppdb::session
>> sql("sqlite3:db=/home/common/source/DB/Mdata.db");
>>
>> I have a process that does a lot of selects, and updates,
>> but always after aproximatly 600 seconds i get this error, .... I
>> also found that this error occurs when i try to do an update (when
>> i do stat.exec()).
>>
>> my updates are like this (It works fine, on the first 600
>> seconds, and then it gives an error):
>> //////////////////////////////////////////////
>> stat = sql << "update reading_h set read_id = ?, date =
>> ?, time = ? where read_id = ? and mrg_id = ?" << readId << date <<
>> time << headerReadId << mrgId;
>> stat.exec();
>> stat.reset();
>> stat.clear();
>> /////////////////////////////////////////////
>>
>>
>> Quoting Artyom Beilis <art...@ya...>:
>>> There is no such thing as "lost a connection" with sqlite3 DB...
>>> The sqlite3 database is a file and database engine operates on the file
>>>
>>> Artyom Beilis
>>> --------------
>>> CppCMS - C++ Web Framework: http://cppcms.com/
>>> CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/
>>>
>>>>
>>>> -------------------------
>>>> FROM: "la...@sa..." <la...@sa...>
>>>> TO: cpp...@li...
>>>> SENT: Friday, July 6, 2012 1:58 PM
>>>> SUBJECT: [Cppcms-users] CPPDB - connection time out
>>>>
>>>>
>>>> Hi,
>>>> I am working with cppdb, with sqlite.
>>>>
>>>> I am doing a connection with cppdb::session
>>>> sql("sqlite3:db=/home/common/source/DB/Mdata.db");
>>>>
>>>> But i think i lost connection after 600 seconds
>>>> (10min). I already try
>>>> to change to, 'opt_reconnect = 1',
>>>>
>>>> but still does not work, .... i have always error
>>>> after 10min. Error:
>>>> Unable to open database connection.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Leandro
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Live Security Virtual Conference
>>>> Exclusive live event will cover all the ways
>>>> today's security and
>>>> threat landscape has changed and how IT managers
>>>> can respond. Discussions
>>>> will include endpoint security, mobile security
>>>> and the latest in malware
>>>> threats.
>>>> http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>>>> _______________________________________________
>>>> Cppcms-users mailing list
>>>> Cpp...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can
>> respond. Discussions
>> will include endpoint security, mobile security and the
>> latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>>
>>
>>
>
>
>
|