makingtheconnection.java
来自「此程序都是企业级 的数据库开发程序 全面揭示了JAVA对数据库的操作」· Java 代码 · 共 32 行
JAVA
32 行
import java.sql.*;
public class MakingTheConnection {
public static void main(String[] args) {
// Load the driver
try {
// Load the driver class
Class.forName("COM.cloudscape.core.JDBCDriver");
// Define the data source for the driver
String sourceURL = "jdbc:cloudscape:Wrox4370.db";
// Create a connection through the DriverManager
Connection databaseConnection =
DriverManager.getConnection(sourceURL);
// We made it!
System.out.println("Connection established successfully!");
// close connection
databaseConnection.close();
}
catch (ClassNotFoundException cnfe) {
System.err.println(cnfe);
}
catch (SQLException sqle) {
System.err.println(sqle);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?