]> git.8kb.co.uk Git - pgpool-ii/pgpool-ii_2.2.5/blob - test/jdbc/InsertTest.java
Attempt to send a proper failure message to frontend when authentication
[pgpool-ii/pgpool-ii_2.2.5] / test / jdbc / InsertTest.java
1 import java.sql.*;
2
3 public class InsertTest extends PgpoolTest {
4     public void do_test() throws SQLException {
5         int N = 100;
6
7         try {
8             ResultSet rs;
9             PreparedStatement pstmt = null;
10             Statement stmt = null;
11
12             for (int i = 0; i < N; i++) {
13                 connection.setAutoCommit(false);
14                 pstmt = connection.prepareStatement("INSERT INTO ins VALUES (?)");
15                 pstmt.setInt(1, i);
16                 pstmt.executeUpdate();
17                 pstmt.close();
18                 connection.commit();
19             }
20             connection.setAutoCommit(true);
21             stmt = connection.createStatement();
22             rs = stmt.executeQuery("SELECT count(a) FROM ins" );
23             rs.next();
24             logwriter.println(rs.getInt(1));
25         }
26         finally {
27             connection.close();
28         }
29     }
30
31     public String getTestName() {
32         return "insert";
33     }
34 }