1 Reply Latest reply on Jan 7, 2004 10:42 PM by arbalu

    Problem in accessing or updating tables in two or more datab

    arbalu

      Hi,
      We are using two databases for string data related to different purposes and using only one JBoss server instance. I happened to change the ms-sqlservice.xml file so that the two databases are accessible. The only difference in their definition being a change in their JNDI names and urls. Now, when I execute my application, my cmp is not recognizing the tables in the second database. It says Invalid object name 'MsgOut'. Have I got to do anything more apart from updating my ms-sqlservice.xml? Am I missing any configuration??? Please help me out...

      with best regards,
      ARB

        • 1. Re: Problem in accessing or updating tables in two or more d
          arbalu

          more info on the above...

          I need to support 2 databases. I am using jboss 3.0.x. The ms-sqlservice.xml file looks like this...

          ?xml version="1.0" encoding="UTF-8"?>

          <!-- ===================================================================== -->
          <!-- -->
          <!-- JBoss Server Configuration -->
          <!-- -->
          <!-- ===================================================================== -->



          <!-- ======================================================================-->
          <!-- New ConnectionManager setup for Microsoft SQL Server 2000 driver -->
          <!-- You may download the latest Microsoft JDBC driver from *Microsoft* -->
          <!-- http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml&frame=true -->
          <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
          <!-- ===================================================================== -->



          <!-- Include a login module configuration named MSSQLDbRealm.
          Update your login-conf.xml, here is an example for a
          ConfiguredIdentityLoginModule:

          <application-policy name = "MSSQLDbRealm">

          <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
          <module-option name = "principal">yourprincipal</module-option>
          <module-option name = "userName">yourusername</module-option>
          <module-option name = "password">yourpassword</module-option>
          <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=SQLServerPool</module-option>
          </login-module>

          </application-policy>

          NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
          module-option name = "managedConnectionFactoryName"
          must match the object name of the ConnectionManager you are configuring here.
          -->
          <!--uncomment out this line if you are using the MSSQLDbRealm above
          MSSQLDbRealm
          -->

          <depends optional-attribute-name="ManagedConnectionFactoryName">
          <!--embedded mbean-->

          SQLServerPool


          <!--Below here are Database Driver settings.If in case Sprinta2000 is needed the following two lines needs to uncommented and the corresponding two lines for SQLServerDriver have to be commentted-->
          <config-property name="ConnectionURL" type="java.lang.String">jdbc:inetdae7://localhost:1433?database=Release1.4</config-property>
          <config-property name="DriverClass" type="java.lang.String">com.inet.tds.TdsDriver</config-property>
          <!--set these only if you want only default logins, not through JAAS-->
          <config-property name="UserName" type="java.lang.String">test</config-property>
          <config-property name="Password" type="java.lang.String">test</config-property>


          <!--Below here are advanced properties -->
          <!--hack-->
          <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper


          <!-- Connection to another database called TCEnterprise -->

          TCE


          <!--Below here are Database Driver settings.If in case Sprinta2000 is needed the following two lines needs to uncommented and the corresponding two lines for SQLServerDriver have to be commentted-->
          <config-property name="ConnectionURL" type="java.lang.String">jdbc:inetdae7://localhost:1433?database=TCEnterprise</config-property>
          <config-property name="DriverClass" type="java.lang.String">com.inet.tds.TdsDriver</config-property>
          <!--set these only if you want only default logins, not through JAAS-->
          <config-property name="UserName" type="java.lang.String">test</config-property>
          <config-property name="Password" type="java.lang.String">test</config-property>


          <!--Below here are advanced properties -->
          <!--hack-->
          <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper


          <depends optional-attribute-name="ManagedConnectionPool">
          <!--embedded mbean-->

          0
          50
          5000
          15
          <!--criteria indicates if Subject (from security domain) or app supplied
          parameters (such as from getConnection(user, pw)) are used to distinguish
          connections in the pool. Choices are
          ByContainerAndApplication (use both),
          ByContainer (use Subject),
          ByApplication (use app supplied params only),
          ByNothing (all connections are equivalent, usually if adapter supports
          reauthentication)-->
          ByContainer


          <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager
          <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager
          java:/TransactionManager
          <!--make the rar deploy! hack till better deployment-->
          jboss.jca:service=RARDeployer




          is the above configuration correct or have i missed anything here or misplaced any code in the above file... My problem here is that I am not able to access the table MsgOut in the database TCE... it throws an exception as below...


          java.sql.SQLException: [PEGASUS]Invalid object name 'MsgOut'.
          at com.inet.tds.e.a(Unknown Source)
          at com.inet.tds.b.do(Unknown Source)
          at com.inet.tds.b.executeQuery(Unknown Source)
          at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeQuery(LocalPreparedStatement.java:289)
          at org.jboss.ejb.plugins.jaws.jdbc.JDBCQueryCommand.executeStatementAndHandleResult(JDBCQueryCommand.java:62)
          at org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:176)
          at org.jboss.ejb.plugins.jaws.jdbc.JDBCBeanExistsCommand.execute(JDBCBeanExistsCommand.java:58)
          at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:134)
          at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersistenceManager.java:255)
          at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:253)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
          at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:731)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)
          at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1119)
          at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:206)
          at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
          at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:73)
          at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:90)
          at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:79)
          at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:44)
          at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:111)
          at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)
          at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:52)
          at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:105)
          at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129)
          at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
          at org.jboss.ejb.Container.invoke(Container.java:730)
          at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
          at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
          at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
          at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
          at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
          at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
          at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
          at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
          at $Proxy439.create(Unknown Source)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:324)



          Please let me know where am i wrong or am i completely wrong in the process.. please guide me through...

          thanx in advance...
          ARB...