JDBC Section Index | Page 2
Does catching an SQLException mean that the transaction was definitely not completed and/or that the invoked method did not execute?
Not necessarily, and, unfortunately, there is no generic means of determining current state. As noted in JDBC API Tutorial and Reference, 2nd Ed: Java 2, "The safest course is to call the met...more
Why do I have problems writing BLOBs/CLOBs longer than 4k with an Oracle database?
JDBC functionality is completely dependent on the functionality of the JDBC driver AND the underlying DBMS engine. At one time there was a 4k restriction on LOBs. It's not clear from the documen...more
How can I get a pooled connection?
If the DataSource supports pooling connections, calling getConnetion() on the source will return a PooledConnection, instead of a plain Connection. The DataSource will implement ConnectionPoolData...more
How can I get a pooled connection?
If the DataSource supports pooling connections, calling getConnetion() on the source will return a PooledConnection, instead of a plain Connection. The DataSource will implement ConnectionPoolData...more
Where can I read up more on JDBC 4.0?
JDBC 4.0 is defined by JSR 221. Information is available through its JCP home at http://www.jcp.org/en/jsr/detail?id=221.
When was national character set support added to JDBC?
National character set support is part of the JDBC 4.0 specification. It didn't quite make it into Java SE 6.0, though was available in early betas.
When was national character set support added to SQL?
This is part of the SQL 2003 specification.
How can you find the cause of a SQL exception?
There are three areas where exception handling your JDBC code has improved with the changes in JDBC 4.0. First off, you can use the Java 5 for-each loop to easily iterate through the cause of an e...more
What's the difference between a transient and non-transient JDBC exception?
When making a JDBC call, an exception may happen. If performing the same task could succeed without changing anything, that exception is transient. For instance, a timeout is a type of transient e...more
How do I setup my JDBC driver to be automatically loaded in Java 6?
Place the name of your java.sql.Driver implementation in the file META-INF/services/java.sql.Driver.
What is Derby?
Derby is an open source relational database from Apache that is implemented entirely in Java and available under the Apache License. You can get it from http://db.apache.org/derby/.more
How do I find out if my database supports row ids?
The Java 6 DatabaseMetaData class has a getRowIdLifetime() method that returns a RowIdLifetime, which has an enumeration of possible values:
ROWID_UNSUPPORTED
ROWID_VALID_FOREVER
ROWID_VALID_SESS...more
How do you access the SQL row ID?
Using ROWID as the column name in the query, you can use the Java 6 getRowId(columnNum) method.
How do you allow a PreparedStatement to be pooled?
The PreparedStatement has two methods in Java 6, isPoolable() and setPoolable(), so you can now request if a PreparedStatement can be pooled or not.
more
How do you check if a Connection hasn't been closed and is still valid?
See the new isValid() method of Connection, added in Java 6.