Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I connect a Unix based Java App to Windows based Ms Sql Server

Status
Not open for further replies.

Sudmill

Programmer
Apr 20, 2001
65
GB
Hi,


Im am looking for assistance to get a unix based java app connecting on a local network to a Windows based MS SQL Server to obtain information.

Any suggestions to a free and stable solution? If JDBC is the way to go how would I implement it across platforms?
Im pretty new to Java so any help would be greatly appreciated !

Cheers,

J. Cheers

John (Sudmill)
 
Please download the JDBC driver for SQL 2000 from is easy to use with the online help.
After downloading you shoud add 3 jar files to current JVM's classpath(msbase.jar;mssqlserver.jar;msutil.jar)
The following is codesnippet:
....

String sDBDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String sConnStr = "jdbc:microsoft:sqlserver://yourSQLserverBox:1433";

Class.forName(sDBDriver);
Connection conn = DriverManager.getConnection(sConnStr,"YourUser","YourPassword");
System.out.println( "Maximum row size: " + conn.getMetaData().getMaxRowSize() );
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from yourTable");
...

Regards! IPO_z@cmmail.com
Garbage in,Garbage out
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top