Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Trying to connect to Sybase with Java jdbc

843859Sep 28 2005 — edited Sep 28 2005
Hoping someone can help me to connect to Sybase database (version is Sybase Adaptive Server Enterprise 12.5.3). I am using a technique I read that worked with Access and adapting by some examples for Syabase I found on the web but keep getting errors. Below is my code with some of the examples Ive been using commented out.

I have created a DSN on my Windows Xp o/s named GPTS_SYBASE via ODBC Use DSN set-up wizard, driver is Sybase ASE ODBC Driver.

import java.sql.*;

public class DBConn {
public DBConn(){
}
public static void main(String[] args) {
try {
//Class.forName("com.sybase.jdbc2.jdbc.SybDriver.class.getname()");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");

String sourceURL = "jdbc.odbc.GPTS_SYBASE";
//String sourceURL = "jdbc.sybase.Tds:GPTSPSYB1:5000/gpts";

Connection conn = DriverManager.getConnection(sourceURL, "gptsdbo", "gptsdbo");
//Connection conn = DriverManager.getConnection(sourceURL);
System.out.println("Success");
} catch (Exception e) {
System.err.println("Got an excpetion! ");
System.err.println(e.getMessage());
}
}
}


Error message from this code is
Got an excpetion!
com.sybase.jdbc2.jdbc.SybDriver
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 26 2005
Added on Sep 28 2005
1 comment
545 views