14 Replies Latest reply on Oct 14, 2003 7:07 PM by tomm

    mysql datasource config in jboss 3.2.1

    Tim Bauer Novice

      Could someone help me out here??

      In jboss 3.0.6 I used to declare a mysql datasource service and was able to specify various other attributes in the service file that are not longer available:

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


      50
      100
      10000
      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





      Currently the only thing in the -ds file is the connection information...

      HOW and WHERE do I specify minsize,maxsize, timeout, etc in the new 3.2.1 -ds configuration??

        • 1. Re: mysql datasource config in jboss 3.2.1
          Carlos Newbie

          Hi,

          Could you try with this??

          <connection-property name="char.encoding">UTF-8</connection-property>

          See the generic-ds.xml under the docs/examples dir.

          • 2. Re: mysql datasource config in jboss 3.2.1
            ch_lakshmi Newbie

            Could someone help me with this.
            I am getting the following exception with mysql-service.xml

            16:38:14,629 INFO [MainDeployer] Starting deployment of package: file:/E:/jboss
            -3.2.1_tomcat-4.1.24/server/default/deploy/mysql-service.xml
            16:38:14,669 INFO [ServiceConfigurator] Problem configuring service jboss.jca:s
            ervice=LocalTxCM,name=printPool
            org.jboss.deployment.DeploymentException: Exception setting attribute javax.mana
            gement.Attribute: name=ManagedConnectionFactoryName value=jboss.jca:service=Loca
            lTxDS,name=printPool on mbean jboss.jca:service=LocalTxCM,name=printPool; - nest
            ed throwable: (javax.management.AttributeNotFoundException: Writable attribute '
            ManagedConnectionFactoryName' not found)
            at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator
            .java:472)
            at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.ja
            va:357)
            at org.jboss.system.ServiceConfigurator.internalInstall(ServiceConfigura
            tor.java:176)
            at org.jboss.system.ServiceConfigurator.install(ServiceConfigurator.java
            :118)
            -----------------------------------------------------
            Here is the mysql-servcie.xml file that I am using


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

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



            <!-- ==================================================================== -->
            <!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
            <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
            <!-- ==================================================================== -->




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

            <application-policy name = "MySqlDbRealm">

            <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=MySqlDS</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 MySqlDbRealm above
            MySqlDbRealm
            -->

            printPool
            <depends optional-attribute-name="ManagedConnectionFactoryName">


            <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost/print29</config-property>
            <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
            <!--set these only if you want only default logins, not through JAAS -->
            <config-property name="UserName" type="java.lang.String">print29</config-property>
            <config-property name="Password" type="java.lang.String">print29</config-property>


            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper



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


            10
            60
            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





            ---------------------------------------------------------------

            the mysql-ds.xml contents are :

            <local-tx-datasource>
            <jndi-name>MySqlDS</jndi-name>
            <connection-url>jdbc:mysql://localhost/sudildb</connection-url>
            <driver-class>org.gjt.mm.mysql.Driver</driver-class>
            <user-name>print29</user-name>
            print29
            </local-tx-datasource>



            ----------------------------------------
            what has to be corrected in th above.
            I appreciate your help

            Thanks
            Lakshmi

            • 3. Re: mysql datasource config in jboss 3.2.1
              ch_lakshmi Newbie

              Has anyone tried configuring MySql service with JBoss3.2.1 version?
              If so , could you pl post the contents of mysql-service.xml here.
              Thanks
              Lakshmi

              • 4. Re: mysql datasource config in jboss 3.2.1
                sal ingrilli Newbie

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

                <local-tx-datasource>
                <jndi-name>DefaultDS</jndi-name>
                <connection-url>jdbc:mysql://localhost/vxtracker</connection-url>
                <driver-class>org.gjt.mm.mysql.Driver</driver-class>
                <user-name>shortpasta</user-name>
                shortpasta
                </local-tx-datasource>

                • 5. Re: mysql datasource config in jboss 3.2.1
                  glennmcd Newbie

                  Appendix A of the O'Reilly Enterprise JavaBeans Workbook has a description of the 3.0 and 3.2 ways of configuring a datasource for JBoss. They use Oracle but it should be fairly similar to MySql. Here is an URL: http://www.oreilly.com/catalog/entjbeans3/workbooks/index.html

                  Glenn

                  • 6. Re: mysql datasource config in jboss 3.2.1
                    Tim Bauer Novice

                    First off, thanks to glennmcd for the intelligent lead on where to find information...As to the others, I'm not sure why you thought that your posts to this question had anything constructive to add to my question?

                    • 7. Re: mysql datasource config in jboss 3.2.1
                      Tim Bauer Novice

                      Thanks, I finally figured it out.

                      Actually the file (JCAConfig.pdf) JCA Adaptor Configuration
                      Chapter 7 excerpt from the JBoss Admin and Development Book,
                      theres' a section which actually shows all the database configuration
                      types and parameters you can give for each..

                      So, my original mysql ds file (from the examples) was:


                      <local-tx-datasource>
                      <jndi-name>ICSRegDS</jndi-name>
                      <connection-url>jdbc:mysql://localhost/mydatabase</connection-url>
                      <driver-class>com.mysql.jdbc.Driver</driver-class>
                      <user-name>myusername</user-name>
                      mypassword
                      </local-tx-datasource>



                      became:


                      <local-tx-datasource>
                      <jndi-name>ICSRegDS</jndi-name>
                      <connection-url>jdbc:mysql://localhost/mydatabase</connection-url>
                      <driver-class>com.mysql.jdbc.Driver</driver-class>
                      <user-name>myusername</user-name>
                      mypassword
                      <min-pool-size>50</min-pool-size>
                      <max-pool-size>100</max-pool-size>
                      <blocking-timeout-millis>10000</blocking-timeout-millis>
                      <idle-timeout-minutes>15</idle-timeout-minutes>
                      </local-tx-datasource>

                      • 8. Re: mysql datasource config in jboss 3.2.1
                        Vadim Snitkovsky Newbie

                        Tim, thank you for posting your solution. I wish more people would post a solution to their problem.

                        • 9. Re: mysql datasource config in jboss 3.2.1
                          Vadim Snitkovsky Newbie

                          I have a config specific problem its in this thread:
                          http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= you can help it would be greatly appreciated.

                          Thank You

                          • 10. Re: mysql datasource config in jboss 3.2.1
                            Vadim Snitkovsky Newbie

                            Just to keep people updated the answer to my problem is the answer above my question.

                            • 11. Re: mysql datasource config in jboss 3.2.1
                              silvio.croce Newbie

                              this is how i configured mysql as db default in jboss 3.2.1
                              please if someone notice something missing post it to this thread.
                              with my ejb everything seems to be ok but every advise is welcome.




                              put driver mysql "mysql-connector-java-3.0.8-stable-bin.jar" in the folder "C:\jboss-3.2.1_tomcat-4.1.24\server\default\lib"

                              modify the first raws of the file "C:\jboss-3.2.1_tomcat-4.1.24\server\default\conf\standardjaws.xml"
                              java:/DefaultDS
                              <type-mapping>mySQL</type-mapping>

                              modify the first raws of the file "C:\jboss-3.2.1_tomcat-4.1.24\server\default\conf\standardjbosscmp-jdbc.xml"
                              java:/DefaultDS
                              <datasource-mapping>mySQL</datasource-mapping>

                              change these 2 raws of sql at the bottom of the file "C:\jboss-3.2.1_tomcat-4.1.24\server\default\deploy\jms\jbossmq-service.xml"

                              BLOB_TYPE=BLOB
                              <!--original: BLOB_TYPE=OBJECT_BLOB -->

                              DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES USING JMS_MESSAGES AS M, JMS_TRANSACTIONS AS T WHERE M.TXID=T.TXID AND M.TXOP=?
                              <!--original: DELETE_MARKED_MESSAGES_WITH_TX = DELETE FROM JMS_MESSAGES WHERE TXID IN (SELECT TXID FROM JMS_TRANSACTIONS) AND TXOP=?-->

                              create a file "mysql-ds.xml" as showed here editing the bold parts with your data and put it in the folder "C:\jboss-3.2.1_tomcat-4.1.24\server\default\deploy"


                              <local-tx-datasource>
                              <jndi-name>DefaultDS</jndi-name>
                              <connection-url>jdbc:mysql://localhost:3306/zzzzz</connection-url>
                              <driver-class>org.gjt.mm.mysql.Driver</driver-class>
                              <user-name>xxxxx</user-name>
                              yyyyy
                              </local-tx-datasource>


                              delete file "C:\jboss-3.2.1_tomcat-4.1.24\server\default\deploy\hsqldb-ds.xml"


                              • 12. Re: mysql datasource config in jboss 3.2.1
                                silvio.croce Newbie

                                PS

                                i forgot a thing:

                                in the file "C:\jboss-3.2.1_tomcat-4.1.24\server\default\deploy\jms\jbossmq-service.xml" there is another correction to do.
                                in a query "CREATE" at the bottom of the file the OBJECT type is used. Substitute it with BLOB.

                                sorry:-)

                                • 13. Re: mysql datasource config in jboss 3.2.1
                                  moonwatcher Newbie

                                  Silvio, should the tables created for the JMS not be innoDB insteam of myISAM?

                                  • 14. Re: mysql datasource config in jboss 3.2.1
                                    tomm Newbie

                                    silvo - try using this in your mysql-ds.xml

                                    <driver-class>com.mysql.jdbc.Driver</driver-class>

                                    thanks for SQL info for the jbossmq-service.xml file it works fine but I had to create a table called JMS_TRANSACTIONS in my database first. I used the hypersonic default.script to get the table create info it is lacated here \server\default\data. I use MySQL-Front to do this get it from here

                                    http://mysqlfront.venturemedia.de