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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Sybase Database connection problem

843853Sep 20 2001 — edited Oct 8 2001
Hi!!

I am trying to connect to Sybase datbase which is on my local disk by followin code...during the execution I am getting the run time error :java.sql.SQLException:JZ006: caught IOException:java.net.ConnectException :Connection refused : connect

the name of computer is compaq1 and I am confused about the port number..so anybody can please help me regarding which port i should use or atleast where can i find it
import java.sql.*;
//import jconnect4_2.classes.com.sybase.jdbc.*;
public class myConnection {

public static void main( String[] args ) {

try {
System.out.println("Abcd0");


// Using Sybase jConnect 4.2

Class.forName("com.sybase.jdbc.SybDriver");

// Using Sybase jConnect 5.2
//Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
System.out.println("Abcd");

Connection conn = DriverManager.getConnection("jdbc:sybase:Tds:compaq1:3306", "dba", "sql");
Statement stmt = conn.createStatement( );

/*ResultSet rs = stmt.executeQuery( "SELECT * FROM ");
while ( rs.next( ) ) {
System.out.println( rs.getInt( 1 ) );
}*/
} catch ( Exception e ) {
System.out.println( "An exception occurred."+e );
}

} // end of main

} // end of MyConnection class




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2001
Added on Sep 20 2001
3 comments
263 views