I'm using a connection pool (100 connections).
Connection conn = getJdbcTemplate().getDataSource().getConnection();
conn.commit(); // this will clear out the global view data
conn.close(); // appears not to return to the pool if i don't close the connection
Is the code above will ever return the same connection?
what i mean is..if i have 101 thread trying to get a connection, will two thread have the have connection?
or will the last thread wait until the connection is available?
What i notice is that it appears that the connection JdbcTemplate returns sometime may be of the same connection (even if the pool have noot reach the max)
I have a Global temp View on the (Oracle) database. invoking a store procedure will populate the view will results; however, all this must be done within the same datase session (connection).
So, if two users make a call for this store procedure in two different connection. than they will both see two different set of result.
however, if two users using the same db connection, the will be both results.
to clear thing out..the connection must be commit or rollback.
i was looking on the web and came across this
DataSource ds = jdbcTemplate.getDataSource();
Connection con = DataSourceUtils.getConnection(ds);
DataSourceUtils.releaseConnection(con, ds); // suppose to return the connection back to the pool
Well..to make thing short; how do i get a connection from the connection pool (through JdbcTemplate)
and make sure that that connection is not given out to other thread until the current thread is done with its work?