JDBC Section Index | Page 19
The next version of the ANSI/ISO SQL standard defines some new datatypes, commonly referred to as the SQL3 types. The primary SQL3 types are: STRUCT: This is the default mapping for any SQL struc...more
One of the more advanced features of JDBC 2.0 is the ability to submit multiple update statements to the database for processing as a single unit. This batch updating can be significantly more eff...more
What does ResultSet actually contain? Is it the actual data of the result or some links to databases? If it is the actual data then why can't we access it after connection is closed?
A ResultSet is an interface. Its implementation depends on the driver and hence ,what it "contains" depends partially on the driver and what the query returns. For example with the Odbc bridge wh...more
How can I retrieve only the first n rows, second n rows of a database using a particular WHERE clause ?
How can I retrieve only the first n rows, second n rows of a database using a particular WHERE clause ? For example, if a SELECT typically returns a 1000 rows, how do first retrieve the 100 rows, ...more
If your autoCommit flag (managed by the Connection.setAutoCommit method) is false, you are required to call the commit() method - and vice versa.
Sun maintains a fairly current list of JDBC drivers that support the JDBC 2.x and JDBC 1.x APIs, at: http://industry.java.sun.com/products/jdbc/driversmore
When retrieving database results, the best collection implementation to use is the LinkedList. The benefits include: Retains the original retrieval order Has quick insertion at the head/tail Doe...more
I have the choice of manipulating database data using a String or a java.sql.Clob. Which has best performance?
java.sql.Clob, since it does not extract any data from the database until you explicitly ask it to. The Java platform 2 type Clob wraps a database locator (which is essentially a pointer to char)....more
I have the choice of manipulating database data using a byte or a java.sql.Blob. Which has best performance?
java.sql.Blob, since it does not extract any data from the database until you explicitly ask it to. The Java platform 2 type Blob wraps a database locator (which is essentially a pointer to byte)....more
Most JDBC drivers should accept 3 properties: user password hostname However, a JDBC driver may accept an arbitrary number of properties thrown at it. Drivers can be interrogated...more
Use the method getProcedureColumns in interface DatabaseMetaData to probe a stored procedure for metadata. The exact usage is described in the code below. NOTE! This method can only discover para...more
Use the getProcedures method of interface java.sql.DatabaseMetaData to probe the database for stored procedures. The exact usage is described in the code below. public static void...more
How do I extract the SQL statements required to move all tables and views from an existing database to another database?
Boy, this is a big one. :) The operation is performed in 9 steps: Open a connection to the source database. Use the DriverManager class. Find the entire physical layout of the cu...more
Use the getColumns method of the java.sql.DatabaseMetaData interface to investigate the column type information of a particular table. Note that most arguments to the getColumns method (pinpointin...more
The JDBC view of a database internal structure can be seen in the image below. Several database objects (tables, views, procedures etc.) are contained within a Schema. Several ...more