Sybase-JDBC Guru's,
I need to connect to a remote Sybase Database using JAVA Application (JDBC). The database is located in a different location and i can ping the server using the IP. Does anyone has a code snippet which helps me to fetch the data from Sybase Database Server. I have less time to investigate, so please provide some code link or similar solution. Appreciate
-
Remote Connectivity to Sybase Database (1 messages)
- Posted by: Server Side
- Posted on: March 06 2002 16:13 EST
Threaded Messages (1)
- Remote Connectivity to Sybase Database by anil bisht on March 07 2002 00:40 EST
-
Remote Connectivity to Sybase Database[ Go to top ]
- Posted by: anil bisht
- Posted on: March 07 2002 00:40 EST
- in response to Server Side
Hi,
IT depends which driver you are using.
I am using Jconnect.
Code to connect database for jdbc is
Properties props = new Properties();
props.put("user", "CDB_GEN"); // user id for the database
props.put("password", "proximus"); // password for the database
Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
String url= "jdbc:sybase:Tds:<ip/host name>:<port at wich the database service is running>";
con = DriverManager.getConnection(url,props);
YOu can get the Jconnect driver from the sybase site.
and if you want to use odbc
Then
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "Jdbc:Odbc:<dsn name>";
con = DriverManager.getConnection(url,<userid>, <password>);
HTH
Anil