zno2

JDBC 常用驱动类及url格式

1. oracle

     <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3.0</version>
        </dependency>

 

     String driver = "oracle.jdbc.OracleDriver";// 驱动类全路径名
        String url = "jdbc:oracle:thin:@//myhost:1521/myservicename";
        String username = "scott";
        String password = "tiger";

 

2. mysql

     <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.35</version>
        </dependency>

 

     String driver = "com.mysql.jdbc.Driver";// 驱动类全路径名
        String url = "jdbc:mysql://localhost:3306/mydb";
        String username = "monty";
        String password = "greatsqldb";

 

3.

 

posted on 2016-08-06 07:24  zno2  阅读(241)  评论(0编辑  收藏  举报

导航