9 Replies Latest reply on Nov 28, 2002 12:49 PM by dnoyeb

    steps to comnfigure datasource mysql

    soorajwins21

      Can anybody give me details that will let me know how to confugure musql datasource in jboss-3.o_Tomcat-4.0.3.

      If there are ant steps to follow let me know.

        • 1. Re: steps to comnfigure datasource mysql
          tdang

          A mysql-service file exists in %JBOSS_INST%\docs\examples\jca. Copy it to your project directory and modify these following lines:

          - <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://dell:3306/jbossdb</config-property>
          Set your database here.

          - <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
          Set your database driver. By default you must not modify it.

          - <config-property name="UserName" type="java.lang.String"></config-property>
          <config-property name="Password" type="java.lang.String"></config-property>
          Set the user and pwd for database access.

          Then copy it into %JBOSS_INST%\server\default\deploy directory. Be sure that you copy your mysql jdbc driver to %JBOSS_INST%\server\default\lib before.

          It was.

          Hope this helps.

          • 2. Re: steps to comnfigure datasource mysql
            mwessendorf

            Hello!

            I am using JBoss 3.04 and MySQL,
            i chaned the mysql-service.xml and copied it into
            "deploy"
            the source:
            <depends optional-attribute-name="ManagedConnectionFactoryName">
            <!--embedded mbean-->


            MySqlDS


            <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://192.168.1.22:3306/testDB</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">user</config-property>
            <config-property name="Password" type="java.lang.String">passwd</config-property>




            ...


            In conf/ i chaned standardjaws.xml and standardjboss-jdbc.xml like this:


            java:/MySqlDS
            <type-mapping>MySQL</type-mapping>
            false


            but this all did not help to run jboss with MySQL

            is there something to change in login-config.xml ?

            Thank you very much!!!

            Greetz

            • 3. Re: steps to comnfigure datasource mysql
              tdang

              Did you get any errors?

              • 4. Re: steps to comnfigure datasource mysql
                mwessendorf

                Hello,

                yes, i got this error:
                Error in jbosscmp-jdbc.xml: datasource-mapping MySqlDs not found!

                but in the jbosscmp in my jar there is no name for a datasource.

                the name for MySqlDs was declared in $JBOSS\server\default\conf\standardjboscmp-jdbc.xml and standardjaws.xml.

                So if i use the default with hypersonic it works...

                for fun i chaned the name in this standard-files

                java:/DefaultDS
                <datasource-mapping>standardDB/datasource-mapping>

                and it even doesn´t work...
                Error in jbosscmp-jdbc.xml: datasource-mapping standardDB not found!



                only if the mapping is "Hypersonic SQL"

                it runs...

                thank you!

                Greetings from Germany

                • 5. Re: steps to comnfigure datasource mysql
                  mwessendorf

                  Hello,

                  yes, i got this error:
                  Error in jbosscmp-jdbc.xml: datasource-mapping MySqlDs not found!

                  but in the jbosscmp in my jar there is no name for a datasource.

                  the name for MySqlDs was declared in $JBOSS\server\default\conf\standardjboscmp-jdbc.xml and standardjaws.xml.

                  So if i use the default with hypersonic it works...

                  for fun i chaned the name in this standard-files

                  java:/DefaultDS
                  <datasource-mapping>standardDB/datasource-mapping>

                  and it even doesn´t work...
                  Error in jbosscmp-jdbc.xml: datasource-mapping standardDB not found!



                  only if the mapping is "Hypersonic SQL"

                  it runs...

                  thank you!

                  Greetings from Germany

                  • 6. Re: steps to comnfigure datasource mysql
                    bladerunner

                    I am using JBoss 3.03 w/Tomcat 4.1 and I used the supplied mysql-service.xml file and changed the entries as follows:

                    <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/bladerunner</config-property>
                    <config-property name="DriverClass" type="java.lang.String">com.mysql.jdbc.Driver</config-property>

                    I have tried switching between the "com.mysql.jdbc.Driver" and "org.gjt.mm.mysql.Driver" classes and I keep getting a javax.resource.ResourceException: Apparently wrong driv
                    er class specified for URL: class: com.mysql.jdbc.Driver, url: jdbc:mysql://localhost:3306/bladerunner when I try to get the connection in my code.

                    My Java code looks like this:

                    InitialContext initCtx = new InitialContext();
                    Connection conn = null;
                    DataSource ds = (javax.sql.DataSource)initCtx.lookup("java:/BladeRunnerDS");
                    conn = ds.getConnection(); --> this is where the exception is thrown

                    Does anyone have any ideas? Anyone else implemented MySQL with JBoss?

                    Thanks

                    • 7. Re: steps to comnfigure datasource mysql
                      bladerunner

                      Hi everyone, I seemed to have solved my problem. I had the mysqlxxx.jar file in my WEB-INF\lib directory with my application jars. When I moved it to %JAVA_HOME%\server\default\lib everything works fine.

                      Hope my blunder is of help for others out there :)

                      • 8. Re: steps to comnfigure datasource mysql
                        markuspr

                        Hi,

                        I want to change my database from Hypersonic to MySQL. So I've tried all the hints if've found! So that's what I've done:

                        1. I've copied mysql-connector.jar into %JAVA_HOME%\server\default\lib
                        2. I've copied the mysql-service.xml into %JAVA_HOME%\server\default\deploy
                        3. I've edited the mysql-service.xml (username, password, ConnectionURL, DriverClass (was ok))
                        4. I've edited the standardjaws.xml and standardjboss-jdbc.xml (java:/MySqlDB<datasource-mapping>mySQL</datasource-mapping>)
                        5. I've started JBoss

                        Now JBoss should use the MySQL-DB, but I doesn't. It still uses Hypersonic! If I try the get one of my CMP2-beans it gets the old ones.

                        If I start JBoss there is the following warning:

                        WARN [ServiceController] jboss.jca:service=LocalTxDS,name=MySqlDS does not implement any Service methods

                        Is this okay? I need the MySQL-Database. Can anybody help me??? Thanks!

                        Markus

                        • 9. Re: steps to comnfigure datasource mysql
                          dnoyeb

                          There is just 1 extra file needed for 3.x it seems. See what I discovered here

                          http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/