Connection Pooling?
fordc03
Posts: 49 Bronze 2
Is it possible to pass an object to the Register Method for a connection that is already open to a Database?
For example:
SqlConnection sqlconn = new SqlConnection();
sqlconn.ConnectionString("DATA SOURCE=<server>;DATABASE=<dbname>;INTEGRATED SECURITY=SSPI;");
....Do Some Stuff to the Database....
db1.Register(ConnectionObject)
I would like to use connection pooling and not open any more connections than I have to.
The end result is this...Connect to a server that has 1,000 databases, make snapshots of them all.
I'm running into performance issues with opening many connections to the server (creating 40 threads and attaching to 40 databases to do a snapshot) My problem is that it's creating a brand new connection every time...I want to re-use my connection by connecting to the Master database on the server, then switching to the next database in my array therefore using connection pooling because my connection is already open and in use.
Let me know if I make sense.
Thanks,
For example:
SqlConnection sqlconn = new SqlConnection();
sqlconn.ConnectionString("DATA SOURCE=<server>;DATABASE=<dbname>;INTEGRATED SECURITY=SSPI;");
....Do Some Stuff to the Database....
db1.Register(ConnectionObject)
I would like to use connection pooling and not open any more connections than I have to.
The end result is this...Connect to a server that has 1,000 databases, make snapshots of them all.
I'm running into performance issues with opening many connections to the server (creating 40 threads and attaching to 40 databases to do a snapshot) My problem is that it's creating a brand new connection every time...I want to re-use my connection by connecting to the Master database on the server, then switching to the next database in my array therefore using connection pooling because my connection is already open and in use.
Let me know if I make sense.
Thanks,
Comments
I am sorry to say that with the current API this is not possible.
However here is an idea that you could possibly make work for yourself. However this idea is not supported and probably will not be possible in future releases. (ConectionProperties may become a sealed class.)
The basis is taken from the code snippits.
From here you could modify the connection string further.
Note I have not supported non integrated security in this code. I have verified that this will work with SQL Bundle 5.1, but no further.
I hope that helps...