Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002708 [Resin] minor always 05-29-08 13:45 06-18-08 15:55
Reporter ferg View Status public  
Assigned To ferg
Priority urgent Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.7 Product Version 3.1.6
  Product Build
Summary 0002708: databases, sqlexceptions, and xa
Description (rep by Takahiro Fukuda)


The following phenomenon is bug?

1. Some SQLs are executed in the same transaction.
2. Each SQL gets and close connection.
3. Even if SQLException occurs, next SQL is executed.
4. The number of max-connections SQLException occurs, next connection
  cannot be got.

I think the connection which occurs SQLException is not closing.

I attach sample program.
Please set max-connections is 20.


Steps To Reproduce     try{
        ((UserTransaction) new InitialContext().lookup("java:comp/UserTransaction")).begin();
        for(int i = 0 ; i < 30 ; ++i) {
            Connection connection = null;
            PreparedStatement statement = null;
// String sql="INSERT INTO b_m_image_icon(image_icon_cd,login_type,user_cd,src,sort_key,record_date) VALUES('account_license_sett','group',null,'images/menu/account_license_setting.jpg',0,'2006/08/11|00:00:00')";
            String sql="select * from b_m_account_bx";
            try {

                System.out.println(i + "################### get connection start ######################");
           // connection = DatabaseManager.getInstance().getLoginGroupConnection("default");
                connection = ((DataSource)new InitialContext().lookup("java:comp/env/jdbc/oracle")).getConnection();
                System.out.println("################### get connection end ######################");

                System.out.println("################### get prepareStatement start ######################");
// statement = connection.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
                statement = connection.prepareStatement(sql);
                System.out.println("################### get prepareStatement end ######################");

                System.out.println("################### get execute start ######################");
                statement.execute();
                System.out.println("################### get execute end ######################");

            } catch (SQLException e) {
                System.out.println(e.getMessage());
            } finally {
                try {
                    if (statement != null) {
                        statement.close();
                        statement = null;
                    }
                    if (connection != null) {
                        connection.close();
                        System.out.println("----------- close " + connection.isClosed() + " -----------");
                        connection = null;
                    }
                } catch (SQLException e1) {
                    e1.printStackTrace();
                }
            }
        }
        ((UserTransaction) new InitialContext().lookup("java:comp/UserTransaction")).commit();
    }catch(Exception e) {
        e.printStackTrace();
    }

Additional Information
Attached Files

- Relationships

- Notes
(0003209)
ferg
06-18-08 15:55

server/14g9
 

- Issue History
Date Modified Username Field Change
05-29-08 13:45 ferg New Issue
06-18-08 15:55 ferg Note Added: 0003209
06-18-08 15:55 ferg Assigned To  => ferg
06-18-08 15:55 ferg Status new => closed
06-18-08 15:55 ferg Resolution open => fixed
06-18-08 15:55 ferg Fixed in Version  => 3.1.7


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker