6 Replies Latest reply on Mar 7, 2004 8:30 PM by michaellee

    Sybase XADataSource

    michaellee

      I have just set up an XADataSource for ASE 12.5 using jConnect 5.5 on Jboss 3.0.6. Since it is not so straightforward, i would like to share it with anyone interested.

      Following modification is required:

      . ra.xml inside jboss-xa.rar
      - for 3.0.6, there is a problem (seem to be a bug and should be fixed in later version) and following should be added inside any <config-property> tag.
      <config-property-value></config-property-value>

      sybase-xa-service.xml
      . xa class : com.sybase.jdbc2.jdbc.SybXADataSource
      . xa property : case sensitive and not follow java standard.
      - databaseName not work and setter method not found
      - only DatabaseName work. This may be a problem with 3.0.6 only

      Actually, since my ASE don't have DTM enabled, error JZ0XS is reported. However, i think the configure is okay.


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

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



      <!-- ======================================================================-->
      <!-- New ConnectionManager setup for Sybase ASE/ASA jConnect driver -->
      <!-- Thanks to Marc Zampetti <zampetti@aol.net> -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- ===================================================================== -->
      <!--classpath ARCHIVE="jconn2.jar" CODEBASE="../lib/" /-->


      <!--FMS -->



      <!--uncomment out this line if you are using the SybaseDSRealm above
      SybaseDbRealm
      -->

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


      jdbc/SybaseFMS



      <!-- Sybase jConnect URL for the database.
      NOTE: The hostname and port of made up values. The optional
      database name is provided, as well as some additinal Driver
      parameters.
      -->
      <config-property name="XADataSourceProperties" type="java.lang.String">DatabaseName=FMS_DB;PortNumber=5000;ServerName=SB00NC.intrakmb.com.hk</config-property>
      <config-property name="XADataSourceClass" type="java.lang.String">com.sybase.jdbc2.jdbc.SybXADataSource</config-property>
      <config-property name="UserName" type="java.lang.String">DPCBLNHQ</config-property>
      <config-property name="Password" type="java.lang.String">DPCBLNHQ</config-property>



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



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

      2
      10
      5000
      15
      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





        • 1. Re: Sybase XADataSource
          michaellee

          The sybase-xa-service.xml seem to be corrupted during cut and pate. Following is the content.

          <?xml version="1.0" encoding="UTF-8"?>
          
          <!-- ===================================================================== -->
          <!-- -->
          <!-- JBoss Server Configuration -->
          <!-- -->
          <!-- ===================================================================== -->
          
          <server>
          
           <!-- ======================================================================-->
           <!-- New ConnectionManager setup for Sybase ASE/ASA jConnect driver -->
           <!-- Thanks to Marc Zampetti <zampetti@aol.net> -->
           <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
           <!-- ===================================================================== -->
           <!--classpath ARCHIVE="jconn2.jar" CODEBASE="../lib/" /-->
          
          
           <!--FMS -->
          
           <mbean code="org.jboss.resource.connectionmanager.XATxConnectionManager"
           name="jboss.jca:service=XATxCM,name=SybaseFMS">
          
           <!--uncomment out this line if you are using the SybaseDSRealm above
           <attribute name="SecurityDomainJndiName">SybaseDbRealm</attribute>
           -->
          
           <depends optional-attribute-name="ManagedConnectionFactoryName">
           <!--embedded mbean-->
           <mbean code="org.jboss.resource.connectionmanager.RARDeployment"
           name="jboss.jca:service=XATxDS,name=SybaseFMS">
          
           <attribute name="JndiName">jdbc/SybaseFMS</attribute>
          
           <attribute name="ManagedConnectionFactoryProperties">
           <properties>
           <!-- Sybase jConnect URL for the database.
           NOTE: The hostname and port of made up values. The optional
           database name is provided, as well as some additinal Driver
           parameters.
           -->
           <config-property name="XADataSourceProperties" type="java.lang.String">DatabaseName=FMS_DB;PortNumber=5000;ServerName=SB00NC.intrakmb.com.hk</config-property>
           <config-property name="XADataSourceClass" type="java.lang.String">com.sybase.jdbc2.jdbc.SybXADataSource</config-property>
           <config-property name="UserName" type="java.lang.String">DPCBLNHQ</config-property>
           <config-property name="Password" type="java.lang.String">DPCBLNHQ</config-property>
           </properties>
           </attribute>
          
          <!--Below here are advanced properties -->
           <!--hack-->
           <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=Minerva JDBC XATransaction ResourceAdapter</depends>
           </mbean>
           </depends>
          
           <depends optional-attribute-name="ManagedConnectionPool">
           <!--embedded mbean-->
           <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool"
           name="jboss.jca:service=XATxPool,name=SybaseFMS">
           <attribute name="MinSize">2</attribute>
           <attribute name="MaxSize">10</attribute>
           <attribute name="BlockingTimeoutMillis">5000</attribute>
           <attribute name="IdleTimeoutMinutes">15</attribute>
           <attribute name="Criteria">ByContainer</attribute>
           </mbean>
          
           </depends>
           <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
           <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:service=JaasSecurityManager</depends>
           <attribute name="TransactionManager">java:/TransactionManager</attribute>
          
           <!--make the rar deploy! hack till better deployment-->
           <depends>jboss.jca:service=RARDeployer</depends>
          
           </mbean>
          
          
          </server>
          


          • 2. Re: Sybase XADataSource

            This is great. I had been searching the entire net for someone who had tried using sybase xa connection. Anyway when I tried using this sybase-xa-service.xml by copying it to the deploy directory of jboss 3.2.1, it complained that attribute <jndi-name> is not defined. When I removed the line <jndi-name>, I got another set of errors. So my question is if this can be applies as such to jboss 3.2.1 or is it only applicable to jboss 3.0?

            Many Thanks
            SG

            • 3. Re: Sybase XADataSource
              pilhuhn

              Why don't you just provide a jndi-name instead of remving that element?

              • 4. Re: Sybase XADataSource

                Thanks for your interest in this problem.

                Here is some more information on the configuration I am using:
                I am using jboss-3.2.1_tomcat-4.1.24. When drop the sybase-xa-service.xml in the deploy directory just changing the database name and user id /pwd. I get this error

                org.jboss.deployment.DeploymentException: No Attribute found with name: JndiName
                at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:332)
                at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
                at org.jboss.system.ServiceConfigurator.processDependency(ServiceConfigurator.java:437)
                at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:350)
                at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigurator.java:176)
                at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java:118)
                at org.jboss.system.ServiceController.install(ServiceController.java:225)
                at java.lang.reflect.Method.invoke(Native Method)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
                at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)


                I am not sure if I missed anything or the xml file is not compatible with jbos 3.2.1

                Thanks
                SG

                • 5. Re: Sybase XADataSource
                  michaellee

                  Dear SG,

                  AFAIK, the XML format for 3.2 and 3.0 is different (may be totally). Since i am using 3.0.6, i do not know what should be changed to make it work on 3.2.

                  However, if you refer to the sample sybase -ds xml provided with jboss (not xa), you should get some hint to perform the amendment.

                  If you really cannot solve it, i may try to install 3.2 on my desktop and see whether i can provide some insight.

                  Regards,
                  Michael

                  • 6. Re: Sybase XADataSource
                    michaellee

                    Dear SG,

                    I have extracted orcale-xa-ds from 3.2.3 and modified it for sybase. I have not tested it (since 3.2 not setup) but i think it should work (may be after some minor change). Please try it out (with parameter modified to suit you environment) and inform me the result.

                    Regards,
                    Michael

                    <?xml version="1.0" encoding="UTF-8"?>
                    
                    <!-- ===================================================================== -->
                    <!-- -->
                    <!-- JBoss Server Configuration -->
                    <!-- -->
                    <!-- ===================================================================== -->
                    
                    <datasources>
                     <xa-datasource>
                     <jndi-name>XASybaseDS</jndi-name>
                     <!-- not sure following is required .. from oracle-xa-ds
                     <track-connection-by-tx>true</track-connection-by-tx>
                     <isSameRM-override-value>false</isSameRM-override-value>
                     -->
                     <xa-datasource-class>com.sybase.jdbc2.jdbc.SybXADataSource</xa-datasource-class>
                     <xa-datasource-property name="DatabaseName">FMS_DB</xa-datasource-property>
                     <xa-datasource-property name="PortNumber">5000</xa-datasource-property>
                     <xa-datasource-property name="ServerName">SB00NC.intrakmb.com.hk</xa-datasource-property>
                     <xa-datasource-property name="User">scott</xa-datasource-property>
                     <xa-datasource-property name="Password">tiger</xa-datasource-property>
                     <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>
                     <!-- sql to call when connection is created
                     <new-connection-sql>some arbitrary sql</new-connection-sql>
                     -->
                    
                     <!-- sql to call on an existing pooled connection when it is obtained from pool
                     <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
                     -->
                     </xa-datasource>
                    
                    </datasources>