📄 listing 10-7.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -