aspose file tools*
The moose likes JBoss/WildFly and the fly likes 3.2 jbosscmp-jdbc.xml - datasource-mapping tag? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "3.2 jbosscmp-jdbc.xml - datasource-mapping tag?" Watch "3.2 jbosscmp-jdbc.xml - datasource-mapping tag?" New topic
Author

3.2 jbosscmp-jdbc.xml - datasource-mapping tag?

Rick Feenstr
Greenhorn

Joined: Jul 11, 2003
Posts: 6
In JBoss 3.2, jbosscmp-jdbc.xml file, what is the <datasource-mapping> tag refer to? I'm attempting to connect to SQL Server, and can't determine the correct value for this. During deployment of my application JAR, I get the following exception and (partial) stack trace:
10:42:52,722 ERROR [EntityContainer] Starting failed
org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc.xml : datasourc
e-mapping titandb not found
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDB
CEntityMetaData.java:399)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init
>(JDBCApplicationMetaData.java:258)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXm
lFileLoader.java:75)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaDat
a(JDBCStoreManager.java:737)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBC
StoreManager.java:430)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManage
r.java:372)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManag
er.java:170)
at org.jboss.ejb.EntityContainer.startService(EntityContainer.java:339)

and following summary:
MBeans waiting for other MBeans:
[ObjectName: jboss.j2ee:jndiName=StatesHomeRemote,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Error in jbosscmp-jdbc
.xml : datasource-mapping titandb not found]
So, what is <datasource-mapping> supposed to refer to?
Thanks in advance.
Rick Feenstr
Greenhorn

Joined: Jul 11, 2003
Posts: 6
I got it figured out.
Unless noted, everything is defined as in the JBoss Workbook from O'Reilly.
Using the JSQLConnect jdbc driver.
Copy JBoss_home/docs/examples/jca/mssql-ds.xml to project_home/project-ds.xml. (The filename must end in �ds.xml). In my case, it is titandb-ds.xml.
Update file as:
titandb-ds.xml

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:JSQLConnect://DATABASE_SERVER_NAME ort/database=database_name/user=foo/password=bar/sqlVersion=6</connection-url>
<driver-class>com.jnetdirect.jsql.JSQLDriver</driver-class>
</local-tx-datasource>
</datasources>

Deploy this datasource descriptor by copying it to JBoss_home/server/default/deploy directory.
This creates a datasource, with the JNDI connection pool name java:/MSSQLDS.
Note the �sqlVersion=6� identifier in the jdbc connect string for SQL Server 6.5.
Note that this file is not included with the application�s JAR file; it is maintained separately.

And then project meta-data file:
jbosscmp-jdbc.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
<jbosscmp-jdbc>
<defaults>
<datasource>java:/MSSQLDS</datasource>
<datasource-mapping>MS SQLSERVER</datasource-mapping>
<create-table>false</create-table>
<remove-table>false</remove-table>
</defaults>
<enterprise-beans>
<entity>
<ejb-name>StatesEJB</ejb-name>
<table-name>States</table-name>
<cmp-field>
<field-name>stateName</field-name>
<column-name>StateName</column-name>
</cmp-field>
<cmp-field>
<field-name>stateAbbr</field-name>
<column-name>StateAbbr</column-name>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>

Note the datasource is �java:/MSSQLDS� as defined in the titandb-ds.xml file.
Note that datasource-mapping tag is �MS SQLSERVER�. For SQLServer 2000, it will be �MS SQLSERVER2000�.

I hope this helps someone. -Rick
[ July 15, 2003: Message edited by: Rick Feenstr ]
srinivasan ganesan
Ranch Hand

Joined: Mar 09, 2001
Posts: 54
To whoever is interested in knowing this value for MySql..the datasource-mapping is mySQL (yes its case sensitive). hope this helps someone too..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 3.2 jbosscmp-jdbc.xml - datasource-mapping tag?