jdbc连接测试

package com.itcast.demo1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import org.junit.Test;

public class Demo1 {
    @Test
    public void fun1() throws ClassNotFoundException, SQLException{
        /**
         * jdbc四大参数
         * driverClassName:com.mysql.jdbc.Driver
         * url:jdbc:mysql://localhost:3306/mydb3
         * username:root
         * password:root
         */
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc.mysql://localhost:3306/test";
        String username = "root";
        String password = "root";
        Connection conn = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/test", "root", "root");
        System.out.println(conn);
        
    }

}

 

jdbc连接测试

上一篇:蓝桥杯c/c++省赛真题——日志统计


下一篇:keepalive主从上同时出现VIP,且均无法消失