databaseconnecttest.java

来自「java 完全探索的随书源码」· Java 代码 · 共 26 行

JAVA
26
字号
import java.sql.*;public class DatabaseConnectTest{  public static void main(String[] args)  {    // Get an instance of a Connection from the DatabaseManager    // who is performing Creator pattern here by creating instances of    // a class that implements the Connection interface.    Connection conn = DatabaseManager.getConnection();    if ( conn != null )    {      System.out.println( "Connection attempt was successful!" );      try      {        conn.close();      }      catch( SQLException ex )      {        ex.printStackTrace();        System.out.println( "Problem closing the connection" );      }    }  }}

⌨️ 快捷键说明

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