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]