I am using SQL Developer with a IBM DB2 database. I am only querying the data for analytical purposes – never making any updates, additions or deletions. I was wondering if there is a way to ensure that every query is an uncommitted read by default so that I never lock the tables. Is there a way that I can do this without typing FOR FETCH ONLY WITH UR
at the end of every query? Would enabling the settings for Autocommit
in Preferences -> Database -> Advanced
achieve the same goal (not lock tables)?
Db2 – Set uncommitted read as default in Oracle SQL Developer with DB2 database
db2oracle-sql-developer
Related Question
- Oracle Database Migration using Oracle SQL Developer
- Oracle 12c – How to Configure SQL Developer
- Oracle SQL Developer – Database Diff for Tables & Constraints
- Oracle SQL Developer – Using ‘All Source Lines’ in ‘Find Database Object’
- Db2 – Connection Error while connecting SQL Developer with DB2
- Db2 – Disable autocommit for DB2 connection in Oracle SQL Developer
- DB2 – Handling Linked Server Table Locks
Best Answer
There are a couple of ways to achieve this. Firstly, you can simply run the statement
in your session before executing other statements.
Alternatively, you can set a property in the JDBC URL you use to connect to the database, like so:
The value
1
corresponds to the constantjava.sql.Connection.TRANSACTION_READ_UNCOMMITTED
(note that it is implementation-dependent and may break).