• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To whoever is interested in knowing this value for MySql..the datasource-mapping is mySQL (yes its case sensitive). hope this helps someone too..
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic