Given - GlassFish 4.1.0 with the following parameters to connect to the Oracle database as with the attached file.
There is a code where I get a connection and work with it:
@Resource(lookup="jdbc/__somedb") private javax.sql.DataSource dsDB;
Connection conn = null; try { conn = dsDB.getConnection(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
turn off autocommit mode mConn.setAutoCommit (false);
here I do all kinds of inserts and updates
close the connection
try { if (conn != null){ conn.close(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
Actually the question is, initially I forgot that my autocommit is turned off, and accordingly all my inserts and updates, when I performed the servlet, I could not see in the database. Then when I put the line in the code:
try { mConn.commit(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); }
To me besides the current insert / update, all my actions made without a commit came. In principle, everything is logical as the application server keeps the ready connections to the database, and simply pushes the same connection to my servlet.
Do I understand correctly that when simultaneously accessed with the current settings of glassfish, he can give me 8 connections to the database, and 9 you will have to wait until 9 for the treatment to clear some of the previous connections?