[jboss-as7-dev] Anyone write up how to create your own data source on AS 7?

Jason Greene jgreene at redhat.com
Fri Mar 18 22:52:11 EDT 2011


There is also support for the @DataSourceDefinition annotation, which directly uses the jdbc drivers' impl of DataSource. The annotation directly refers to jdbc vender class so it must be visible to the classloading space of the deployment. This can be done using the EE mechanisms (class-path etc) or it can be a jboss module import.

Sent from my iPhone

On Mar 18, 2011, at 12:48 PM, Brian Stansberry <brian.stansberry at redhat.com> wrote:

> On 3/18/11 11:00 AM, Andrig Miller wrote:
>> Has anyone written up how you create your own data source in AS 7 Beta 1?
>> 
> 
> I'm not aware of one, no. JIRA to fix that is [1].
> 
>> I'm trying to bring across my mysql-ds.xml into the configuration, but
>> there are some tags that I don't understand (module stuff),
> 
> The <datasource><module> element is confusing, as it's oddly named for 
> the way it's used in the AS.[2]
> 
> The value should be
> 
> driver-fqcn#<driver-major-version.driver-minor-version
> 
> where driver-fqcn is the name of the class that implements driver.
> 
> There are two ways to make the driver available.
> 
> Simpler is by deploying the driver jar (same as you'd deploy a war, etc).
> 
> More complex is by creating a module for it in the modules/ dir; e.g. 
> $JBOSS_HOME/modules/com/h2database/h2 and then adding a child element 
> under <subsystem xmlns="urn:jboss:domain:datasources:1.0"><drivers>. A 
> jar in the module needs to include a META-INF/services/java.sql.Driver 
> file whose contents are the FQCN of the java.sql.Driver implementation. 
> (The AS loads the driver from the module using java.util.ServiceLoader).
> 
>> and I'm also
>> not sure about the carry over of things like transaction-isolation and
>> connection-property tags.
>> 
> 
> Don't know if [3] will help.
> 
> 
> [1] https://issues.jboss.org/browse/JBAS-9062
> 
> [2] https://issues.jboss.org/browse/JBAS-9061
> 
> [3] 
> http://docs.jboss.org/ironjacamar/userguide/1.0/en-US/html/deployment.html#deployingds_descriptor
> 
> 
> 
> 
> -- 
> Brian Stansberry
> Principal Software Engineer
> JBoss by Red Hat
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev




More information about the jboss-as7-dev mailing list