Advertisement

jdbc学习

阅读量:

一、JDBC基础

1.连接参数关闭顺序:倒序关闭

复制代码
  /** * 关闭资源
    
      *      倒关
    
      */
    
     rs.close();
    
     statement.close();
    
     conn.close(); //这个必须关
    
    
    
    

2. JDBC连接过程中的标准化处理

复制代码
    @Test

    
     public void fun1() throws SQLException {
    
     //先初始化
    
     Connection conn=null;
    
     Statement statement=null;
    
     ResultSet rs=null;
    
     try{
    
         String className="com.mysql.cj.jdbc.Driver";
    
         String uri="jdbc:mysql://localhost:3306/javaweb?serverTimezone=GMT%2B8&useSSL=true";
    
         String usernam

全部评论 (0)

还没有任何评论哟~