<html><head></head><body bgcolor="#FFFFFF"><div>Right that's correct.<br><br>Sent from my iPhone</div><div><br>On Aug 1, 2012, at 2:19 AM, Flemming Harms &lt;<a href="mailto:flemming.harms@gmail.com">flemming.harms@gmail.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>Jason,<br><br>Just so I'm sure I follow you, what you suggestion is solution like this, right?<br><br>Properties cg = new Properties();<br>cg.put("user", user);<br>cg.put("password", password);<br>Connection conn = driverClass.connect(url, cg);<br>
<br><div class="gmail_quote">2012/7/31 Jason T. Greene <span dir="ltr">&lt;<a href="mailto:jason.greene@redhat.com" target="_blank">jason.greene@redhat.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I can't remember if I replied to this one or not, but a better solution is to use the Driver class directly. We should avoid sticking random things in the global registry which might even end up containing conflicting values.<div class="im">
<br>
<br>
On 7/24/12 7:53 AM, Flemming Harms wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Thanks!<br>
<br>
I had to do one more thing to make it work with the module class loader,<br>
since the database driver was loaded in it's own class loader and it was<br>
not known to the current class loader I had to find a way to make it<br>
available<br>
<br>
I solve it by wrapping the driver in my own class and register the<br>
driver to the DriverManager<br>
<br>
Like this :<br>
&nbsp; DriverManager.registerDriver(<u></u>new DatabaseDriverWrapper(driver))<u></u>;<br>
&nbsp; DriverManager.getConnection(<u></u>url, user, password);<br>
<br></div>
2012/7/23 Tomaž Cerar &lt;<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a> &lt;mailto:<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a>&gt;<u></u>&gt;<div class="im">
<br>
<br>
<br>
<br>
&nbsp; &nbsp; On Mon, Jul 23, 2012 at 5:58 PM, Jason T. Greene<br></div><div><div class="h5">
&nbsp; &nbsp; &lt;<a href="mailto:jason.greene@redhat.com" target="_blank">jason.greene@redhat.com</a> &lt;mailto:<a href="mailto:jason.greene@redhat.com" target="_blank">jason.greene@redhat.<u></u>com</a>&gt;&gt; wrote:<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; On 7/23/12 10:51 AM, Jesper Pedersen wrote:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; On 07/23/2012 11:42 AM, Flemming Harms wrote:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; I found a solution to my problem. Had to update the xsd<br>
&nbsp; &nbsp; &nbsp; &nbsp; schema with an<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; extra attribute "module" and then user need pack his JDBC<br>
&nbsp; &nbsp; &nbsp; &nbsp; driver as module.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; I use the code below to load the model and the driver class.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; Class&lt;?&gt; driverClass =<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; Module.<u></u>loadClassFromCallerModuleLoade<u></u>r(ModuleIdentifier.fromString(<u></u>moduleName),<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; driver);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; driverClass.newInstance();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; &lt;outbound-connections&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;database&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;connection module="com.h2database.h2"<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; driver="org.h2.jdbcx.<u></u>JdbcDataSource" name="db"<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; url="jdbc:h2:/tmp/test;DB_<u></u>CLOSE_DELAY=-1" username="sa"<br>
&nbsp; &nbsp; &nbsp; &nbsp; password=""<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; min-pool-size="10" max-pool-size="20" /&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/database&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; &lt;/outbound-connections&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;&gt; Does it make sense?<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; The -ds.xml functionality uses the module through the<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;driver&gt; tag, so<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; this would be similar.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; Things to watch out for is of course the password attribute -<br>
&nbsp; &nbsp; &nbsp; &nbsp; it should<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&gt; at least support the vault mechanism I would say.<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; If you make the attribute definition have expressions=true, it will<br>
&nbsp; &nbsp; &nbsp; &nbsp; automatically enable vault support.<br>
<br>
&nbsp; &nbsp; given that you use AD.parseAndSetParameter() when parsing and<br>
&nbsp; &nbsp; setting field and &nbsp;AD.resolveModelAttribute() when getting data from<br>
&nbsp; &nbsp; model<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; --<br>
&nbsp; &nbsp; &nbsp; &nbsp; Jason T. Greene<br>
&nbsp; &nbsp; &nbsp; &nbsp; JBoss AS Lead / EAP Platform Architect<br>
&nbsp; &nbsp; &nbsp; &nbsp; JBoss, a division of Red Hat<br>
&nbsp; &nbsp; &nbsp; &nbsp; ______________________________<u></u>_________________<br>
&nbsp; &nbsp; &nbsp; &nbsp; jboss-as7-dev mailing list<br></div></div>
&nbsp; &nbsp; &nbsp; &nbsp; <a href="mailto:jboss-as7-dev@lists.jboss.org" target="_blank">jboss-as7-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:jboss-as7-dev@lists.jboss.org" target="_blank">jboss-as7-dev@lists.<u></u>jboss.org</a>&gt;<div class="im">
<br>
&nbsp; &nbsp; &nbsp; &nbsp; <a href="https://lists.jboss.org/mailman/listinfo/jboss-as7-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/jboss-as7-dev</a><br>
<br>
<br>
<br>
&nbsp; &nbsp; ______________________________<u></u>_________________<br>
&nbsp; &nbsp; jboss-as7-dev mailing list<br></div>
&nbsp; &nbsp; <a href="mailto:jboss-as7-dev@lists.jboss.org" target="_blank">jboss-as7-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:jboss-as7-dev@lists.jboss.org" target="_blank">jboss-as7-dev@lists.<u></u>jboss.org</a>&gt;<div class="im">
<br>
&nbsp; &nbsp; <a href="https://lists.jboss.org/mailman/listinfo/jboss-as7-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/jboss-as7-dev</a><br>
<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
jboss-as7-dev mailing list<br>
<a href="mailto:jboss-as7-dev@lists.jboss.org" target="_blank">jboss-as7-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/jboss-as7-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/jboss-as7-dev</a><br>
<br>
</div></blockquote>
<br><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Jason T. Greene<br>
JBoss AS Lead / EAP Platform Architect<br>
JBoss, a division of Red Hat<br>
</div></div></blockquote></div><br>
</div></blockquote></body></html>