JDBC Section Index | Page 5
DB2 Universal claims to support JDBC 2.0, But I can only get JDBC 1.0 functionality. What can I do?
DB2 Universal defaults to the 1.0 driver. You have to run a special program to enable the 2.0 driver and JDK support. For detailed information, see Setting the Environment in Building Java Apple...more
How can I ensure that my SQL statements meet SQL standards to get maximum portability?
One tool to use is Mimer SQL Validator. This page links to validators for SQL-92 and SQL-99 ( SQL3 ). In addition, there is a list of SQL reserved words.more
How can I overwrite blob data in an Oracle database?
How can I overwrite blob data in an Oracle database? I want to replace the blob in the selected row with byte[] blobData using the following code:
OracleResultSet rset=null;
OutputStream os=null;...more
My driver claims to support JDBC 2.0, but some methods get an unsupported exception. How can I verify that the driver will work?
The DatabaseMetaData class has a large number of supportsXXX methods which you can use to ensure that the operation will proceed or otherwise provide a workaround. See the API documentation for d...more
How do I disallow NULL values in a table?
Null capability is a column integrity constraint, normally aplied at table creation time. Note that some databases won't allow the constraint to be applied after table creation. Most databases a...more
I've heard that I can save space by allowing NULLs for columns where no value is supplied. Is that correct?
While the answer is ultimately dependent on your specific DBMS, most databases create an extra byte for every null capable column to mark whether or not it contains a null value. This clearly mea...more
How do I insert/update records with some of the columns having NULL value?
Use either of the following PreparedStatement methods:
public void setNull(int parameterIndex,
int sqlType) throws SQLException
public void setNull(int paramIndex,
...more
How to get a field's value with ResultSet.getxxx when it is a NULL?
How to get a field's value with ResultSet.getxxx when it is a NULL?
I have tried to execute a typical SQL statement:
select * from T-name where (clause);
But an error gets thrown because there ar...more
How can I send input to an Excel file from my Java program?
Here some possible solutions for your problem:
It's Excel-lent and The Java-Excel solution revisited.
Joe Sam Shirah adds: Also see
How can I connect to an Excel spreadsheet file using jdbc? an...more
Is there a way to find the primary key(s) for an Access Database table? Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.
// Use meta.getIndexInfo() will get you the PK index. Once
// you know the index, retrieve its column name
DatabaseMetaData meta = con.getMetaData();
String key_colname = null;
// get the pri...more
Why can't Tomcat find my Oracle JDBC drivers in classes111.zip?
TOMCAT 4.0.1 on NT4 throws the foll exception when i try to connect to Oracle DB from JSP.
javax.servlet.ServletException : oracle.jdbc.driver.OracleDriver
Root Cause :
java.lang.ClassNotFoundEx...more
How can I write a CLOB object in weblogic using type 4 driver with Oracle?
The following documentation from Oracle should help: Working with BLOBs and CLOBs
Also see Clob Updating.more
I try to execute this procedure through CallableStatement, then I execute by calling the execute() method. When I process this using getMoreResults() & I am getting only update count, not my output parameter.
I have a Stored procedure, which consists of the following:
Creating a Temp Table
Inserting Records to that
Do some more modifications..
Creating Cursors
Some Select Statements...
Mo...more
I'm using the Oracle thin driver to update a batch of records using a prepared statement, addBatch() and executeBatch(). All of the updates go through fine and the data is updated correctly, but all of the updateCounts returned are "-2". I haven't been able to find any documentation for the thin driver, so I don't know if this return code is something I should be worried about, or if I should just ignore it.
From the JDK 1.3 Statement.executeBatch() API documentation: "A value of -2 -- indicates that the command was processed successfully but that the number of rows affected is unknown." See the docu...more
What is the JDBC equivalent of "ODBC Data Source Administrator" ODBC Data Source Administartor facilitates for selecting a driver and setting up all data source specific attributes to establish a connection to the data store(DSN). To incorporate such a functionality in my software, is there any counterpart which I can use for JDBC drivers?
There is not a JDBC specific equivalent, but the Java way, typically, is to use properties files or ResourceBundles. For an example, see Generalizing Connection Information--Batch in my JDBC 2.0 ...more