The Artima Developer Community
Sponsored Link

Java Answers Forum
conncect to database/JDBC

1 reply on 1 page. Most recent reply: Mar 7, 2002 9:49 AM by Anil S.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
chan

Posts: 2
Nickname: champion
Registered: Feb, 2002

conncect to database/JDBC Posted: Mar 6, 2002 1:31 PM
Reply to this message Reply
Advertisement
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;
}
}


Anil S.

Posts: 13
Nickname: anil
Registered: Feb, 2002

Re: conncect to database/JDBC Posted: Mar 7, 2002 9:49 AM
Reply to this message Reply
See to that your driver is in the CLASSPATH.

Flat View: This topic has 1 reply on 1 page
Topic: A little help getting started!! Previous Topic   Next Topic Topic: Java Native Code

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use