Hard to say what you're doing wrong without seeing your code. This works for me
(remember to import java.sql.*;):
try {//Begin try to load JDBC driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Load database driver and create connection
try
{
//Get a Connection to the database
conOra = DriverManager.getConnection("jdbc:odbc:DSN", "USERID",
"PASSWORD");
System.out.println( "Connected to DSN" );
} catch( Exception e ) {
System.out.println( "Could not initialize the database." );
e.printStackTrace();
}
}//End try to load JDBC driver
catch(ClassNotFoundException e) {
System.out.println("Couldn't load database driver: " + e.getMessage());
}
finally {
try {
if (conOra != null) conOra .close();
System.out.println("Closed the conOra connection.");
} catch(SQLException e) {
System.out.println("Could not close the current
connection.");
e.printStackTrace();
}
}
ananthakrishnan <[EMAIL PROTECTED]>@JAVA.SUN.COM> on 01/24/2001 12:12:34 AM
Please respond to "A mailing list for discussion about Sun Microsystem's Java
Servlet API Technology." <[EMAIL PROTECTED]>
Sent by: "A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology." <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: Help in Jdbcodbc bridge,dsn
hi,
I need help in the foll regards
1) I am using jdbcodbc bridge and want to connect to oracle database
using a dsn.
2) With thin driver iam able to connect and am able to retrieve record
sets
3) But with jdbc bridge I created a system dsn and tried to retrieve
records and it says java has performed illegal operation.
Is the problem due to something related to drivers or what.
if possible send me a code snippet also for the same
thanks in advance
Anantha Krishnan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html