TDV JDBCドライバーは、Statementに加え、PreparedStatementもサポートしています。
Connection conn = DriverManager.getConnection(COMPOSITE_URL, COMPOSITE_USER, COMPOSITE_PASSWORD);
PreparedStatement stmt = conn.prepareStatement("SELECT * FROM ViewOrder WHERE ProductID = ?");
for (int i = 1; i <= 5 ; i++) {
stmt.setInt(1, i);
ResultSet rs = stmt.executeQuery();
System.out.println("Row " + i);
printResultSet(rs);
rs.close();
}
stmt.close();
conn.close();
Statement、PreparedStatementのより詳細な使用例につきましては、以下製品ガイドを参照ください。
JDBC経由でのデータへのアクセスの例 (tibco.com)
また、prepareStatement()にはシグニチャの異なる複数の定義がありますが、以下の定義はサポートされておりません。
PreparedStatement prepareStatement(String sql、int autoGeneratedKeys)
PreparedStatement prepareStatement(String sql、int[] columnIndexes)
PreparedStatement prepareStatement(String sql、String[] columnNames)
サポートされないメソッドを使用すると、以下のようなSQLExceptionがスローされます。
java.sql.SQLException: The operation 'PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)' is not supported. If you dont want to get an Exception, you can use &unsupportedMode=silent in the JDBC URL.[jdbc-1947005]
TDV JDBCドライバには、その他にもサポートしないメソッドがあります。
詳細につきましては、以下製品ガイドをご参照ください。
サポートされていないJDBCメソッド (tibco.com)