1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
new TestSqlDedicatedStatement().execute();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void execute() throws Exception {
Connection connection = DriverManager.getConnection(CONNECTION_STR,CONNECTION_LOGIN,CONNECTION_PASSWORD);
PreparedStatement pstmt = connection.prepareStatement(SQL);
pstmt.setString(1, "D476");
pstmt.setString(2, "EUR");
// pstmt.setDate(3, new java.sql.Date(2011-1900, 6-1, 1));
// pstmt.setDate(4, new java.sql.Date(2011-1900, 9-1, 1));
ResultSet rs = pstmt.executeQuery();
System.out.println("Executed");
} |
Partager