Driver集合

Mysql(driverdownload: http://mysql.cs.pu.edu.tw/Downloads/Connector-J/mysql-connector-java-5.1.6.zip):

  Class.forName("com.mysql.jdbc.Driver");

  Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/cmsjsp?user=root&password=");

Oracle(driverdownload: ):

  Method1: JDBC Driver

    Class.forName("oracle.jdbc.driver.OracleDriver");

    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@hocalhost:1521:dbname", "scott", "tiger");

  Method2: JDBC-ODBC

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    Connection conn = DriverManager.getConnection("jdbc:odbc:localhost", "scott", "tiger");

SQLServer:

  Method1: JDBC Driver

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

    Connection conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname", "scott", "tiger");

  Method2: JDBC-ODBC

    Class.forName("net.sourceforge.jtds.jdbc.Driver");

    Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/dbname", "scott", "tiger");

posted @ 2012-07-08 17:49  我是小菜鸟  阅读(223)  评论(0编辑  收藏  举报