listing 10-7.java
来自「这是JAVA开发大全的源代码」· Java 代码 · 共 26 行
JAVA
26 行
Connection Db;
Properties props = new Properties ();
try {
FileInputStream propFileStream =
new fileInputStream("DBProps.txt");
props.load(propFileStream);
}
catch(IOException err) {
System.err.print("Error loading propFile: ");
System.err.println (err.getMessage());
System.exit(1);
}
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
Db = DriverManager.getConnection(url, props);
}
catch (ClassNotFoundException error) {
System.err.println("Unable to load the JDBC/ODBC bridge." +
error);
System.exit(2);
}
catch (SQLException error) {
System.err.println("Cannot connect to the database." + error);
System.exit(3);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?