You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by widlcat20 <sa...@gmail.com> on 2015/08/20 23:30:48 UTC

JNDI look up from Tomcat Context.xml for camel sql component

Hi,

I have a requirement to read datasource from Tomcat's context.xml using
spring jndi and using camel sql component.

my context.xml has below configuraiton
<Resource name="jdbc/TESTDEV" auth="Container" type="javax.sql.DataSource"
                                driverClassName="com.ibm.db2.jcc.DB2Driver"
                               
url="jdbc:db2://hostname:portname/databasename"
                                password="fidus3r" 
                                username="prof"
                                maxActive="20"
                                maxIdle="10"
                                maxWait="30000"
			....
                        .......
                                
    />

	 <bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName" value="java:comp/env/jdbc/TESTDEV" />
	</bean>  

<routeContext id="id" xmlns="http://camel.apache.org/schema/spring">
		<route id="routename" startupOrder="4">
			<from uri="{{route.in}}" />
			<to
				uri="sql:SELECT * FROM schema.table" />
			
			...

		</route>
	</routeContext>


but whenever i am hitting the db i am getting Caused by:
com.ibm.db2.jcc.am.mo: DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704,

The issue is every time its connecting to DB , its thinking that the table
is in default schema and throws the above error.I am not able to choose a
different schema other than default schema.

Can anyone please help me here to use jndi to use custom database schema for
camel SQL component



--
View this message in context: http://camel.465427.n5.nabble.com/JNDI-look-up-from-Tomcat-Context-xml-for-camel-sql-component-tp5770868.html
Sent from the Camel Development mailing list archive at Nabble.com.