-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set isolation level using CWB_ATTR_TXN_ISOLATION #117
Comments
Hi There! I wanted to check in if there's already the option to set the isolation_level in the connection string to "NO COMMIT"? Currently, when I'm trying to create a temporary table on a DB2 as/400 database I get a SQL7008 error saying the 'not valid for operation' Appreciate your help, thank you! |
Yes, you can set CMT=0 on the connection string. It is documented here |
Thanks a lot for you reply! |
Ohh, sorry I thought you were referring to direct ODBC connections. Through SQLAlchemy, you must use the options supported by sqlalchemy-ibmi. There is not yet support for |
Thank you for your response! Do you maybe know a working connection string to pass to sqlalchemy that basically emulates the things that ibmi does? |
I added support in the next ODBC driver version to set the isolation level to *NONE via SQL_ATTR_TXN_ISOLATION, so conceivably we can set this using the set_attr on the connection object. However, Microsoft's ODBC driver manager only allows setting the 4 pre-defined isolation options and will not allow setting the value to 0 for *NONE.
To get around this, I added a new attribute that is an alias of SQL_ATTR_TXN_ISOLATION called CWB_ATTR_TXN_ISOLATION (value 2139). This works exactly the same as the ODBC version, except the driver manager just passes the value through to the driver so we can set it to 0.
This will only work when the driver level is 7.1.24 or higher, so we'll need to do some checking before we use it or pass *NONE through.
The text was updated successfully, but these errors were encountered: