| | |
Test JDBC drivers
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
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)); } }
Similar Threads
- Application can't find JDBC Drivers (Java)
- Drivers test! (Geeks' Lounge)
- Test-Typing Vs. Test-Speaking (IT Professionals' Lounge)
- What is the difference between jdbc odbc jdbc-odbc (JSP)
- how to install nvidia drivers and soundblaster drivers on mandrake (*nix Software)
| Thread Tools | Search this Thread |
android api applet application array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) chat class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse editor error errors event eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle parsing plazmic print problem program programming project recursion scanner screen server set sharepoint size smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads time tree unlimited utility webservices windows



