Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JDBC Connection (Urgent...please Help

Status
Not open for further replies.

kaushikmehta

Programmer
Sep 6, 2001
2
US
Hey there,

The issue i am facing is i am trying to make a JDBCODBC connection using a third party custom driver. This is the code i am using

con =DriverManager.getConnection("jdbc:eek:dbc:DS", "username", "password");
Statement stmt = con.createStatement();

Now this statement works fine in JDK 1.1.8 environment. But my development needs to happen in JDK 1.3.1 envirnment. But as soon as i put this code in that environment(JDK1.3.1) i get an error

SQLException: The result set type is not supported.

So i changed that code to say
Statement stmt = con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

In this case it gives me an error

SQLException: The result set type is not supported.

So i changed the resultset type to

Statement stmt = con.createStatement(ResultSet.FETCH_UNKNOWN,ResultSet.CONCUR_READ_ONLY);

In this case the error i get is

SQLException: Invalid Cursor Type.

I do not know what to do and what resulttype to support. I will appreciate any help i can get.

Thanks in Advance

Kaushik Mehta
 
Below is my sample code that I ran after I saw your question. I have absolutely no problem compiling or running this little app. I ran it using the mm.mysql JDBC driver. Perhaps your 3rd party driver is a faulty implementation. Or perhaps you simply need to update your drivers for your third part implementation (make sure it's 1.3 compliant).
Hope that helps,
Ghalib

import java.sql.*;

public class Jdb {

public Jdb() {
}
public static void main(String args[]) {
String url = "jdbc:mysql://localhost:3306/fruit";
try {
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection(url, "test", "user");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from 8froom");
while (rs.next()) {
String n = rs.getString("name");
int a = rs.getInt("age");
int y = rs.getInt("years");
System.out.println(n + " " + a + " " + y + ".");
}
} catch (SQLException e) {
System.out.println("Error " + e.getMessage());
} catch (ClassNotFoundException c) {
System.out.println("class not found " + c.getMessage());
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top