aspose file tools*
The moose likes JDBC and the fly likes  com.thinweb.tds.Driver  for Ms SQL 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark " com.thinweb.tds.Driver  for Ms SQL 7" Watch " com.thinweb.tds.Driver  for Ms SQL 7" New topic
Author

com.thinweb.tds.Driver for Ms SQL 7

sean zang
Ranch Hand

Joined: Apr 22, 2000
Posts: 33
Hi ,All
Does anybody use THINWEB.com JDBC driver( type4) to connect with MS SQL server 7.0?
i try to test this driver but failed?
Does anyone figure out whats problem with following code:
mport java.sql.*;
class TestMsql7 {
public static void main(String argv[]) {
try {
String url = "jdbc:twtds:sqlserver://192.168.1.5:1433/pubs;CHARSET=cp950;TDS=4.2";
System.out.println("Attempting to connect..");
Connection con = DriverManager.getConnection(url,"sa","");
System.out.println("Connection establised");
// Create statement
Statement stmt = con.createStatement();
// Execute query
String query = "select * from sales";
// Obtain the result set
ResultSet rs = stmt.executeQuery(query);
System.out.println("JDBC SQL Query : "+query);
System.out.println("Results : ");
// Loop through each result row
while(rs.next()) { // Null point exception
// Print out each field as a string
System.out.print(rs.getString("qty"));
System.out.println("");
}
rs.close();
stmt.close();
con.close();
}
catch( Exception e ) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
Run Result:
Attempting to connect..
Connection establised
JDBC SQL Query : select * from sales
Results :
null
java.lang.NullPointerException
at com.thinweb.tds.Tds.b(Unknown Source)
at com.thinweb.tds.Tds.a(Unknown Source)
at com.thinweb.tds.ResultSet.next(Unknown Source)
at TestMsql7.main(TestMsql7.java:25)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: com.thinweb.tds.Driver for Ms SQL 7