[asterisk-embedded] ODBC Serialized Transaction in an Asterisk C-Module

Christoph Sitter christoph.sitter at gmail.com
Thu Mar 29 07:41:54 CDT 2012


Hello Guys,

english is not my mother Tongue, so I hope that I'm able to explain my
problem in a way you understand.

I'm currently developing a Module for Asterisk10. This module accesses some
differend Oracle Databases, and for some specific actions I need to start a
serialized transaction.

What I've done already:

*following Code Snippet should get an independent odbc object:*

*struct ast_flags flags = RES_ODBC_INDEPENDENT_CONNECTION;
obj = ast_odbc_request_obj2(obj, flags);*

*I have set the ODBC's connection args to:*
*
[test_connection]
enabled => yes
dsn => dsn_xyz
username => abc
password => abc
pooling => yes
limit => 10
pre-connect => yes
isolation => serializable*

*After requesting the odbc object, I do the following:*

*struct generic_prepare_struct gps = { .sql = sql, .argc = argc, .argv =
argv, .argTypes = argTypes };
snprintf(sql, sizeof(sql), "SELECT something for update");
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);*


I added a sleep after the execution of the statement and tried to
read/modify the data within a different Oracle session from antoher client.
And it worked, but when using a Serialized transaction it shouldn't be
possible to read data within another serialized transaction!

Hopefully someone could help me out here.

Thanks and best regards.
Christoph

PS:
When I disable connection pooling and set the transaction Isolation
manually it works. (when I activate pooling I always receive an error that
SQLSetConnection couldn't be executed
*SQLSetConnectAttr*(obj->con, SQL_ATTR_TXN_ISOLATION,
(SQLPOINTER)SQL_TXN_SERIALIZABLE, SQL_NTS);
*SQLSetConnectAttr*(obj->con, SQL_ATTR_AUTOCOMMIT,
(SQLPOINTER)SQL_AUTOCOMMIT_OFF, SQL_NTS) ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-embedded/attachments/20120329/743f4702/attachment.htm>


More information about the asterisk-embedded mailing list