You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by METIN ZAVRAK <me...@oksijen.com> on 2004/12/14 16:32:19 UTC

maintaining a database connection pool or a socket connection pool

Hi, 
Is there a way to maintain a database connection pool or a socket 
connection pool within Axis? 
I am developing a GUI which is dummy and don't know what to do except how 
to connect web service. 
The web service, gets the parameters and connects to a database and runs 
queries on tables, prepares results and sends the results back to GUI. 
1 -  How could I return resultSet from a web service? (any code sample?)
2 - Could I maintain a connection pool in order to use existing 
connections? I am using Tomcat as web server and it has its own db 
connection pool but how can I register resource to JNDI? I have to 
maintain two different connection pools (one for mysql and one for oracle) 


Besides, the GUI sends some some commands to web service. 
Web service takes the commands and connects to an application over a 
predefined socket. Get the results from the application and return 
results. 
1 - Can I maintain a socket connection pool for this operation? 

I know web services are stateless but how stateless they are? 
Thanks
======================
Metin ZAVRAK
Yazılım Geliştirme Mühendisi
Oksijen Teknoloji 

0 543 502 03 63
metin.zavrak@oksijen.com
======================
Verba volent, scripta manent.
(Söz uçar, yazı kalır).

Re: maintaining a database connection pool or a socket connection pool

Posted by Joe Plautz <jo...@customcall.com>.
In tomcat's documentation you can find all that you need for connection 
pooling. I don't know of any restrictions on pools, but I have at least 
10 going right now.

look here:

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

Joe

METIN ZAVRAK wrote:
> 
> Hi,
> Is there a way to maintain a database connection pool or a socket 
> connection pool within Axis?
> I am developing a GUI which is dummy and don't know what to do except 
> how to connect web service.
> The web service, gets the parameters and connects to a database and runs 
> queries on tables, prepares results and sends the results back to GUI.
> 1 -  How could I return resultSet from a web service? (any code sample?)
> 2 - Could I maintain a connection pool in order to use existing 
> connections? I am using Tomcat as web server and it has its own db 
> connection pool but how can I register resource to JNDI? I have to 
> maintain two different connection pools (one for mysql and one for oracle)
> 
> Besides, the GUI sends some some commands to web service.
> Web service takes the commands and connects to an application over a 
> predefined socket. Get the results from the application and return results.
> 1 - Can I maintain a socket connection pool for this operation?
> 
> I know web services are stateless but how stateless they are?
> Thanks
> ======================
> Metin ZAVRAK
> Yazılım Geliştirme Mühendisi
> Oksijen Teknoloji
> 
> 0 543 502 03 63
> metin.zavrak@oksijen.com
> ======================
> Verba volent, scripta manent.
> (Söz uçar, yazı kalır).

Re: maintaining a database connection pool or a socket connection pool

Posted by Lyndon Tiu <lt...@alumni.sfu.ca>.
METIN ZAVRAK wrote:

>
> Hi,
> Is there a way to maintain a database connection pool or a socket 
> connection pool within Axis?

> 2 - Could I maintain a connection pool in order to use existing 
> connections? I am using Tomcat as web server and it has its own db 
> connection pool but how can I register resource to JNDI? I have to 
> maintain two different connection pools (one for mysql and one for 
> oracle)
>

In your webapps' META-INF/context.xml (Oracle):

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="D:\<TOMCAT_HOME>\webapp" path="/axis_app" 
reloadable="true">
  <Resource name="jdbc/xdb" scope="Shareable" type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/xdb">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <!-- DBCP database connection settings -->
    <parameter>
      <name>url</name>
      <value>jdbc:oracle:thin:@192.168.0.1:1521:ORA_SID</value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
      <name>username</name>
      <value>dbuser</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>dbpass</value>
    </parameter>
    <!-- DBCP connection pooling options -->
    <parameter>
      <name>maxWait</name>
      <value>3000</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>100</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>10</value>
    </parameter>
  </ResourceParams>
</Context>



Make sure the Oracle JDBC jar file ( ojdbc14_g.jar ) is located under:

<TOMCAT_HOME>/common/endorsed


--
Lyndon Tiu