Ok Massimo. Ty
*from gluon.sql import DAL, Field*
*db = DAL('mysql:mydatabase')*
Done. But it seems to be empty, no tables remaining :(
Even if I select the auth_user table: "*KeyError: 'auth_user*'"
Should i get other information from gluon?
I thinked using 3 threads was the best way obtaining the hardware
information, but I am getting a lot of troubles... Do you recomend me
another way to deal with it?
El lunes, 7 de mayo de 2012 15:22:25 UTC+2, Massimo Di Pierro escribió:
>
> You cannot have multiple threads share the same db. That conflicts with
> web2py thread pooling mechanism. Even if it did not, we do not know the db
> driver it thread safe. Each thread must have it's own db=DAL() connection.
>
> On Monday, 7 May 2012 05:21:17 UTC-5, Samuel Mac wrote:
>>
>> First of all, I've been searching other google group theads and they help
>> me doing all I wanted but now I'm stuck.
>> I was looking for getting some hardware information from a computer using
>> 3 threads. This threads save the info in the Database. To do that i follow
>> the instructions founded in this two forum threads:
>> -
>> https://groups.google.com/forum/?fromgroups#!searchin/web2py/db$20module/web2py/HbZh7Bbk5RI/sWn0rZaQDRgJ
>> - http://osdir.com/ml/web2py/2012-02/msg01692.html
>>
>> I tryed to pass the DB connection to the class using the __init__ and the
>> other way, using the current.db method, but I'm getting the same error:
>> raise errorclass, errorvalue
>> InterfaceError: (0, '')
>>
>> Despite my query is very simple: row = db(db.device).select()
>>
>> Are threads unable to use DB connection?
>>
>