You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by smilevasu6 <sr...@gmail.com> on 2014/11/04 07:15:13 UTC

Camel - JDBC

Hi,

I am very new to camel.

I am trying to establish the oracle connection and fetch the results from
the Data base like select * from emp.

I have a searched a lot but i couldn't find any solution or any source code
from scratch.

Can you please help me out.

Regards,

Srinivas T 



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - JDBC

Posted by Reji Mathews <co...@gmail.com>.
Take up the project which inserts the records. replace the sql query with a
select query. Basically once the flow fires the select query, it should
return a List of Maps containing the records and it will be available in
Body of Camel Exchange.
Did you try that?

On Tue, Nov 4, 2014 at 11:57 AM, smilevasu6 <sr...@gmail.com>
wrote:

> Thanks Claus Ibsen for quick reply.
>
> I already tried those links but it could not worked.
>
> And that is for Insertion.
>
> I am looking for select.
>
> Is there any example for the same start to end.
>
> Please.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758487.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel - JDBC

Posted by smilevasu6 <sr...@gmail.com>.
Nov 05, 2014 8:47:08 AM
org.springframework.context.support.AbstractApplicationContext
prepareRefresh
INFO: Refreshing
org.springframework.context.support.FileSystemXmlApplicationContext@586f14d6:
startup date [Wed Nov 05 08:47:08 IST 2014]; root of context hierarchy
Nov 05, 2014 8:47:08 AM
org.springframework.beans.factory.xml.XmlBeanDefinitionReader
loadBeanDefinitions
INFO: Loading XML bean definitions from file
[D:\BigData\camel-example-sql\META-INF\spring\camel-context.xml]
Nov 05, 2014 8:47:08 AM
org.apache.camel.spring.handler.CamelNamespaceHandler init
INFO: camel-osgi.jar/camel-spring-osgi.jar not detected in classpath
Exception in thread "main"
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to
create the JAXB binder; nested exception is javax.xml.bind.JAXBException:
Provider com.sun.xml.internal.bind.v2.ContextFactory could not be
instantiated:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
Class has two properties of the same name "outputs"
	this problem is related to the following location:
		at public java.util.List
org.apache.camel.model.ResequenceDefinition.getOutputs()
		at org.apache.camel.model.ResequenceDefinition
	this problem is related to the following location:
		at private java.util.List
org.apache.camel.model.ResequenceDefinition.outputs
		at org.apache.camel.model.ResequenceDefinition

 - with linked exception:
[com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
Class has two properties of the same name "outputs"
	this problem is related to the following location:
		at public java.util.List
org.apache.camel.model.ResequenceDefinition.getOutputs()
		at org.apache.camel.model.ResequenceDefinition
	this problem is related to the following location:
		at private java.util.List
org.apache.camel.model.ResequenceDefinition.outputs
		at org.apache.camel.model.ResequenceDefinition
]
	at
org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:247)
	at
org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:85)
	at
org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:59)
	at
org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
	at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
	at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
	at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
	at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:126)
	at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:92)
	at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
	at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:465)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:395)
	at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:140)
	at
org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:84)
	at org.apache.camel.example.sql.App.main(App.java:16)
Caused by: javax.xml.bind.JAXBException: Provider
com.sun.xml.internal.bind.v2.ContextFactory could not be instantiated:
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
Class has two properties of the same name "outputs"
	this problem is related to the following location:
		at public java.util.List
org.apache.camel.model.ResequenceDefinition.getOutputs()
		at org.apache.camel.model.ResequenceDefinition
	this problem is related to the following location:
		at private java.util.List
org.apache.camel.model.ResequenceDefinition.outputs
		at org.apache.camel.model.ResequenceDefinition

 - with linked exception:
[com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts
of IllegalAnnotationExceptions
Class has two properties of the same name "outputs"
	this problem is related to the following location:
		at public java.util.List
org.apache.camel.model.ResequenceDefinition.getOutputs()
		at org.apache.camel.model.ResequenceDefinition
	this problem is related to the following location:
		at private java.util.List
org.apache.camel.model.ResequenceDefinition.outputs
		at org.apache.camel.model.ResequenceDefinition
]
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:347)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394)
	at
org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext(CamelNamespaceHandler.java:180)
	at
org.apache.camel.spring.handler.CamelNamespaceHandler.getJaxbContext(CamelNamespaceHandler.java:167)
	at
org.apache.camel.spring.handler.CamelNamespaceHandler$CamelContextBeanDefinitionParser.doParse(CamelNamespaceHandler.java:245)
	... 23 more
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException:
1 counts of IllegalAnnotationExceptions
Class has two properties of the same name "outputs"
	this problem is related to the following location:
		at public java.util.List
org.apache.camel.model.ResequenceDefinition.getOutputs()
		at org.apache.camel.model.ResequenceDefinition
	this problem is related to the following location:
		at private java.util.List
org.apache.camel.model.ResequenceDefinition.outputs
		at org.apache.camel.model.ResequenceDefinition

	at
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
	at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:450)
	at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:282)
	at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:125)
	at
com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1147)
	at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130)
	at
com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:221)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:172)
	at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:132)
	... 29 more






This was i am getting error






--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758517.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - JDBC

Posted by smilevasu6 <sr...@gmail.com>.
Yes i tried that same. But when i trying to execute the program it returns
some errors.

Please tell whats going wrong? 

Note: My database port is 1552.

Source code i am running and error i am getting



sql.properties
<http://camel.465427.n5.nabble.com/file/n5758515/sql.properties>  
OrderBean.java
<http://camel.465427.n5.nabble.com/file/n5758515/OrderBean.java>  
MyCamel.xml <http://camel.465427.n5.nabble.com/file/n5758515/MyCamel.xml>  
Error.txt <http://camel.465427.n5.nabble.com/file/n5758515/Error.txt>  



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758515.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - JDBC

Posted by Christian Müller <ch...@gmail.com>.
http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642

On Tue, Nov 4, 2014 at 7:47 AM, smilevasu6 <sr...@gmail.com>
wrote:

> Claus Ibsen, if i write these configuration xml files in eclipse (i am
> using)
> how can i run these from eclipse as there is no Java class to call these.
>
> Could you please help?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758488.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Camel - JDBC

Posted by smilevasu6 <sr...@gmail.com>.
Claus Ibsen, if i write these configuration xml files in eclipse (i am using)
how can i run these from eclipse as there is no Java class to call these.

Could you please help?



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758488.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - JDBC

Posted by smilevasu6 <sr...@gmail.com>.
Thanks Claus Ibsen for quick reply.

I already tried those links but it could not worked.

And that is for Insertion.

I am looking for select.

Is there any example for the same start to end.

Please.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485p5758487.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel - JDBC

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

There is a camel-sql example at
http://camel.apache.org/sql-example.html

And also a similar example using MyBatis instead
http://camel.apache.org/mybatis-example.html

And more examples you can find in the component documentation, and the
unit tests of the components which you can find in the source code.

On Tue, Nov 4, 2014 at 7:15 AM, smilevasu6 <sr...@gmail.com> wrote:
> Hi,
>
> I am very new to camel.
>
> I am trying to establish the oracle connection and fetch the results from
> the Data base like select * from emp.
>
> I have a searched a lot but i couldn't find any solution or any source code
> from scratch.
>
> Can you please help me out.
>
> Regards,
>
> Srinivas T
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-JDBC-tp5758485.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/