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