例2.2に、 DriverManagerを使用してデモ・データ・ストアへの直接ドライバ接続を作成し、SQLを実行して、接続をクローズするアプリケーションの一般的なフレームワークを示します。処理の例については、level1.java
デモを参照してください。
String URL = "jdbc:timesten:dsn=demo";
Connection con = null;
try {
Class.forName("com.timesten.jdbc.TimesTenDriver");
} catch (ClassNotFoundException ex) {
// 「エラー処理」を参照
}
try {
// Open a connection to TimesTen
con = DriverManager.getConnection(URL);
// Report any SQLWarnings on the connection
// 「エラーおよび警告のレポート」を参照
// Do SQL operations
// 「TimesTenデータの管理」を参照
// Close the connection to TimesTen
con.close();
// Handle any errors
} catch (SQLException ex) {
// 「エラー処理」を参照
}