]> git.8kb.co.uk Git - pgpool-ii/pgpool-ii_2.2.5/blob - test/jdbc/AutoCommitTest.java
Attempt to send a proper failure message to frontend when authentication
[pgpool-ii/pgpool-ii_2.2.5] / test / jdbc / AutoCommitTest.java
1 import java.util.*;
2 import java.io.*;
3 import java.sql.*;
4
5 public class AutoCommitTest extends PgpoolTest{
6     public String sql = "select * from autocommit where a = ?";
7
8     public static void main(String[] args) throws SQLException {
9         AutoCommitTest test = new AutoCommitTest();
10         test.do_test();
11     }
12
13     public void do_test() throws SQLException
14     {
15         connection.setAutoCommit(true);
16         
17         PreparedStatement stmt = null;
18         ResultSet rs = null;
19         
20         try {
21             for(int i = 0; i < 10; i++) {
22                 stmt = connection.prepareStatement(sql);
23                 try {
24                     stmt.setInt(1, i + 1);
25                     rs = stmt.executeQuery();
26                     
27                     while(rs.next()){
28                         logwriter.print(rs.getInt(1) + " ");
29                     }
30                     logwriter.println();
31                 } finally {
32                     if(rs != null) rs.close();
33                     if(stmt != null) stmt.close();
34                 }
35             }
36         } finally {
37             connection.close();
38             logwriter.close();
39         }       
40     }
41
42     public String getTestName() {
43         return "autocommit";
44     }
45 }