Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problems of connecting mySQL to jboss 4.0.3

843859Aug 3 2006 — edited Aug 6 2006
hi friends,
I have the problem of bounding jdbc to jboss.

i just want to create a data source for mySQL in JBOSS 4.0.3 application server and i want to access that datasource from my session bean while deploying it, it gives a warning:

09:47:46,046 INFO [EjbModule] Deploying MusicEJB
09:47:46,078 WARN [StatelessSessionContainer] No resource manager found for jdbc/MusicDB
09:47:46,078 INFO [ProxyFactory] Bound EJB Home 'MusicEJB' to jndi 'MusicEJB'
09:47:46,078 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.0.3SP1/server/defaul
t/tmp/deploy/tmp36512MusicApp.ear-contents/ejb-jar-ic.jar
09:47:46,093 INFO [TomcatDeployer] deploy, ctxPath=/music, warUrl=.../tmp/deplo
y/tmp36512MusicApp.ear-contents/war-ic-exp.war/
09:47:46,187 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.3S
P1/server/default/deploy/MusicApp.ear

When i open up my jsp page it gives this error:

javax.ejb.EJBException: MusicDAOFactory.getDAO: NamingException for <asg.MusicEJ
B.MusicDAOCloudscape> DAO class :
Cannot connect to database: java:comp/env/jdbc/MusicDB:
jdbc not bound
at asg.MusicEJB.MusicBean.ejbCreate(MusicBean.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

My -ds.xml code shown below:
<local-tx-datasource>
    <jndi-name>MusicDB</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/music</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>chongming</user-name>
    <password>kcm82</password>
<metadata>
         <type-mapping>MS SQLSERVER2000</type-mapping>
      </metadata>
  </local-tx-datasource>
My session bean code:

public MusicDAOCloudscape() throws MusicDAOSysException {
		String dbName = "java:comp/env/jdbc/MusicDB";
                  private DataSource datasource = null;
		try {
			//InitialContext ic = new InitialContext();
			//datasource = (DataSource) ic.lookup(dbName);
                        initialContext = new InitialContext();
                        datasource = (DataSource) initialContext.lookup(dbName);
		} catch (NamingException ex) {
			throw new MusicDAOSysException("Cannot connect to database: " +
				dbName + ":\n" + ex.getMessage());
		}
Please give me advice on this because i have been stuck in this part for 2 wks and i really want to know what going on. If the understand of the codes are not enough, i can post more of the codes if you request.

Regards
ChongMing
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 3 2006
Added on Aug 3 2006
5 comments
218 views