pooltest.java
来自「此程序都是企业级 的数据库开发程序 全面揭示了JAVA对数据库的操作」· Java 代码 · 共 43 行
JAVA
43 行
package pooling;
import java.sql.*;
import profiler.Profiler;
public class PoolTest {
private static ConnectionPool pool;
private static String url = "jdbc:cloudscape:c:/wrox/database/Wrox4370.db";
private static String username = "";
private static String password = "";
public static void main(String args[]) {
// Create an instance of our profile
Profiler p = new Profiler();
try {
// Establish our Connection
System.out.println("Establish a connection [" + url + "] username ["
+ username + "] password [" + password + "]\n");
pool = new ConnectionPool(url, username, password);
// Lets Get 10 Connections
Connection c[] = new Connection[10];
// Obtain 10 connections and profile this section of code
// .. START
p.Start("main() in PoolTest");
for (int i = 0; i < 10; i++) {
c[i] = pool.getConnection();
}
p.Stop();
// .. END
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?