Question

Is there a way to change isolation level and lock mode to whole database?

Was it helpful?

Solution

If you using version 11 or above : Yes
You can do that using the public.sysdbopen procedure.

  • Just create the procedure with the set isolation and lock time
  • The procedure will be valid only to the database where they was created.

This procedure will be executed when the user connect to the database. Just careful if some user already have their own sysdbopen procedure , then the public "version" will not be executed, only the own user.

create procedure "public".sysdbopen()
  set isolation to dirty read ;
  set lock mode to not wait;
end procedure
;

OTHER TIPS

There is no concept of isolation level and lock mode per database in Informix. Both are database client attributes. So it depends on your client library or tool. For example for squirrel client description is here: How to Automatically Execute a Command on Connection . For Odbc you can set isolation level in DSN properties in Environment tab.

The only universal method is given by ceinmart. In Informix 11 and above sysdbopen stored procedure is executed whenever connection is established. It is perfect place to set isolation level and lock mode. However this stored procedure is one "per Informix engine instance", not "per database". You would need to add some logic there: read database name from dbinfo and then apply settings conditionally.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top