There is no such capability build into EJB, nor is there an option in JBoss AS to support
this. I would be interested to hear what your use case is (that is, why you think you need
a separate database per user).
I can think of two ways to implement this.
a) Using JDBC: write your own JDBC layer (you will probably have to implement only the
Driver interface, but perhaps also the Connection interface) that sits between JBoss AS
and the real JDBC driver. When a connection is made, have your code look up the user for
that connection and use a database call (such as 'use somedb' in MySQL) to switch
the database. [There have been other posts in the forums where people wanted the
connection to use the user's account name as the database login id, and if I recall
correctly someone posted that the Oracle JDBC driver had some kind of option to enable
this. You could search for those posts, they might give you some other clues as to what is
possible.]
b) Use one database for everyone and add a userId field to each of the tables. Then change
all of the queries to add "and userId=xxx" to the where clause. This way each
user should see only his or her data.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4231944#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...