conntest20.java

来自「b树实现源码,linux和unix下运行,速度快,极好用」· Java 代码 · 共 25 行

JAVA
25
字号
//Open the connection and then call isClosed(). It should return false.
//Close the connection and then call isClosed(). It should return true.
//Author: XieLiang
import java.sql.*;
public class ConnTest20 
{
    public static void main(String[] args) 
    {
       try
       {
           Class.forName("csql.jdbc.JdbcSqlDriver");
           Connection con = DriverManager.getConnection("jdbc:csql", "root", "manager");
	   if ( con == null )
		   System.exit(1);
	   if(con.isClosed()) System.exit(1);
           con.close();
	   if(!con.isClosed()) System.exit(1);
        }catch(Exception e) {
            System.out.println(e.getMessage());
            e.getStackTrace();
            System.exit(1);
       }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?