Thanks Kris, by following your excellent instructions it was easy to make it
work. The only thing i had to change was to remove the first <mbean> tag for
jboss.jcml, but other than that everything went smooth.
Best regards,
Per
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Kris Kristensen
Sent: Wednesday, January 03, 2001 6:21 PM
To: jBoss
Subject: Sv: [jBoss-User] MS Access 97 and stateless session beans
Hi Per
sure, steps are as follows:
jboss.jcml:
Create a mbean instance like the following. Name the DB-pool whatever you
like, here I've used NewsPool. Default for login and password for Access 97
with ODBC is empty
<mbean>
<mbean name="DefaultDomain:service=XADataSource,name=NewsPool">
<attribute name="URL">jdbc:odbc:hund</attribute>
<attribute name="JDBCUser" />
<attribute name="Password" />
</mbean>
jboss.conf:
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
CODEBASE="../../lib/ext/">
<ARG TYPE="java.lang.String" VALUE="NewsPool">
<ARG TYPE="java.lang.String"
VALUE="org.jboss.minerva.xa.XADataSourceImpl">
</MLET>
Remember to copy the rt.jar to <JBOSS>\lib\ext directory. You should find
rt.jar under <JRE 1.3>\lib
jboss.properites:
jdbc.drivers=sun.jdbc.odbc.JdbcOdbcDriver,org.hsql.jdbcDriver,org.enhydra.in
stantdb.jdbc.idbDriver
ejb-jar.xml:
......
<resource-ref>
<description>A link to newsDB</description>
<res-ref-name>jdbc/newsDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
....
jboss.xml:
....
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>jdbc/newsDB</res-name>
<res-jndi-name>NewsPool</res-jndi-name>
</resource-manager>
</resource-managers>
...
from my java code, calling the pool via JNDI:
....
Context initial = new InitialContext();
ds = (DataSource)initial.lookup("java:comp/env/jdbc/newsDB");
return ds.getConnection();
.....
A little explaining:
jdbc:odbc:hund is the URL to my Access database. Make the ODBC like this:
control Panel->ODBC DataSources:
under user-dsn->add
thoose Microsoft Access Driver (*.mdb)->apply
name your datasource name (here I've used hund)
click choose and point it to your *.mdb file
apply
...
The JdbcOdbcDriver will now read your URL like jdbc:odbc:<your datasource
name>
Next step is to make a connection to the DB-pool via JNDI:
any connection to jdbc is created using the namespace: jdbc/<your choice>,
seeing it from the ejb-jar.xml point of view it should therefore read like
above. From your code it's a little different. In order to get a reference
to the JNDI you use the following syntax: java:comp/env/jdbc/<your choice>.
As you can see from my snippets I've used NewsDB as <your choice>
The only thing missing now is telling Jboss to connect to the DB-pool
whenever it gets a call to jdbc/<your choice>. This mapping is done in
jbos.xml.
That's it.
Hope it helps, otherwise let me know and I'll see what I can do to help.
Please be aware that this solution only works with Session beans. If you
need entity beans instead, you'll need to set up the jaws.xml file among
other. I can't help you here, I haven't tried it out yet.
Cheers
Kris Kristensen
[EMAIL PROTECTED]
-----Oprindelig meddelelse-----
Fra: Per Nyfelt <[EMAIL PROTECTED]>
Til: jBoss <[EMAIL PROTECTED]>
Dato: 3. januar 2001 12:51
Emne: RE: [jBoss-User] MS Access 97 and stateless session beans
Hi Kris,
Any chance you could list the steps you had to go through to make it work
and post it here? I often start out with Access in the early phase of a
project when the data model is constantly changing before switching to MySQL
but suffer from not having to get Access to work with either JBoss or J2EE
ref. impl so I end up playing crazy games to get around that. I think there
are more people out there who would benefit greatly from a JBoss - Access
mini-howto -maybe your experience could serve as a start of a such...
Best regards,
Per
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Kris Kristensen
Sent: Wednesday, January 03, 2001 1:20 AM
To: Jboss-support
Subject: [jBoss-User] MS Access 97 and stateless session beans
Hi there!
I've managed to set up a connection pool for MS access 97 (JDBC-ODBC)
and using stateless session beans to connect to this pool and it actually
works! So If there are anybody out there trying to do the same without
success, I'm willing to help you with snippets from my configuration.
Cheers
Kris Kristensen
[EMAIL PROTECTED]
ps. Couldn't have done it without help from Jay Walters and Michel de
Groot, so thank's a lot for your help.
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
List Help?: [EMAIL PROTECTED]