File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Connecting with SQL 2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting with SQL 2000" Watch "Connecting with SQL 2000" New topic
Author

Connecting with SQL 2000

Devavrat Bagayat
Greenhorn

Joined: Jun 24, 2001
Posts: 25
I want to connect to SQL 2000 database, I tried it with -
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=DriverManager.getConnection("jdbc dbc:A");
Statement stmt=conn1.createStatement();
but its not working.
Does anyone have the code to connect java to SQL 2000, the might be 4-5 line code ?
Patrick Mugabe
Ranch Hand

Joined: Jan 08, 2002
Posts: 132
Try this:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
//establish the connection with the data source
String url = "jdbc dbc:MyDataSource";
con = DriverManager.getConnection(url, "loginName" ,"password");
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
>> String url = "jdbc dbc:MyDataSource";

How to code "MyDataSource"?

Thanks.


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
 
Consider Paul's rocket mass heater.
 
subject: Connecting with SQL 2000