Hi

I tried deploying jtds driver as osgi too, using:
osgi:install -s wrap:mvn:net.sourceforge.jtds/jtds/1.2.4
but it still not find jtds driver. 
Only way I found was to put jar in lib directory.

As to my working example, i have yet to try Charles suggestion on how to
move db config to beans. Will try it soon (thanks Charles!!)

I can make a stand alone sample of this later, if the info below is not
enough; but i figured you'd rather have a quick simple reply than wait long
time for good reply ;)

Source structure:

+---main
    +---java
    ¦   +---com
    ¦       +---xxxxx
    ¦           +---integration
    ¦               +---dbsample
    ¦                       MyRouteBuilder.java - see below
    ¦                       Pojo.java           - Simple pojo with fields
matching result set in SQL
    ¦                       Config.java         - Simple pojo with config
values from etc/cfg-file
    ¦
    +---resources
        ¦   Pojo.xml                            - see below
        ¦   SqlMapConfig.xml                    - see below
        ¦
        +---META-INF
            +---spring
                    beans.xml                   - see below


SqlMapConfig.xml:

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

&lt;!DOCTYPE sqlMapConfig
  PUBLIC &quot;-//ibatis.apache.org//DTD SQL Map Config 2.0//EN&quot;
  &quot;http://ibatis.apache.org/dtd/sql-map-config-2.dtd&quot;&gt;


 
        
                
                        
                        
                        
                        
                
        

        



Pojo.xml: Ibatis query file, like:

<?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE sqlMap
  PUBLIC &quot;-//ibatis.apache.org//DTD SQL Map 2.0//EN&quot;
  &quot;http://ibatis.apache.org/dtd/sql-map-2.dtd&quot;&gt;



        
        

        
                {
                
#returnedValue,jdbcType=INTEGER,javaType=java.lang.Integer,mode=OUT# =
                        CALL    SPRC_POJO_GET_NEXT
                        (
                                        @pParam1 = #conf.param1#
                        )
                }
  




Beans.xml:

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



        
                
        

        
                
        

        
                
        




MyRouteBuilder:

public class MyRouteBuilder extends RouteBuilder {

        Config config;
        
        @Override
        public void configure() {
    
                from("timer://pollTheDatabase?delay=5000&period=15000")
                .process(new Processor()
                        {
                                //This is just test code for now.. not best 
practices ;)
                                @Override
                                public void process(Exchange arg0) throws 
Exception
                                {
                                        Map&lt;String, Object&gt; map = new 
HashMap&lt;String, Object&gt;();
                                        map.put("conf",config);
                                        map.put("returnedValue", -1);
                                        
                                        arg0.getIn().setBody(
                                                        map
                                                        );
                                        
                                }
                        })
                .to("ibatis:getNextPojo?statementType=QueryForList")
                        .log("${header.CamelIBatisResult}")
                        .split(body())
                        .bean(new MyBean());

    }

    public static class MyBean {

        public void someMethod(Pojo p) {
            System.out.println("Received: " + p.getSomeField());
        }
    }
    
    public Config getConfig()
    {
        return config;
    }
    
    public void setConfig(Config config)
    {
        this.config = config;
    }
}


I hope its at least a little bit helpful

/L

--
View this message in context: 
http://servicemix.396122.n5.nabble.com/Using-MyBatis-in-a-camel-route-on-SMX-tp4256837p4262075.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to