7 Replies Latest reply on Apr 16, 2009 10:35 PM by ?? gao

    How to set the datasource inside ServiceMix??

    ?? gao Newbie

      How to set the data source inside ServiceMix, initialization, as well as connect to database??

      Such as mysql database, how to %SERVICEMIX_HOME%\conf the following configuration Jndi.xml?

       

      Edited by: gaoming25 on Mar 11, 2009 10:03 AM

        • 1. Re: How to set the datasource inside ServiceMix??
          Stan Lewis Novice

          Adding JNDI datasources to servicemix is documented here for 3.x:

           

          http://fusesource.com/docs/esb/3.4/deploy_guide/DeployESBJNDIConfig.html

           

          if you're starting servicemix directly the "conf" directory will already be in your classpath, whereas if you're embedding servicemix within a servlet container you'll need to ensure the container is configured to include the "conf" directory in the classpath so servicemix can find the jndi.properties file.

          • 2. Re: How to set the datasource inside ServiceMix??
            Torsten Mielke Apprentice

            Do you want to use MySQL as the persistence store in the embedded ActiveMQ? This can be configured easily and is documented here

            Simply uncomment the line

                  <amq:journaledJDBC journalLogFiles="5" 
                  dataDirectory="../data" 
                  dataSource="#mysql-ds"/>
            

            in your conf/activemq.xml and set the dataSource property to the #mysql-ds reference. Further down in the same file uncomment the mysql-ds bean definition and configure it properly for url, username and password.

            You will also need to place the MySQL JDBC driver into lib/optional of your ServiceMix installation.

            • 3. Re: How to set the datasource inside ServiceMix??
              ?? gao Newbie

              I ask my brother, how to deploy ServiceMix the following data sources? ?

               

              Where to deploy? Can support multiple data sources&#21527;? Supported connection

               

              pool management? Posted the best section of the configuration of mysql and

               

              oracle code? thanks !!

              • 4. Re: How to set the datasource inside ServiceMix??
                Torsten Mielke Apprentice

                If you want to configure the underlying ActiveMQ to use JDBC for persistence (can you please confirm this?), then only one JDBC driver can be configured at a time.

                 

                Connection pooling is provided by using the Jakarta Commons DBCP library, as already configured in your activemq.xml:

                 

                <bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
                    <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
                    <property name="url" value="jdbc:mysql://localhost/activemq?relaxAutoCommit=true"></property>
                    <property name="username" value="activemq"></property>
                    <property name="password" value="activemq"></property>
                    <property name="maxActive" value="200"></property>
                    <property name="poolPreparedStatements" value="true"></property>
                  </bean>
                

                 

                Perhaps you also find this documentation useful. For Oracle I also suggest reading the documentation of their JDBC driver.

                • 5. Re: How to set the datasource inside ServiceMix??
                  ?? gao Newbie

                  thank very much!!!

                              

                  I have configured JNDI will, but if I create a new project to achieve a database (mysql) operation, such as: add, delete, modify, operate, how to do? ? ? Have you source it?

                  I see there are spagic components jdbc, how to connect and databases, and operating it?

                  Can give me a database operated source project?

                   

                  Edited by: gaoming25 on Mar 19, 2009 3:45 AM

                  • 6. Re: How to set the datasource inside ServiceMix??
                    Torsten Mielke Apprentice

                    Do you want to use MySQL in your application level code? Well, then just resolve the driver or JDBC connection from JNDI and use it from there.

                    I presume you configured MySQL via Spring?

                     

                    Not sure if I understand your question right though.

                    • 7. Re: How to set the datasource inside ServiceMix??
                      ?? gao Newbie

                      Thank you very much! In jndi.xml, mysql is configured to have the will, but this oracle? ? With those drivers?

                       

                      My Profile:

                       

                      However, can not be inserted into the data, you can query!

                       

                      this is the Exception &#65306;

                       

                      Exception in thread "pool-3-thread-1" java.lang.AbstractMethodError: oracle.jdbc

                      .driver.OraclePreparedStatement.getParameterMetaData()Ljava/sql/ParameterMetaDat

                      a;

                              at org.apache.commons.dbcp.DelegatingPreparedStatement.getParameterMetaD

                      ata(DelegatingPreparedStatement.java:223)

                              at org.glassfish.openesb.databasebc.JDBCDenormalizer.populatePreparedSta

                      tement(JDBCDenormalizer.java:322)

                              at org.glassfish.openesb.databasebc.JDBCDenormalizer.denormalizeOutbound

                      (JDBCDenormalizer.java:114)

                              at org.glassfish.openesb.databasebc.OutboundMessageProcessor.executeOutb

                      oundSQL(OutboundMessageProcessor.java:1367)

                              at org.glassfish.openesb.databasebc.OutboundMessageProcessor.processInOn

                      ly(OutboundMessageProcessor.java:1241)

                              at org.glassfish.openesb.databasebc.OutboundMessageProcessor.execute(Out

                      boundMessageProcessor.java:297)

                              at org.glassfish.openesb.databasebc.OutboundMessageProcessor.run(Outboun

                      dMessageProcessor.java:171)

                              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec

                      utor.java:886)

                              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor

                      .java:908)

                              at java.lang.Thread.run(Thread.java:619)

                       

                      Edited by: gaoming25 on Apr 17, 2009 2:33 AM