-
1. Re: Programmatic API for settting up connection pools
davidjencks May 7, 2002 2:14 PM (in response to jerrythomas)You can create the appropriate mbeans, set their attributes, and start them. For JBoss 3 rc2, look at the testsuite jmx/test/DeployConnectionManagerUnitTestCase.java for an example. This example does not yet include setting up the security realm with the JaasSecurityManagerService (I think this is the one) -- Scott indicated that this was now possible, but I haven't had a chance to try it. A patch would be welcome;-)
-
2. Re: Programmatic API for settting up connection pools
jerrythomas May 8, 2002 11:51 AM (in response to jerrythomas)Thanks for taking the time to post that response. I've attached the file you mentioned should anyone else be interested.
At a high level I can see how you are setting attributes to create a Datasource and a connection pool on the JBoss server in the first part of the test (this would functionally be similar to adding lines to the JBoss configuration files), you then call invoke the "servicecontroller" to create pools and the datasource. Some areas confused me though.
- what is "jboss.jca:service=LocalTxCM,name=TestDS" MBean for? And since, you commented out the calls to start this MBean, should I ignore this?
- and this code block confused me, why are JDBC driver settings, user, password being set on the JDBC datasource vs. the connection pool?
//Now set the important attributes:
invoke(mcfName, "setManagedConnectionFactoryAttribute",
new Object[] {"ConnectionURL", java.lang.String.class, "jdbc:hsqldb:hsql://localhost:1476"},
new String[] {"java.lang.String", "java.lang.Class", "java.lang.Object"});
invoke(mcfName, "setManagedConnectionFactoryAttribute",
new Object[] {"DriverClass", java.lang.String.class, "org.hsqldb.jdbcDriver"},
new String[] {"java.lang.String", "java.lang.Class", "java.lang.Object"});
invoke(mcfName, "setManagedConnectionFactoryAttribute",
new Object[] {"UserName", java.lang.String.class, "sa"},
new String[] {"java.lang.String", "java.lang.Class", "java.lang.Object"});
invoke(mcfName, "setManagedConnectionFactoryAttribute",
new Object[] {"Password", java.lang.String.class, ""},
new String[] {"java.lang.String", "java.lang.Class", "java.lang.Object"});
If I were adding a connection pool in a JBoss config file, it would look like this:
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
CS007
jdbc:weblogic:mssqlserver4:CS007@localhost:1433
user=cs006;password=xxx
Should I add settings for "PoolName", "URL" and "Properties" using an AttributeList or use the
"setManagedConnectionFactoryAttribute" Datasource operation that you use?
Thanks, Jerry -
3. Re: Programmatic API for settting up connection pools
jerrythomas May 8, 2002 11:52 AM (in response to jerrythomas)Here is the file.
-
4. Re: Programmatic API for settting up connection pools
davidjencks May 8, 2002 4:47 PM (in response to jerrythomas)The test case is for JBoss 3, and uses different mbeans from 2.x.x. The idea of creating the mbean programatically and setting its values through the mbean server is about all that will be the same between the versions.