Code example for PreparedStatement

Methods: executeUpdatesetLongsetTimestampclose

0
            "INSERT INTO \"CASH_CURRENCY\" VALUES(135,23)"); 
 
        PreparedStatement ps = conn.prepareStatement("insert into "
            + nameTable + "(T, ID) values (?, ?)");
 
        ps.setTimestamp(1, testTS);
        ps.setLong(2, id);
        ps.executeUpdate();
        ps.close();
 
        ps = null;
 
        conn.commit();
    } 
 
    private void createTestTable(String sql) throws Exception {
 
        Statement ps = conn.createStatement();
 
        ps.execute(sql);
Stop searching for code, let great code find you!  Add Codota to your java IDE