I am having trouble configuring multiple datasources in Jboss 3.2.3.    An extensive 
search of the Jboss forums and google revealed no answers, although I did find 
postings for others with the same problem.

   I have 2 Seperate MySQL databases, plus I have left Jboss's  DefaultDS links to 
Hypersonic untouched. (seems that some of the services are making use of it)
(I also left the /conf/jbosscmp-jdbc.xm  untouched)

  
   The first datasource is called Standalone
   res-ref-name = jdbc/Standalone, so this should map to java:comp/env/jdbc/Standalone 
in a client bean's context.
   This will map to a physical connection: java:/ITmysql 
  as configured in ../deploy/mysql-local-ds.xml (see below)
 

  The second datasource is: CurlDS -  several CMP beans are referencing this from
 my own jbosscmp-jdbc in the deployed jar. (see below)
    reference is : java:/CurlDS  the physical connection is configured in
    ../deply/mysql-ds.xml (see below)

 the Mysql J/Connector  driver .jar file is happy and living well in /lib


my config:

 // ***************** Deployment Documents ***********************

*** ejb-jar.xml******* (Fragment)

 <session>
  |       .  ............
  |         ........................
  |         <resource-ref>
  |             <description>datastore containing contacts</description>
  |             <res-ref-name>jdbc/Standalone</res-ref-name>
  |             <res-type>javax.sql.DataSource</res-type>
  |             <res-auth>Container</res-auth>
  |             <res-sharing-scope>Shareable</res-sharing-scope>
  |         </resource-ref>
  |     
  |     </session>


**** jboss.xml********  (Fragment)
   <session>
  |         ......
  |         .....
  |         <resource-ref>
  |             <res-ref-name>jdbc/Standalone</res-ref-name>
  |             <jndi-name>java:/ITmysql</jndi-name>
  |         </resource-ref>
  |      </session>


  
  here is where one of my cmp beans referenes the second DB....
 note that i removed the  section.... (could this be the problem?)

***** jbosscmp-jdbc.xml ***** (Frament)
     <entity>
  |             <ejb-name>SequenceEJB</ejb-name>
  |             <datasource>java:/ITmysql</datasource>
  |             <datasource-mapping>mySQL</datasource-mapping> 
  |             <create-table>false</create-table> 
  |             <remove-table>false</remove-table> 
  |             <read-only>false</read-only>                                           
 
  |             <table-name>KeySequence</table-name>
  |           .............
  |            .............



****************** End deployment Descriptors *********************

***************** Datasource Configs *******************************
 in jboss_home/......Server/myserver/deploy/

   I added:

       *** mysql-ds.xml****    for   java:/CurlDS

<datasources>
  |   <local-tx-datasource>
  |     <jndi-name>CurlDS</jndi-name>
  |     <connection-url>jdbc:mysql://192.168.18.23:3306/CML</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>mysql</user-name>
  |     <password>abc123</password>
  | 
  |      <!-- pooling -->
  |     <min-pool-size>0</min-pool-size>
  |     <max-pool-size>8</max-pool-size>
  |     <blocking-timeout-millis>4800</blocking-timeout-millis>
  |     <idle-timeout-minutes>8</idle-timeout-minutes>
  |    <!--
  |     <security-domain>CurlDbRealm</security-domain>
  |     -->
  |   </local-tx-datasource>
  | 
  | </datasources>



and *** mysql-local-ds.xml *** for java:/ITmysql

<datasources>
  |   <local-tx-datasource>
  |     <jndi-name>ITmysql</jndi-name>
  |     <connection-url>jdbc:mysql://192.168.18.35:3306/CML</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>cado_usr</user-name>
  |     <password>MR-MC</password>
  | 
  |      <!-- pooling -->
  |     <min-pool-size>0</min-pool-size>
  |     <max-pool-size>8</max-pool-size>
  |     <blocking-timeout-millis>4800</blocking-timeout-millis>
  |     <idle-timeout-minutes>8</idle-timeout-minutes>
  |   <!--
  |     <security-domain>MySQLDbRealm</security-domain>
  |    -->
  |   </local-tx-datasource>
  | 
  | </datasources>


********************** End DataSource Config ************************


 The Weird thing is ...my apps completely IGNORE these data sources!
 All attempts to find on a CMP, or hits to the datastore
at a bean's environment (ex. To java:comp/env/jdbc/Standalone)...all hit the 
DefaultDS, instead of the datastores they are supposed to hit!


 For example:  Here is a attempt to retrieve data via the
    java:comp/env/jdbc/Standalone datastore, in the Session bean outlined in my 
ejb-jar.xml fragment, above:

 2004-04-02 11:38:44,656 INFO  [STDOUT] Contact Bean: SQL Exception
  | 2004-04-02 11:38:44,656 INFO  [STDOUT] Table not found: ContactEntry in statement 
[Select conts.fname, conts.lname, conts.type, ce.*From 'ContactEntry' as ce, 
'Contacts' as conts Where (conts.ckey = ce.contactkey) And (conts.customer_number = 
'033380') Order By ce.contactKey asc, ce.ckey asc]
  | 2004-04-02 11:38:44,656 ERROR [STDERR] java.sql.SQLException: Table not found: 
ContactEntry in statement [Select conts.fname, conts.lname, conts.type, ce.*From 
'ContactEntry' as ce, 'Contacts' as conts Where (conts.ckey = ce.contactkey) And 
(conts.customer_number = '033380') Order By ce.contactKey asc, ce.ckey asc]
  | 2004-04-02 11:38:44,656 ERROR [STDERR]      at org.hsqldb.Trace.getError(Unknown 
Source)
  | 2004-04-02 11:38:44,656 ERROR [STDERR]      at 
org.hsqldb.jdbcResultSet.<init>(Unknown Source)
  | 2004-04-02 11:38:44,656 ERROR [STDERR]      at 
org.hsqldb.jdbcConnection.executeStandalone(Unknown Source)
  | 2004-04-02 11:38:44,656 ERROR [STDERR]      at 
org.hsqldb.jdbcConnection.execute(Unknown Source)
  | 2004-04-02 11:38:44,656 ERROR [STDERR]      at 
org.hsqldb.jdbcStatement.fetchResult(Unknown Source)


   The data hit goes to the Hsql database!!!



 And it gets WIERDER!:

   Take a look at that jboss.xml fragment again...
    then look at the results of the jndi-naming list function for that 
    Session bean:


     +- env (class: org.jnp.interfaces.NamingContext)
  |   |   +- jdbc (class: org.jnp.interfaces.NamingContext)
  |   |   |   +- Standalone[link -> java:/DefaultDS] (class: javax.naming.LinkRef)

      Standalone maps to java:/DefaultDS

         and NOT to  java:/ITmysql, as specified in jboss.xml


Does anyone know why this is?  Do you see any obvious omissions in my XML docs?

   
  HELP! Or my company may force me to use <GASP!> .NET  
       (sorry to use that nasty word)

  Thank you in advance for any help!
 
  Scott

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3828925#3828925

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3828925


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to