tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <>
Subject Re: Oracle JDBC connection Tomcat 5.5
Date Sun, 13 May 2007 20:00:06 GMT
make sure the driver is ok first e.g.
import java.sql.*;

Properties props = new Properties();
String c_sUserNameKey="username";
String c_sPasswordKey="password";
String c_sDBURL ="jdbc:oracle:thin:@";
String c_sDriverName ="oracle.jdbc.driver.OracleDriver";

//Instantiate driver
Driver c_Driver=null;
   c_Driver = (Driver)Class.forName( c_sDriverName ).newInstance();
catch(SQLException sqle)
 System.out.println("Cannot instantiate driver it right it 
on classpath?");
//make sure Oracle listenet is operational (netstat -a | grep 1521)
//make SURE Oracle DB is up and listening (tnsping SID) returns successful
//make sure you acquire the username/password to establish connection to 
oracle db
//place username,password into properties
props.put( c_sUserNameKey, c_sDBUser );
props.put( c_sPasswordKey, c_sDBPassword );

//Get a connection
    Connection = c_Driver.connect( c_sDBURL, props );
catch ( SQLException sqlex )
            System.out.println( "Error connecting to database", sqlex );

//should get you started..
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Rashmi Rubdi" <>
To: "Tomcat Users List" <>
Sent: Sunday, May 13, 2007 3:23 PM
Subject: Re: Oracle JDBC connection Tomcat 5.5

> On 5/12/07, Zdeněk Vráblík <> wrote:
>> Hi Rashmi,
>> thans for reply.
>> Configuration that is described in link you sent me works fine.
>> Problem is when I change
>> the datasource factory to Oracle datasource factory. Than is not
>> possible to find this datasource through JNDI lookup and this
>> connection disappear from admin console.
>> I think that ojdbc14.jar is newer version of oracle drivers  and it
> You are right, sorry you don't need classes12.jar in this case please
> ignore my previous post.
> I also happen to have oracle 10g, in order to answer your question, I
> was trying to see if I could set up a connection pool and then try to
> get OracleConnection instead of SQL Connection, I tried for almost 1/2
> a day so far, to get things set up but got an error
> "java.sql.SQLException: No more data to read from socket" that is
> taking too long to figure out, even after searching for answers on the
> Internet. I have other things to do :-) so I will give up on this for
> now.
> Anyway, there's some more instructions here :
> the above instructions are written for Oracle9iAS Container and not
> Tomcat, however they demonstrate how to obtain OracleConnection ----
> may be you'll find some useful information there unless someone on
> this list has a solution.
> You may also want to check with Oracle's Technology Forums.
>> works fine with standard datasource factory
>> org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory and
>> javax.sql.DataSource. It stops work when I use oracle datasource
>> factory
>>  factory="oracle.jdbc.pool.OracleDataSourceFactory" and datasource type
>> type="oracle.jdbc.pool.OracleDataSource".
>> What I need is any solution how get OracleConnection instead of
>> Connection to use.
>> Do I miss any parameter in resource configuration?
>> <Resource name="sisPool"
>>            auth="Container"
>>            type="oracle.jdbc.pool.OracleDataSource"
>>            factory="oracle.jdbc.pool.OracleDataSourceFactory"
>>            username="USER_51319"
>>            password="USER_51319"
>>            driverClassName="oracle.jdbc.OracleDriver"
>>            url="jdbc:oracle:thin:@"
>>            maxActive="20" maxIdle="10" maxwait="-1"/>
>> Thanks.
>> Zdenek
> -Regards
> Rashmi

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message