| Author |
MSSQL Database configuration with JBOSS-3.0.4
|
ketan modi
Greenhorn
Joined: Aug 13, 2003
Posts: 2
|
|
I am new to EJB and JBOSS. I am getting problem in configuration in MSSQL Database with JBOSS-3.0.4.I have to use it for BMP Bean. I have done following steps for configuration. 1. delete the hsql*-service.xml file in the C:\jboss\jboss-3.0.4\server\default\deploy directory. 2. copy the mssql-service.xml file from the C:\jboss\jboss-3.0.4\docs\examples\jca directory into C:\jboss\jboss-3.0.4\server\default\deploy 3. change the C:\jboss\jboss-3.0.4\server\default\config a) standardjaws.xml <jaws> <datasource>java:/MSSQLDS</datasource> <type-mapping>MS SQLSERVER2000</type-mapping> <debug>false</debug> 4. in the mssql-service.xml following changes: <attribute name="ManagedConnectionFactoryProperties"> <properties> <config-property name="ConnectionURL" type="java.lang.String">jdbc:microsoft:sqlserver://68.165.1.253:1450;DatabaseName=CABIN</config-property> <config-property name="DriverClass" type="java.lang.String">com.microsoft.jdbc.sqlserver.SQLServerDriver</config-property> <!--set these only if you want only default logins, not through JAAS--> <config-property name="UserName" type="java.lang.String">sa</config-property> <config-property name="Password" type="java.lang.String"></config-property> </properties> </attribute> ...... and also <depends optional-attribute-name="ManagedConnectionPool"> <!--embedded mbean--> <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=XaTxPool,name=MSSQLDS"> 5. in the C:\jboss\jboss-3.0.4\server\default\config dir change the login-config.xml file <application-policy name = "MSSQLDbRealm"> <authentication> <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name = "principal">sa</module-option> <module-option name = "userName">sa</module-option> <module-option name = "password"></module-option> <module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=MSSQLDS</module-option> </login-module> </authentication> </application-policy> and my jboss.xml is <?xml version="1.0" encoding="UTF-8"?> <jboss> <enterprise-beans> <entity> <ejb-name>BMPSportsBean</ejb-name> <jndi-name>BMPSportsBean</jndi-name> <resource-ref> <res-ref-name>jdbc/MSSQLDS</res-ref-name> <resource-name>java:/MSSQLDS</resource-name> </resource-ref> </entity> </enterprise-beans> </jboss> and ejb-jar.xml file is <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <enterprise-beans> <entity> <display-name>BMPSportsBean</display-name> <ejb-name>BMPSportsBean</ejb-name> <home>entity.bmpsportsapp.ejbs.sportBean.bmp.SportTeamHome</home> <remote>entity.bmpsportsapp.ejbs.sportBean.bmp.SportTeam</remote> <ejb-class>entity.bmpsportsapp.ejbs.sportBean.bmp.SportTeamEJB</ejb-class> <prim-key-class>entity.bmpsportsapp.ejbs.sportBean.bmp.SportTeamPK</prim-key-class> <reentrant>False</reentrant> <persistence-type>Bean</persistence-type> <resource-ref> <res-ref-name>jdbc/MSSQLDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> </entity> </enterprise-beans> <assembly-descriptor> </assembly-descriptor> </ejb-jar> and in entity bean i have used following code to access database. DataSource dataSource = (DataSource)initial.lookup("java:comp/env/jdbc/MSSQLDS"); but after that when i am deploying application it gives warning that : No resouce Manager found for java:/MSSQLDS and when i am runing my application it gives me jdbc not bound error. pls help me asap.
|
 |
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
|
|
|
Moving to the JBoss Forum...
|
 |
ketan modi
Greenhorn
Joined: Aug 13, 2003
Posts: 2
|
|
At last i have solve my problem. i have changed code in jboss.xml as below. replace <resource-name>java:/MSSQLDS</resource-name> by <jndi-name>java:/MSSQLDS</jndi-name> and now it is working ok.
|
 |
 |
|
|
subject: MSSQL Database configuration with JBOSS-3.0.4
|
|
|