Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connectivity problem with Jconnect using sybase, please help....................!

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am trying to establish the connection with Sybase as the backend. I am using jConnect5.2 as the driver to establish the connection. When i try to run the connection code, it is giving me the error, Java.sql.sqlException: JZ006: Caught IOException:JavanetConnectionException:Connection refused.
I am also enclosing the code for your better understanding,
import java.io.*;
import java.sql.*;
public class SampleCode
{
public static void main(String args[])
{
try
{

Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
System.out.println("Driver Loaded");

/*
* Open the connection. May throw a SQLException.
*/
Connection con = DriverManager.getConnection("jdbc:sybase:Tds:192.168.4.26:3767/sademo","dba","sql");
System.out.println("connected");
/*
* Create a statement object, the container for the SQL
* statement. May throw a SQLException.
*/
Statement stmt = con.createStatement();
System.out.println("statement created");
/*
* Create a result set object by executing the query.
* May throw a SQLException.
*/
ResultSet rs = stmt.executeQuery("Select 1");
/*
* Process the result set.
*/
if (rs.next())
{
int value = rs.getInt(1);
System.out.println("Fetched value " + value);
}
}
/*
* Exception handling.
*/
catch (Exception sqe)
{
System.out.println("Exception :" + sqe);
}
System.exit(0);
}
}

thanks and regards
gopal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic