Module using transactional ODBC

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Module using transactional ODBC

Postby chsitter » Tue Apr 10, 2012 6:40 am

Hello Guys,

I'm not sure if this is the right place to ask this question, but I didn't receive an answer at the asterisk-embedded mailing list, so maybe I'll have more luck this time.

What I want to do is to start an isolated ODBC Transaction, do some things, commit/rollback the changes and close the connection again. I also want to/have to use connection pooling as a speedup mechanism.

What I've done already:

following Code Snippet should get an independent odbc object:

Code: Select all
struct ast_flags flags = RES_ODBC_INDEPENDENT_CONNECTION;
obj = ast_odbc_request_obj2(obj, flags);

I have set the ODBC's connection args to:

Code: Select all
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:

Code: Select all
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.

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
Code: Select all
Posts: 1
Joined: Tue Apr 10, 2012 6:32 am
Location: Austria

Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest