Are you using a "jboss.xml" files for your beans?  I suspect the
problem is that your DB resource is getting bound to the default pool
instead of the pool you want.  If you create a jboss.xml file, you can
create a resource manager and link the ejb-jar.xml resource to the
resource manager, and the resource manager to the pool you created.
        There are examples in the Minerva documentation that give the
necessary chunks of jboss.xml.  Also, you could try removing all the other
pools so that your pool becomes the default pool...  That will save you
some work, but only works if you have exactly 1 pool.

Aaron

On Mon, 25 Sep 2000, Jon Barnett wrote:
> I'm fairly new with using jBoss so this may have been answered before.  I
> wasn't able to find any similar questions in the mailing list database so
> I'm hoping someone has solved this problem in the past.
> 
> I've set up a pool by configuring:
> 1) jboss.conf (see MLET tag-pair)
> <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
> CODEBASE="../lib/ext">
>         <ARG TYPE="java.lang.String" VALUE="PostgreSQLPool">
>       <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl">
> </MLET>
> 2) jboss.jcml
>      <mbean name="DefaultDomain:service=XADataSource,name=PostgreSQLPool">
>        <attribute
> name="URL">jdbc:postgresql://172.16.1.1/investment</attribute>
>        <attribute name="Password">pgres</attribute>
>        <attribute name="JDBCUser">pgres</attribute>
>      </mbean>
> 3) jboss.properties
> jdbc.drivers=org.hsql.jdbcDriver,jdbc.idbDriver,org.postgresql.Driver
> 
> The postgres driver is in the lib\ext directory and jBoss (jBoss BETA PROD
> 01) starts without a problem and without errors.  The console log indicates
> the XA pool is created for postgres.
> 
> However, when my bean tries to use a connection from the pool, the exception
> trap indicates that the table "Company" does not exist - which seems to
> indicate to me that I didn't connect to the database "investment", although
> I didn't get any other errors with connecting.
> 
> "Failed: java.sql.SQLException: Table not found: COMPANY in statement [
> Select * from company ]"
> 
> The portion of Bean code is:
>         String poolName = "PostgreSQLPool";
>         try
>         {
>             Context naming = new InitialContext();
>             DataSource dataSource =
> (DataSource)naming.lookup("java:comp/env/"+poolName);
>             Connection dbConnection = dataSource.getConnection();
>             Statement dbStatement = dbConnection.createStatement();
>             ResultSet queryResult = dbStatement.executeQuery("Select * from
> company");
>             queryResult.close();
>             dbStatement.close();
>             dbConnection.close();
>             System.out.println("Got through without error.");
>         }
>         catch(Exception e)
>         {
>             System.out.println("Failed: " + e.toString());
>         }
> 
> I used EJX to configure the ejb-jar.xml file.
> <?xml version="1.0" encoding="Cp1252"?>
> 
> <ejb-jar>
>      <description>Connexion example</description>
>      <display-name>Connex</display-name>
>      <enterprise-beans>
>        <session>
>        <ejb-name>Connex</ejb-name>
>        <home>ConnexHome</home>
>        <remote>Connex</remote>
>        <ejb-class>ConnexBean</ejb-class>
>        <session-type>Stateful</session-type>
>        <transaction-type>Bean</transaction-type>
>        <resource-ref>
>          <res-ref-name>PostgreSQLPool</res-ref-name>
>          <res-type>javax.sql.DataSource</res-type>
>          <res-auth>Application</res-auth>
>        </resource-ref>
>        </session>
>      </enterprise-beans>
>    </ejb-jar>
> 
> A simple java program can access the database table, so I must have left
> something out or got something wrong with my configuration of jBoss.  At
> this stage, any help would be appreciated.
> 
> Thanks,
> 
> Jon.
> 
> 
> 
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Problems?:           [EMAIL PROTECTED]
> 



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to