>1 connection per user using Tomcat?

Hi all, I've created a connection pool on Tomcat 5 and during testing realised that I couldn't run more than 1 query to my web app i.e. I opened up multiple windows and ran each query at the same time. Is there any way (out of interest) of setting up the connection pool so that a user can be assigned more than 1 connection if they so wish?

Thanks

[363 byte] By [dhaval_shaha] at [2007-11-27 9:38:27]
# 1

Usually a connection is retrieved from a pool when a transaction is performed.

This means that one connection is associated with one transaction not a user:

1) user logins

2) Get Connection

3) carry out a transaction

4) return connection to pool

5) Get Connection

6) carry out a transaction

7) return connection to pool

8) user logs out

You seem to be giving each user a connection which will lead to the issues you are having:

1) user logins

2) get connection

3) carries out a transaction

4) carries out another transaction

5) user logs out

6) return connection to pool

ChristopherAngela at 2007-7-12 23:11:50 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

I probably should clarify - what I'm attempting to do is to assign 1 connection per transaction. When the web app runs its query to completion it returns the connection to the pool. It's when I run >1 transaction that the server keels over and throws an exception, hence why I was wondering if being able to assign >1 connection per user is possible.

dhaval_shaha at 2007-7-12 23:11:50 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
There is no automatic relationship between user and query.Without seeing code I'm not sure what the issue is. You should be able to run more than one query per user.Your issue is either one of contention: database/java or an implementation issue.
ChristopherAngela at 2007-7-12 23:11:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
Realised my app shares global variables and hence it isn't thread safe. Will amend, thanks anyway
dhaval_shaha at 2007-7-12 23:11:51 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...