Unfortunately just using datasource.getConnection("user","password") hoping to get connections for the specified user will only lead to a serious problem. So long as there is a connection in the pool, this method will just return the already existing connection, which may very well belong to another user. This is very dangerous because a public user may inherit the database permissions of a manager, or vice versa.
The connection pool must specifically support pooling for multiple users, like the "org.apache.commons.dbcp.datasources.PerUserPoolPoolDataSource" does. So, if the built in pooling in Glassfish does not support per user, there would need to be a way to configure a pool based on a custom pooling implementation, and then the question becomes how to do that in Glassfish.
[Message sent by forum member 'hanafey' (hanafey)]
http://forums.java.net/jive/thread.jspa?messageID=232032