Note sure why you don't like the answers you found in the archives, but here
is the same answer again.  This example uses Oracle - substitute your DBMS
of choice.

Given a reference like this in your code:

         Connection connection = ((DataSource)new
InitialContext().lookup("java:comp/env/jdbc/OracleDB")).getConnection();

Here are the entries in ejb-jar.xml:

   <resource-ref>
            <description>A jdbc connection for the DbTester
bean</description>
            <res-ref-name>jdbc/OracleDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
   </resource-ref>

and here are the entries in jboss.xml:

  <resource-managers>
    <resource-manager>
      <res-jndi-name>java:/OracleDB</res-jndi-name>
      <res-name>jdbc/OracleDB</res-name>
    </resource-manager>
  </resource-managers>

And here is the entry in jboss.jcml:

  <mbean code="org.jboss.jdbc.XADataSourceLoader"
name="DefaultDomain:service=XADataSource,name=OracleDB">
    <attribute name="PoolName">OracleDB</attribute>
    <attribute
name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImp
l</attribute>
    <attribute
name="URL">jdbc:oracle:thin:@localhost:1521:homedb</attribute>
    <attribute name="LoggingEnabled">true</attribute>
    <attribute name="JDBCUser">xxxx</attribute>
    <attribute name="Password">yyyy</attribute>
  </mbean>

Also in jboss.jcml, add the oracle driver to the list of JDBC drivers:
oracle.jdbc.driver.OracleDriver

----- Original Message -----
From: "Jim Clayson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 18, 2001 6:19 AM
Subject: [JBoss-user] simple config for 2 session beans to postgres db,
please (tc3.2.2+jb2.2.2)


> Hi,
>
> Forgive me if this topic has been covered somewhere before (or to death)
> but I haven't been able to find any pertinent past postings and there's
> a lot of conficting info in the archives - mainly due to version
> differences.
>
> I have Tomcat 3.2.2 + JBoss 2.2.2 (as one), JDK1.3 and posgresql db v7.x
> on Suse 7.1
>
> All I'm tring to do is to setup two stateless session beans which are
> able to do the basics of db access via the jdbc driver(i.e. read, write
> and delete). I don't think I'm even going to bother giving any details
> of how far I have gone in recent days because I think I'm starting to
> get confused by some of the past postings and I would rather start from
> scratch with the simplest of setups. All I can say is my bean code does
> deploy (although at the moment, I'm having to restart the server to do
> this - the autodeploy is not working for some reason) and can be
> contacted by my servlet client-code.
>
>
> I ran the test client(straight out the online manual) successfully
> against the test bean but there was no db interaction there. If some
> kind soul could give me a brief sketch of the configuration of the
> simplest of stateless session beans running against a db, I'd be mighty
> grateful.
>
> Cheers
> Jim Clayson
> 
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
>


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to