-
1. Re: how creat a datasource per server instance?
wdfink Oct 30, 2012 11:09 AM (in response to liuliu)You might use expressions for that, replace connect string and user/passwd by "${database.xyz}" and set it as system property for each server.
This should work, I'm not sure but there was an issue that not every attribute can use it so you might build based on tag 7.1.3.
-
2. Re: how creat a datasource per server instance?
liuliu Oct 30, 2012 11:59 AM (in response to wdfink)thanks for your reply,
Do you mean i do something like:
String dbJndi = System.getProperty('dbJndiStr");
Connection conn = initContext.lookup(dbJndi);
does this solution work for resource injection too?
-
3. Re: how creat a datasource per server instance?
wdfink Oct 30, 2012 12:47 PM (in response to liuliu)No, I meant something in the configuration (domain.xml):
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>${datasource.url}</connection-url>
.....
(host.xml):
<server name="one"! ...>
<system-properties>
<property name="datasource.url" value="mydatasourceURL"/>
.....
-
4. Re: how creat a datasource per server instance?
liuliu Oct 31, 2012 4:17 AM (in response to wdfink)Interesting. I did not know it could work like that. in this case, the jndi for data source is the same, but it link to the different database per server instance. do jboss creat a connection pool for every server instance?
-
5. Re: how creat a datasource per server instance?
nickarls Oct 31, 2012 5:36 AM (in response to liuliu)No, that won't be necessary. Since the application references the pool by JNDI it will just point to a different location do to the datasource url.
-
6. Re: how creat a datasource per server instance?
wdfink Oct 31, 2012 8:30 AM (in response to liuliu)Each server instance create its own a pool for the database connections.
i.e. if you have a DS with min-pool-size=10 and 3 server instances each instance will create 10 connections to the database url which is configured via the expression and the server properties.