⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 databasemanager.java

📁 java 完全探索的随书源码
💻 JAVA
字号:
import java.sql.*;import java.util.*;import sun.jdbc.odbc.*;public class DatabaseManager{  // These properties could come from a system configuration file  //static private String urlHeader = "jdbc:polite:";//  static private String databaseName = "POLITE";//  static private String user = "SYSTEM";//  static private String password = "";//  static private String driverName = "oracle.lite.poljdbc.POLJDBCDriver";  static private String urlHeader = "jdbc:odbc:";  static private String databaseName = "POLITE";  static private String user = "SYSTEM";  static private String password = "";  static private String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";  public static Connection getConnection()  {    // Define the local Connection instance that gets returned    Connection conn = null;    try    {      // Load the JDBC driver      Class.forName( driverName );      // Get an instance of the Connection. Really the Connection is an      // interface that some class implements.      // Concat the three parts together to build the full URL      String databaseURL = urlHeader + databaseName;      conn = DriverManager.getConnection( databaseURL, user, password );    }    catch( ClassNotFoundException ex )    {      // The JDBC driver class could not be found      ex.printStackTrace();      System.exit( -1 );    }    catch( SQLException ex )    {      // A sql exception occured, for now just print out the stack trace      ex.printStackTrace();    }    return conn;  }}

⌨️ 快捷键说明

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