JDBC加载驱动和创建连接

来源:互联网 发布:网络管理设备 编辑:程序博客网 时间:2024/05/03 12:27

MySQL数据库:

        DRIVER="com.mysql.jdbc.Driver";

        URL="jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=gbk;

        USER="root";

        PASS="root";

 

Oracle数据库:

        DRIVER="oracle.jdbc.driver.OracleDriver";

        URL="jdbc:oracle:thin:@localhost:1521:orcl;

        USER="scott";

        PASS="tiger";

 

SQLServer数据库:

        DRIVER="com.microsoft.jdbc.sqlserver.SQLServerDriver";

        URL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb;

        USER="admin";

        PASS="admin";

 

DB2数据库:

        DRIVER="com.ibm.db2.jdbc.app.DB2Driver";

        URL="jdbc:db2://localhost:5000/sample";

        USER="db2";

        PASS="db2";

 

PostgreSQL数据库

        DRIVER="org.postgresql.Driver";

        URL="jdbc:postgresql://localhost/myDB";
        USER="user";

        PASS="pass";