jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

View:
JDBC FAQ Home Page

FAQ Manager is guru Nils Christian Svihus.

Java Database Connectivity is the standard for communication between a Java application and a relational database. The JDBC API is released in two versions; JDBC version 1.22 (released with JDK 1.1.X in package java.sql) and version 2.0 (released with Java platform 2 in packages java.sql and javax.sql). It is a simple and powerful largely database-independent way of extracting and inserting data to or from any database. [FAQ Previously managed by Lennart Jorelid.]

What's New

How can I get a pooled connection?
Java:API:JDBC:Connections
John Zukowski PREMIUM, Jun 3, 2007
If the DataSource supports pooling connections, calling getConnetion() on the source will return a PooledConnection, instead of a plain Connection. The...
How can I get a pooled connection?
Java:API:JDBC:Connections
John Zukowski PREMIUM, Jun 3, 2007
If the DataSource supports pooling connections, calling getConnetion() on the source will return a PooledConnection, instead of a plain Connection. The...
Where can I read up more on JDBC 4.0?
Java:API:JDBC
John Zukowski PREMIUM, Jun 3, 2007
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?
Java:API:JDBC:Character Sets
John Zukowski PREMIUM, Jun 3, 2007
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?
Java:API:JDBC:SQL
John Zukowski PREMIUM, Jun 3, 2007
This is part of the SQL 2003 specification.
How do I check if a Connection is still valid / has been closed?
Java:API:JDBC:Connections
John Zukowski PREMIUM, Jun 3, 2007
With JDBC 4.0, you can call the isValid(int timeout) method. The timeout represents the number of seconds to wait for a reply. If no reply is acquired...
How can you find the cause of a SQL exception?
Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Jun 3, 2007
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...
What's the difference between a transient and non-transient JDBC exception?
Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Jun 3, 2007
When making a JDBC call, an exception may happen. If performing the same task could succeed without changing anything, that exception is transient. For...
How do I setup my JDBC driver to be automatically loaded in Java 6?
Java:API:JDBC:Drivers
John Zukowski PREMIUM, Jun 3, 2007
Place the name of your java.sql.Driver implementation in the file META-INF/services/java.sql.Driver.
What is Derby?
Java:API:JDBC
John Zukowski PREMIUM, May 31, 2007
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...
How do I find out if my database supports row ids?
Java:API:JDBC:MetaData
John Zukowski PREMIUM, Sep 30, 2006
The Java 6 DatabaseMetaData class has a getRowIdLifetime() method that returns a RowIdLifetime, which has an enumeration of possible values: ROWID_...
How do you access the SQL row ID?
Java:API:JDBC:Queries
John Zukowski PREMIUM, Sep 30, 2006
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?
Java:API:JDBC:Statements:Prepared
John Zukowski PREMIUM, Sep 30, 2006
The PreparedStatement has two methods in Java 6, isPoolable() and setPoolable(), so you can now request if a PreparedStatement can be pooled or not. ...
How do you check if a Connection hasn't been closed and is still valid?
Java:API:JDBC:Connections
John Zukowski PREMIUM, Sep 30, 2006
See the new isValid() method of Connection, added in Java 6.
What's the difference between a transient and non-transient exception?
Java:Language:Exceptions, Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Sep 30, 2006
Subclasses of SQLException have two types, transient and non-transient. Transient exceptions are those that when retried could succeed without changing...
Using Java 6, how do you loop through the causes of a SQL Exception?
Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Sep 30, 2006
The SQLException class is now Iterable in Java 6. try { ... } catch (SQLException sqle) { for(Throwable t : sqle) { System.out.pr...
How do I loop through the causes of a SQL Exception?
Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Sep 30, 2006
You can repeatedly call getCause() of the SQLException: try { ... } catch (SQLException sqle) { for(Throwable t : sqle) { System....
How do I loop through all the causes of a SQLException?
Java:API:JDBC:Exceptions and Warnings
John Zukowski PREMIUM, Sep 30, 2006
You can call the getCause() method of the exception repeatedly try { ... } catch (SQLException sqle) { for(Throwable t : sqle) { ...
How do I load a database driver with JDBC 4.0 / Java 6?
Java:API:JDBC:Drivers
John Zukowski PREMIUM, Sep 30, 2006
Provided the JAR file containing the driver is properly configured, just place the JAR file in the classpath. That's it. No need to manually load the class...
For loading and registering a driver you should use Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"), but I have used JdbcOdbcDriver j=new JdbcOdbcDriver() and I still get a connection. Why is this so?...
Java:API:JDBC, Java:Language:Semantics, Java:API:JDBC:Drivers
Byron Tymvios, Sep 26, 2006
Using Class.forName will create and initialize an instance of the class you pass in as a paramter. So using Class.forName will achieve the same result...
« previous beginning next »


Ask A Question



Related Links

JDBC Forum

Sun's JDBC pages

JDBC 2.0 optional package

Wish List
Features
About jGuru
Contact Us

 



The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers