You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by atiato <om...@its.ws> on 2013/02/07 15:21:56 UTC

JDBC connection for http hits to Oracle DB ...

Dears ,

I'm using Spring JDBC template and I'm calling DB package for every http hit
to apache camel Jetty server.

the question is : 

will we hit DB using new JDBC connection for every hit ?

or will we using the same JDBC template for all ? I mean use available JDBC
connections in the pool ?

as I already Have 2000 concurrent request to Jetty server if we have new
JDBC connection for every hit then it will be an issue with hitting DB .

the JDBC connection is as below Data Source and I'm passing this Datasource
to Bean and using the JDBC template within that Bean which in turn calls DB
package .

Can u explain How we communicate with DB ?

<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"
/>
		<property name="url" value="jdbc:oracle:thin:@172.24.8.164:1521:TABSTST"
/>
		<property name="username" value="TABS" />
		<property name="password" value="tbstst$172" />
		<property name="maxActive" value="200" />
		<property name="poolPreparedStatements" value="true" />
	</bean>

and I'm passing id oracle-ds as below :

<bean class="st.systor.np.sp.SpImpl" id="myBean">
		<property name="dataSource" ref="oracle-ds" />
		<property name="maps">
			<map>
				<entry key="stage" value="015" />
				<entry key="OperatorCodeID1" value="20" />
				<entry key="OperatorCodeID2" value="10" />
				<entry key="20" value="MTNS" />
				<entry key="10" value="MTNS" />
				<entry key="11" value="SDNI" />
				<entry key="21" value="SDNI" />
				<entry key="12" value="ZAIN" />
				<entry key="22" value="ZAIN" />
				<entry key="92" value="ZAIN" />
				<entry key="42" value="ZAIN" />
			</map>
		</property>
	</bean>



Thanks and appreciate your feedback,

Omar Atia



--
View this message in context: http://camel.465427.n5.nabble.com/JDBC-connection-for-http-hits-to-Oracle-DB-tp5727128.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JDBC connection for http hits to Oracle DB ...

Posted by Henryk Konsek <he...@gmail.com>.
Hi Omar,

> will we hit DB using new JDBC connection for every hit ?
> or will we using the same JDBC template for all ?

First of all your question is not related to Camel. From what you
wrote, I understand that you are using Camel to expose Jetty endpoint.
That implies that database connectivity is beyond the governance of
Camel.

The connection pooling is handled by DataSource, not by the
JdbcTemplate. The latter calls the former without any assumptions
related to connection pooling. If you are using singleton instance of
pooling data source (like DBCP), then your connections to Oracle will
be reused.

Best regards.

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Re: JDBC connection for http hits to Oracle DB ...

Posted by atiato <om...@its.ws>.
Thanks so it will manage everything internally . I think max active spring
parameter will ensure that no more than 200 connection are working
concurrently .

<bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"
/>
		<property name="url" value="jdbc:oracle:thin:@172.24.8.164:1521:TABSTST"
/>
		<property name="username" value="TABS" />
		<property name="password" value="tbstst$172" />
		*<property name="maxActive" value="200" />*		<property
name="poolPreparedStatements" value="true" />
	</bean>



--
View this message in context: http://camel.465427.n5.nabble.com/JDBC-connection-for-http-hits-to-Oracle-DB-tp5727128p5727195.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: JDBC connection for http hits to Oracle DB ...

Posted by Christian Müller <ch...@gmail.com>.
Where is your Camel related question?
As far as I know, the Spring JDBC template will borrow an existing
connection from the database pool for each operation.

Best,
Christian

On Thu, Feb 7, 2013 at 3:21 PM, atiato <om...@its.ws> wrote:

> Dears ,
>
> I'm using Spring JDBC template and I'm calling DB package for every http
> hit
> to apache camel Jetty server.
>
> the question is :
>
> will we hit DB using new JDBC connection for every hit ?
>
> or will we using the same JDBC template for all ? I mean use available JDBC
> connections in the pool ?
>
> as I already Have 2000 concurrent request to Jetty server if we have new
> JDBC connection for every hit then it will be an issue with hitting DB .
>
> the JDBC connection is as below Data Source and I'm passing this Datasource
> to Bean and using the JDBC template within that Bean which in turn calls DB
> package .
>
> Can u explain How we communicate with DB ?
>
> <bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
>                 destroy-method="close">
>                 <property name="driverClassName"
> value="oracle.jdbc.driver.OracleDriver"
> />
>                 <property name="url"
> value="jdbc:oracle:thin:@172.24.8.164:1521:TABSTST"
> />
>                 <property name="username" value="TABS" />
>                 <property name="password" value="tbstst$172" />
>                 <property name="maxActive" value="200" />
>                 <property name="poolPreparedStatements" value="true" />
>         </bean>
>
> and I'm passing id oracle-ds as below :
>
> <bean class="st.systor.np.sp.SpImpl" id="myBean">
>                 <property name="dataSource" ref="oracle-ds" />
>                 <property name="maps">
>                         <map>
>                                 <entry key="stage" value="015" />
>                                 <entry key="OperatorCodeID1" value="20" />
>                                 <entry key="OperatorCodeID2" value="10" />
>                                 <entry key="20" value="MTNS" />
>                                 <entry key="10" value="MTNS" />
>                                 <entry key="11" value="SDNI" />
>                                 <entry key="21" value="SDNI" />
>                                 <entry key="12" value="ZAIN" />
>                                 <entry key="22" value="ZAIN" />
>                                 <entry key="92" value="ZAIN" />
>                                 <entry key="42" value="ZAIN" />
>                         </map>
>                 </property>
>         </bean>
>
>
>
> Thanks and appreciate your feedback,
>
> Omar Atia
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/JDBC-connection-for-http-hits-to-Oracle-DB-tp5727128.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--