a simple program to test the JDBC drivers.

123 Views
import java.sql.*;

public class TestJdbc {
	static String sql = "select * from test_table where column1 = ?"; 

	static String userId = "userid";
	static String password = "password";
	static String dbServer = "dbserver";
	static String dbName = "database";
	
	public static void main(String[] args) throws Exception {
		testMSDriver();
	}

	private static void testMSDriver() throws Exception {
		Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
		Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ dbServer +";SendStringParametersAsUnicode=false;dataSourceName=SQL2000JDBC;databaseName="+ dbName +";serverName="+ dbServer +";selectMethod=cursor", userId, password);

		long start = System.currentTimeMillis();
		PreparedStatement stmt = conn.prepareStatement(sql);
		stmt.setString(1, "string1");
		ResultSet rs = stmt.executeQuery();

		while (rs.next()) {
	 		// System.out.println("Result: " + rs.getString(1));
		}
		conn.close();
		System.out.println("Elapsed time for MS driver: " + 
						(System.currentTimeMillis() - start));
	}
}
About the Author

This is the year where hope fails you
The test subjects run the experiments
And the bastard you know, is the hero you hate
But cohesing is possible if we strive
Theres no reason, theres no lesson
No time like the present, tell me right now
What have you got to lose, what have you got to lose Except your soul... Who's with us?!?!?!?!?!?!