I am converting a CMP bean to a BMP. I am using Sybase as the database, and the
CMP version works fine.

I must have a configuration error however, since my BMP code gives me the
following exception when I try to execute a query:

TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
        javax.ejb.EJBException
java.sql.SQLException: Table not found: COUNTY in statement [insert into county
(COUNTY_NBR, COUNTY_NME, COUNTY_ABREV3_CD, COUNTY_ABREV4_CD) values (1,'North
Pole','NPL','NOPL')]
        at org.hsql.Trace.getError(Trace.java:124)
        at org.hsql.Result.<init>(Result.java:70)
        at org.hsql.jdbcConnection.executeHSQL(jdbcConnection.java:644)
        at org.hsql.jdbcConnection.execute(jdbcConnection.java:540)
        at org.hsql.jdbcStatement.fetchResult(jdbcStatement.java:499)
        at org.hsql.jdbcStatement.executeUpdate(jdbcStatement.java:52)
        at
org.hsql.jdbcPreparedStatement.executeUpdate(jdbcPreparedStatement.java:114)
        at
org.jboss.minerva.jdbc.PreparedStatementInPool.executeUpdate(PreparedStatementIn
Pool.java:81)
        at
us.oh.state.dot.common.ejb.reference.ejb.bean.CountyBeanBMP.ejbCreate(CountyBean
BMP.java:51)

Borland AppServer does a very nice job of declaring datasources. jBoss appears
to me to require a couple additional files to achieve what BAS accomplishes with
the single ejb-inprise.xml descriptor. Here are the settings in the relevant
jBoss files:

jboss.conf
========
<MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar"
CODEBASE="../lib/ext/">
    <ARG TYPE="java.lang.String" VALUE="SybaseDB">
    <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl">
</MLET>

jboss.jcml
=======
     <mbean name="DefaultDomain:service=XADataSource,name=SybasePool">
       <attribute name="URL">jdbc:sybase:Tds:SOCDB004:25000/testdb</attribute>
       <attribute name="JDBCUser">user</attribute>
       <attribute name="Password">pass</attribute>
     </mbean>

jboss.xml
=======
    ....
    <entity>
      <ejb-name>CountyBeanBMP</ejb-name>
      <jndi-name>odotref/county_bmp</jndi-name>
      <resource-ref>
        <res-ref-name>jdbc/odotref_link</res-ref-name>
        <resource-name>jdbc/odotref_datasource</resource-name>
      </resource-ref>
    </entity>
    ....
  <resource-managers>
    <resource-manager>
      <res-name>jdbc/odotref_datasource</res-name>
      <res-jndi-name>SybasePool</res-jndi-name>
    </resource-manager>
  </resource-managers>
    ....

MyBean
=======
I look up the database connection using:
    Context ctx = (Context) new InitialContext();
    DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/odotref_link");
    Connection conn = ds.getConnection();

The exception occurs when I execute a query using this connection. Also, the
DatabaseMetaData for the connection does not seem to be knowledgable of any of
the database information.

thanks,
jim



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

Reply via email to