You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by vivekrao001 <vi...@gmail.com> on 2015/08/20 14:48:34 UTC

Camel SQL Using JNDI and Connecting to Schema other than default Schema

Hi,

I successfully configured sql component using the following config.

       <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
		<property name="dataSource" ref="dataSource" />
	</bean>
	     
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />
	</bean>

I was able to do write join queries with tables in different schemas.

But if change it to* JNDI using Tomcat the query is not working.*

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/myds" />

*With JNDI, I was only able to connect to default schema in the table.*

I tried using "sql:" which is bean id for SqlComponent and also using
datasourceRef in the query.

Any help would be greatly appreciated.

Thanks,
Vivek.




--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SQL-Using-JNDI-and-Connecting-to-Schema-other-than-default-Schema-tp5770854.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel SQL Using JNDI and Connecting to Schema other than default Schema

Posted by Claus Ibsen <cl...@gmail.com>.
Maybe try as a <bean> as shown here
http://stackoverflow.com/questions/9183321/how-to-use-jndi-datasource-provided-by-tomcat-in-spring

I dont know how jndi-lookup is implemented in spring. But all Camel
does is to ask the spring app context to lookup beans with the name of
the datasource you configure on the sql component or in the camel uri.

If the spring jndi-lookup works different than <bean> then its a
spring limitation.

On Thu, Aug 20, 2015 at 5:34 PM, vivekrao001 <vi...@gmail.com> wrote:
> Is the above problem is a bug or I'm doing it wrong?
>
> Thanks,
> Vivek.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-SQL-Using-JNDI-and-Connecting-to-Schema-other-than-default-Schema-tp5770854p5770860.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2

Re: Camel SQL Using JNDI and Connecting to Schema other than default Schema

Posted by vivekrao001 <vi...@gmail.com>.
Is the above problem is a bug or I'm doing it wrong?

Thanks,
Vivek.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-SQL-Using-JNDI-and-Connecting-to-Schema-other-than-default-Schema-tp5770854p5770860.html
Sent from the Camel - Users mailing list archive at Nabble.com.