Hi, I create a connection pool with a generic user. In my web application, I want ti get a connection from the pool with the connected user.
it is possible with myBatis? Regards, Damien You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/eb30b300-c834-4331-b462-6108975ccdcan%40googlegroups.com. |
Can you explain your use case more? A connection pool is created with connections based on the credentials you provide it initially. Different users that need specific authenticated connections normally have their own pool or create their own connection directly. On Jan 28, 2021, at 12:19, Damien Grenier <[hidden email]> wrote: -- You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/9B1ED0EA-5B31-4F6C-A284-C1D22AA99FAF%40gmail.com. |
I use the jt400 library to connect my application the DB2 for i database (IBM i). jt400 has
AS400JDBCConnectionPoolDataSource class with 2 methods :
getPooledConnection() : returns a connection with the user who create the pool
getPooledConnection(java.lang.String user,
java.lang.String password) : returns a connection with this user and password I want to use this getPooledConnection(user,pwd) for know which is connected to the database. Is it possible with myBatis to do this ? Le jeudi 28 janvier 2021 à 18:31:12 UTC+1, h3adache a écrit :
You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/5c762887-5449-4486-8a3e-50c015493022n%40googlegroups.com. |
See PooledDataSource.getConnection(String username, String password).
--
Guy Rouillier On 2/10/2021 9:05:55 AM, "Damien Grenier" <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/emac8795c5-fb24-4625-81f8-124ead25d1a8%40asus. |
In reply to this post by Damien Grenier
I've done this before with a web app and don't recommend it, but you can make your own data source that wraps the jt400 version then use a thread local user to provide that. The workflow is generally: - inspect incoming request and set user in thread local storage - process request - clear user from thread local storage after request is processed In your data source, you replace the getConnection() method with one that looks in the thread local storage for the user object, then calls getConnection(user, pass) and returns that connection. If you use a proxy for the wrapped connection, you can replace just that one method. All that said...unless you have a VERY compelling reason to do this, I do NOT recommend it. It's messy and uses up a lot of resources. If you have a legacy green-screen system that is built on the actual system user, I get that it's convenient, but investigate other options. Larry On Wed, Feb 10, 2021 at 7:06 AM Damien Grenier <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CAFkMvDEvU1qeOyzUq9rrinh_MQQ9_OH3yHdMzCf%2BmG6omKcubg%40mail.gmail.com. |
Free forum by Nabble | Edit this page |