File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connect to database/ JDBC

 
Chanpreet Julka
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to connect to a sybase database using the JDBC classes, but it is telling me the driver is not found. I have been working on it and can't figure out what the problem is. Here is the code... help please. thanks.
import java.util.*;
import java.sql.*;
public class DataSheetRetriever {

public static void main(String[] args) {
Connection con = null;
String Driver = "com.sybase.jdbc2.jdbc.SybDriver";
String URL = "jdbc:sybase:Tds:";
String Host = "10.73.2.11:2010/NGSIDB";
String userid = "guest";
String passwd = "guestsun";

try {
Class.forName(Driver).newInstance();
con = DriverManager.getConnection(URL+Host, userid, passwd);
Statement select = con.createStatement();
}
catch(Exception e) {
System.err.println("Unable to load the Sybase Driver " + e.getMessage() );
if(con != null) {
try{ con.close(); }
catch(Exception ee){}

}
}
DataSheetRetriever dsr = new DataSheetRetriever();

}
public Vector getDatasheet(String siteId)
{
Vector v = new Vector();
return v;
}
}
 
Rajendar Goud
Ranch Hand
Posts: 220
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi u need to first download this 'sybase' driver and install it. then u can try running this example.
Raj
 
Chanpreet Julka
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic