Hi

You can lookup a bean in the registry from exchange

Object myBean = exchange.getContext().getRegistry().lookup("someName");



When you use  Class.forName("com.mysql.jdbc.Driver"); in OSGi then you
need to have com.mysql.jdbc in your import package in the MANIFEST.MF
file, for it to work in OSGi. Or use dynamic import in the MANIFEST.MF
to allow loading classes dynamic.






On Tue, Feb 25, 2014 at 7:47 AM, contactreji <contactr...@gmail.com> wrote:
> Hi
>
> I am trying to do a database operation inside a Processor class.
>
> I have a code
>
> *private static Connection createConnection() {
>                 Connection conn=null;
>
>                 try {
>                         Class.forName("com.mysql.jdbc.Driver");
>
>                         // Get a connection
>
>                 } catch (Exception except) {
>                         LOGGER.info("Error Loading Driver Class");
>                         except.printStackTrace();
>                 }
>                 try {
>                         conn = DriverManager.getConnection(dbURL,"root","");
>                 } catch (SQLException e) {
>                         LOGGER.info("Error initializing the connection object 
> from Driver
> Manager");
>                         // TODO Auto-generated catch block
>                         e.printStackTrace();
>                 }
>                 return conn;
>         }*
>
>
> I get following log
>
> *12:12:23,609 | INFO  | sumer[EAMBuffer] | DBActions
> | 271 - com.outotec.asset-down-time - 1.0.0 | Error Loading Driver Class
> 12:12:23,675 | INFO  | sumer[EAMBuffer] | DBActions                        |
> 271 - com.outotec.asset-down-time - 1.0.0 | Error initializing the
> connection object from Driver Manager*
>
> This happens only when the project is deployed to Jboss Fuse. The same works
> fine when I run the program in Maven standalone using camel:run maven goal.
>
>
> *Is there any specific way in camel projects to obtain a connection object
> using spring configuration/java dsl to use the object in my java processor.*
> According to my requirement, I don't want to do it via camel SQL component.
>
> Please suggest
>
> Regards
> Reji Mathews
>
>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/JDBC-Connection-object-in-Camel-Processor-tp5747896.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to