This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes JDBC code works with JDK1.1.8 but not with JDK1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC code works with JDK1.1.8 but not with JDK1.3" Watch "JDBC code works with JDK1.1.8 but not with JDK1.3" New topic
Author

JDBC code works with JDK1.1.8 but not with JDK1.3

sunil virup
Greenhorn

Joined: Aug 07, 2001
Posts: 5
Hello All,
I recently downloaded a ODBC driver (17th Aug 2001 release) called LinkBook for QuickBooks. The driver when used with JAVA(JDK1.1.8 ) ie accessed using JDBC-ODBC Bridge works fine and allows me to acess data stored inside .QBW files of QuickBooks.

But when I try to run the same code using JDK1.3,it throws me an exception saying

"Exception in thread "main" java.sql.SQLException: The result set type is not supported.
at sun.jdbc.odbc.JdbcOdbcStatement.initialize(JdbcOdbcStatement.java:154)
at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(JdbcOdbcConnection.java:420)
at sun.jdbc.odbc.JdbcOdbcConnection.createStatement(JdbcOdbcConnection.java:394)
at checkQuickBook.main(checkQuickBook.java:16)"
If any one has accessed QuickBooks .QBW files by any means using JAVA,I would like to hear from u.Kindly help me,its urgent.

here is the code that I have written.Kindly help me solve this problem.

CODE
----------------------------------------------------------------------------------------------------------------------------------
import java.sql.*;

public class checkQuickBook
{
public static void main(String args[]) throws Exception
{
String url = "jdbc dbc:myfirstlinktoquickbooks";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(url,"","");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM Budgets");//Budgets is a table in default DB that comes with QuickBooks
while(rs.next())
{
System.out.println(rs.getString(1));
}
}
}
Nathanael Ulrick
Greenhorn

Joined: Jul 17, 2001
Posts: 22
createStatement() can take two extra arguments: resultSetType and resultSetConcurrency.
It's probably because the default values differ between 1.1.8 and 1.3, and 1.3 is trying to create some fancy ResultSet which is scrollable etc, which the ODBC driver doesn't support.
Try specifying the arguments to something you know will be safe, e.g. TYPE_FORWARD_ONLY and CONCUR_READ_ONLY.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC code works with JDK1.1.8 but not with JDK1.3
 
Similar Threads
Connecting To Database
moving record pointer backwards - error
getconnection() --> SQLException
JdbcOdbc Connection
URL error (DSN not found)