ヘッダーをスキップ
Oracle TimesTen In-Memory Database Java開発者およびリファレンス・ガイド
リリース6.0
B25766-01
  目次へ
目次
索引へ
索引

前へ
前へ
次へ
次へ
 

直接ドライバ接続のオープンおよびクローズ

例2.2に、DriverManagerを使用してデモ・データ・ストアへの直接ドライバ接続を作成し、SQLを実行して、接続をクローズするアプリケーションの一般的なフレームワークを示します。処理の例については、level1.javaデモを参照してください。

例2.2

String URL = "jdbc:timesten:dsn=demo";

Connection con = null; 
try { 
     Class.forName("com.timesten.jdbc.TimesTenDriver"); 
} catch (ClassNotFoundException ex) { 
       // See "Handling Errors"  
} 
try { 
     // Open a connection to TimesTen 
     con = DriverManager.getConnection(URL); 
     // Report any SQLWarnings on the connection 
     // See "Reporting errors and warnings"  
     // Do SQL operations 
     // See "Managing TimesTen Data"  
// Close the connection to TimesTen 
con.close(); 
// Handle any errors  
} catch (SQLException ex) { 
     // See "Handling Errors"  
}