Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- psycopg2.connect(...).cursor().execute("select * from account where id='00100000006ONCrAAO'")
- 2011-07-18 18:56:08 PDT LOG: duration: 6.112 ms statement: select * from account where id='00100000006ONCrAAO'
- conn.createStatement().executeQuery("select * from account where id = '00100000006ONCrAAO'");
- 2011-07-18 18:44:59 PDT LOG: duration: 4.353 ms parse <unnamed>: select * from account where id = '00100000006ONCrAAO'
- 2011-07-18 18:44:59 PDT LOG: duration: 0.230 ms bind <unnamed>: select * from account where id = '00100000006ONCrAAO'
- 2011-07-18 18:44:59 PDT LOG: duration: 0.246 ms execute <unnamed>: select * from account where id = '00100000006ONCrAAO'
- private PreparedStatement preparedStatement;
- public ResultSet getAccount(String id) throws SQLException {
- // Do this once
- if (preparedStatement == null)
- preparedStatement = conn.prepareStatement("select * from account where id = ?");
- // Do this many times
- preparedStatement.setString(1, id);
- return preparedStatement.executeQuery();
- }
- public static void main(String[] args) throws Exception {
- ResultSet rs = new MyClass().getAccount("00100000006ONCrAAO");
- }
- prepareThreshold=0
- jdbc:postgresql://db.address/dbName?prepareThreshold=0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement