[odb-users] Problem connecting a mysql server

niermann at informatik.uni-tuebingen.de niermann at informatik.uni-tuebingen.de
Wed May 16 09:54:29 EDT 2012


Hi Boris,

I did the modification you suggested and got an 'object not persistent'
exception:

make  check-am
make[1]: Entering directory
`/nfs/wsi/bs/share/usr/niermann/odb-tests-2.0.0/common/auto'
make  check-TESTS
make[2]: Entering directory
`/nfs/wsi/bs/share/usr/niermann/odb-tests-2.0.0/common/auto'
./driver --options-file ../../db.options
BEGIN
INSERT INTO `auto_object` (`id`,`str`) VALUES (?,?)
INSERT INTO `auto_object` (`id`,`str`) VALUES (?,?)
INSERT INTO `auto_object` (`id`,`str`) VALUES (?,?)
COMMIT
BEGIN
SELECT `auto_object`.`id`,`auto_object`.`str` FROM `auto_object` WHERE
`auto_object`.`id`=?
object not persistent
ROLLBACK
./../../tester: line 35:  4896 Segmentation fault      (core dumped)
./driver --options-file "$top_builddir/db.options" > test.out
FAIL: ../../tester

and the stacktrace for this error:

#0  mysql_send_query (mysql=0x0, query=0x2ba99bb17a2f "rollback",
length=8) at
/export/home2/tmp/cteam/bs/connector-c-64bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2899
#1  0x00002ba99c4cc339 in mysql_real_query (mysql=0x0,
query=0x2ba99bb17a2f "rollback", length=8) at
/export/home2/tmp/cteam/bs/connector-c-64bit/src/mysql-connector-c-6.0.2/libmysql/client.c:2910
#2  0x00002ba99c4cd879 in mysql_query (mysql=0x0, query=0x2ba99bb17a2f
"rollback") at
/export/home2/tmp/cteam/bs/connector-c-64bit/src/mysql-connector-c-6.0.2/libmysql/libmysql.c:790
#3  0x00002ba99bb1241d in odb::mysql::transaction_impl::rollback
(this=0xf7b89e0) at transaction-impl.cxx:91
#4  0x00002ba99bd27c7d in ~transaction (this=0x7fff2bcf1780) at
transaction.cxx:24
#5  0x00002ba99c7b5260 in ?? ()
#6  0x000000317b41cbc0 in _dl_argv_internal () from
/lib64/ld-linux-x86-64.so.2
#7  0x000000317b41cbc0 in _dl_argv_internal () from
/lib64/ld-linux-x86-64.so.2
#8  0x000000000040295b in main (argc=3, argv=<value optimized out>) at
driver.cxx:55
Current language:  auto; currently c

I must add that the string values of the example are not written to the
database:

mysql> SELECT * FROM auto_object;
+----+-----+
| id | str |
+----+-----+
|  1 | 0   |
|  2 | 0   |
|  3 | 0   |
+----+-----+
3 rows in set (0.00 sec)

Regards,

Peter

On 16.05.2012 13:59, Boris Kolpackov wrote:
> Hi Peter,
>
> Sorry about that link for ODBC. For some reason I got the impression
> that you are using MS SQL Server but now I see it is MySQL.
>
>> Here comes the stacktrace:
>>
>> [...]
> Thanks, that's helpful. Can you modify the common/auto/driver.cxx
> file by replacing this code fragment starting on line 56:
>
>         auto_ptr<object> o1 (db->load<object> (id1));
>         auto_ptr<object> o2 (db->load<object> (id2));
>         auto_ptr<object> o3 (db->load<object> (id3));
>
> With this:
>
>         try
>         {
>           auto_ptr<object> o1 (db->load<object> (id1));
>           auto_ptr<object> o2 (db->load<object> (id2));
>           auto_ptr<object> o3 (db->load<object> (id3));
>         }
>         catch (const odb::exception& e)
>         {
>           cerr << e.what () << endl;
>           return 1;
>         }
>         catch (const std::exception& e)
>         {
>           cerr << "std: " << e.what () << endl;
>           return 1;
>         }
>
> Then re-run the test (i.e., run make check in common/auto/) and
> let me know what it prints?
>
> Boris




More information about the odb-users mailing list