prepareCall creating database connections
- From: junk@xxxxxxxxxxxxxxxxxx
- Date: 10 Jul 2006 05:57:17 -0700
Hi,
I am calling a stored procedure on MS SQL Server using the MS JDBC
drivers with code like this
CallableStatement cs = dbConnection.prepareCall("{call sp_myproc(?)}");
cs.setString(1, value);
cs.execute();
I noticed that my process was establishing a lot of connections to the
database and after some investigation realised that each call to
prepareCall() was creating it's own database connection. I added a call
to cs.close() at the end of the method which solved the imediate
problem.
My concern now is that every time I call prepareCall it is establishing
it's own database connection which must be slowing my process down. Is
there a way of just using the existing connection for the call?
Thanks
Andy
.
- Follow-Ups:
- Re: prepareCall creating database connections
- From: AndyColeman
- Re: prepareCall creating database connections
- Prev by Date: Re: Are there any databases that can store multidiimensional boolean arrays?
- Next by Date: Re: prepareCall creating database connections
- Previous by thread: Apache Derby and Eclipse 3.2
- Next by thread: Re: prepareCall creating database connections
- Index(es):