6 Replies Latest reply on Apr 25, 2004 9:26 AM by adrian.brock

    Datasource with MySQL+CMP 2 problem

    henryle

      Hi
      I'm using MySQL 4.1 + JBoss 3.2.3 to develop a CMP2 application.
      I use a datasource named mysqldstest with CMP1 and it work well but CMP 2. It say datasource not bound even with mysqldstest (work with CMP1).I can not get Datasource with context.lookup(); I think i set jboss configuration not properly.
      Any one help me ?

      Thanks.

        • 1. Re: Datasource with MySQL+CMP 2 problem

          Post your config, an error message or something.
          NOT IT DOES NOT WORK.

          Regards,
          ADrian

          • 2. Re: Datasource with MySQL+CMP 2 problem
            henryle

            Thank you adrian. I 'm suprised at the very fast reply.
            I'm sorry about problem with CMP2.0, i used datasourcename instead java:/datasourcename. now i fixed it. But i can't lookup that datasource

            Context ctx = getInitCtx();//set properties
            Object objds = ctx.lookup("datasourcename")//java:/datasourcename , i tried.

            --> datasourcename not bound ??? ejb work with that datasource ????


            there're my configuration file :

            --mysql-ds.xml--

            -
            - <local-tx-datasource>
            <jndi-name>mysqldstest</jndi-name>
            <connection-url>jdbc:mysql://localhost:3306/test</connection-url>
            <driver-class>com.mysql.jdbc.Driver</driver-class>
            <user-name>root</user-name>
            rootpassword
            </local-tx-datasource>


            --mysql-jdbc2-service.xml--

            <depends optional-attribute-name="ConnectionManager">jboss.jca:service=LocalTxCM,name=mysqldstest


            --standardjbosscmp-jdbc.xml--

            - <jbosscmp-jdbc>
            -
            java:/mysqldstest
            <datasource-mapping>mySQL</datasource-mapping>


            • 3. Re: Datasource with MySQL+CMP 2 problem

              The java: namespace is not accessible outside the virtual machine
              Support for remote access of DataSources has been added in JBoss4,
              but I wouldn't recommend this anti-pattern

              • 4. Re: Datasource with MySQL+CMP 2 problem
                henryle

                I failed when i try to get Datasource outside. I think it lookup datasource (for furure app want to share datasource) is a flexible way. Thank you for your help.

                • 5. Re: Datasource with MySQL+CMP 2 problem
                  nsr_250

                  So that means there is no way for the above code to work? Do I need to deploy my code to the server and run it since "The java: namespace is not accessible outside the virtual machine"?

                  • 6. Re: Datasource with MySQL+CMP 2 problem

                    That is one obvious corollary.
                    The other one is use a DataSource inside your client.