Maybe i didn't describe it detailly enough.
To config the datasource, i have modified two files.
One is "standardjbosscmp-jdbc.xml" which is the default one that i havn't change after
installing jboss, i modified the following lines:
<jbosscmp-jdbc>
java:/mySqlDS <datasource-mapping>ejbstudy</datasource-mapping>
....
The other file is "mysql-service.xml". I copy it from conf/.. to deploy directory, and
only modify the following line:
<config-property name="ConnectionURL"
type="java.lang.String">jdbc:mysql://localhost</config-property>
In ejb-jar.xml, i add the following lines:
<resource-ref>
<res-ref-name>mySqlDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
There is a database named ejbstudy, which is exactly has a table "account".
In bean files:
PreparedStatement pstmt = null;
Connection conn = null;
try
{
System.out.println( "ejbHomeGetTotalBankValue()" );
conn = getConnection();
System.out.println(conn.toString());
pstmt = conn.prepareStatement( "select balance from account" );
ResultSet rs = pstmt.executeQuery();
...
when executing , following error occurs:
08:45:46,258 INFO [Server] JBoss (MX MicroKernel) [3.0.7 (CVSTag=JBoss_3_0_7 Da
te=200304081816)] Started in 1m:10s:802ms
08:47:36,507 INFO [STDOUT] New Bank Account Entity Bean Java Object created by
EJB Container.
08:47:36,557 INFO [STDOUT] setEntityContext() called
08:47:36,577 INFO [STDOUT] ejbHomeGetTotalBankValue()
08:47:36,587 INFO [STDOUT] get connection!
08:47:37,007 INFO [STDOUT] [EMAIL PROTECTED]
6ad0
08:47:37,118 ERROR [STDERR] java.sql.SQLException: Table not found: ACCOUNT in s
tatement [select balance from account]
08:47:37,138 ERROR [STDERR] at org.hsqldb.Trace.getError(Trace.java:180)
08:47:37,138 ERROR [STDERR] at org.hsqldb.Result.(Result.java:175)
08:47:37,138 ERROR [STDERR] at org.hsqldb.jdbcConnection.executeHSQL(jdbcCon
nection.java:907)
08:47:37,158 ERROR [STDERR] at org.hsqldb.jdbcConnection.execute(jdbcConnect
ion.java:718)
08:47:37,158 ERROR [STDERR] at org.hsqldb.jdbcStatement.fetchResult(jdbcStat
ement.java:686)
08:47:37,158 ERROR [STDERR] at org.hsqldb.jdbcStatement.executeQuery(jdbcSta
tement.java:68)
08:47:37,168 ERROR [STDERR] at org.hsqldb.jdbcPreparedStatement.executeQuery
(jdbcPreparedStatement.java:133)
08:47:37,168 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedPrepar
edStatement.executeQuery(WrappedPreparedStatement.java:289)
08:47:37,168 ERROR [STDERR] at com.xinli.account.AccountBean.ejbHomeGetTotal
BankValue(AccountBean.java:94)
08:47:37,168 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3822422#3822422
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3822422
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user