JDBC Section Index | Page 2
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
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
See the new isValid() method of Connection, added in Java 6.
Subclasses of SQLException have two types, transient and non-transient. Transient exceptions are those that when retried could succeed without changing anything. Non-transient exceptions are tho...more
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? Why should I use Class.forName("");
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 s...more
How do I insert a .jpg into a mySQL data base? I have tried inserting the file as byte, but I recieve an error message stating that the syntax is incorrect.
How do I insert a .jpg into a mySQL data base? I have tried inserting the file as byte, but I recieve an error message stating that the syntax is incorrect. - David Bennet
What is the best way to generate a universally unique object ID? Do I need to use an external resource like a file or database, or can I do it all in memory?
[I need to generate unique id's that will be used for node 'ID' attribute values within XML documents. This id must be unique system-wide. The generator must be available to a number of servlets t...more
Whan happens when I close a Connection application obtained from a connection Pool? How does a connection pool maintain the Connections that I had closed through the application?
It is the magic of polymorphism, and of Java interface vs. implementation types. Two objects can both be "instanceof" the same interface type, even though they are not of the same implem...more
How can I correctly parse CSV ( comma separated values ) files? StringTokenizer doesn't seem to fit many conditions.
Ian Darwin has two classes ( CSV.java and CSVRE.java ) to handle CSV files in his Java Cookbook, including a way with regular expressions. You can download the code from his site, probably best t...more
You can use last() method of java.sql.ResultSet, if you make it scrollable. Joe Sam Shirah adds: You can also use isLast() as you are reading the ResultSet. One thing to keep in mind, though, is...more
I don't know about existing drivers, but JavaPro had a good article on writing your own driver. The example was a driver to access XML files. check it out at JavaPro December, 2001. Joe Sam Shira...more
Problem with getDouble() We use the Java method getDouble() to get numeric values. Up to now it worked properly but suddenly we got false values, like 49066.429000000004 for the true value 49066.4...more
There a several drivers with source available, like MM.MySQL, SimpleText Database, FreeTDS, and RmiJdbc. There is at least one free framework, the jxDBCon-Open Source JDBC driver framework. Any...more
How do I implement a RowSetReader? I want to populate a CachedRowSet myself and the documents specify that a RowSetReader should be used. The single method accepts a RowSetInternal caller and retu...more
The Reader must be registered with the CachedRowSet using CachedRowSet.setReader(javax.sql.RowSetReader reader). Once that is done, a call to CachedRowSet.execute() will, among other things, invo...more