You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sh...@CobbEnergy.com on 2007/11/28 18:01:42 UTC

Create New Data Source

Hello list ,
Can someone please tell me how do I test the connectivity from tomcat 
server to oracle database. I am good on Unix/databases but new to Tomcat. 

I have oracle instance named as : lawtst .

lawtest  running at cemcp62 .  (system name)

user name is - sdhotre -password is password .

I see following fields when I click on create data source . Where do the 
above values go or is there an example somewhere that I can follow? 

Data Sources 
Property  Value 
JNDI Name: 
Data Source URL: 
JDBC Driver Class: 
User Name: 
Password: 
Max. Active Connections: 
Max. Idle Connections: 
Max. Wait for Connection: 
Validation Query: 

Thanks 
Shekhar Dhotre.
Unix Admin.
CobbEnergy (Atlanta).
 

Re: Create New Data Source

Posted by Sh...@CobbEnergy.com.
Christopher and Propes  thanks a lot !! 




Christopher Schultz <ch...@christopherschultz.net> 
11/28/2007 12:33 PM
Please respond to
"Tomcat Users List" <us...@tomcat.apache.org>


To
Tomcat Users List <us...@tomcat.apache.org>
cc

Subject
Re: Create New Data Source






-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shekhar,

You might want to start here:

http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations


This page might be helpful for more Oracle questions:
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm

Shekhar.Dhotre@CobbEnergy.com wrote:
> I see following fields when I click on create data source . Where do the 

> above values go or is there an example somewhere that I can follow? 

> User Name:
> Password:

These two should be obvious.

> JNDI Name: 

You get to make this one up. Usually it's something similar to the name
of the database, but you can make it anything you'd like (I recommend
against using / characters in the name, though). Try "lawdb" or
something. This name needs to match the JNDI data source name that your
application is expecting.

> JDBC Driver Class: 

This is the name of the JDBC driver's class. It depends on the driver
you are using for Oracle. Often, it's something like
"oracle.jdbc.driver.OracleDriver".

> Data Source URL: 

This also depends on the driver you are using. The "thin" driver takes
URLs like this:

jdbc:oracle:thin:<username/password>@<database>

For you, this would be:

jdbc:oracle:thin:sdhotre/password@cemcp62:1521:lawtst

                  ^user   ^pass   ^ host  ^ port  ^ SID

> Max. Active Connections: 
> Max. Idle Connections: 
> Max. Wait for Connection: 
> Validation Query:

These depend on what resource allocation and validation you want for
connection pooling. You should read:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations

and
http://commons.apache.org/dbcp/configuration.html

For development and testing, I *always* set maxActive=1, maxIdle=1, and
maxWait=1000 (10 seconds). For Oracle, a good validation query might be
"SELECT 1 FROM DUAL".

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTaZ/9CaO5/Lv0PARAo1AAJ0VG9AvcTBrJ2vQHimRcJ1GRAy3xACfbK+U
/+n1hb2kchfkWkEyZcBIDb8=
=jOZF
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



Re: Create New Data Source

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Shekhar,

You might want to start here:

http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations

This page might be helpful for more Oracle questions:
http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm

Shekhar.Dhotre@CobbEnergy.com wrote:
> I see following fields when I click on create data source . Where do the 
> above values go or is there an example somewhere that I can follow? 

> User Name:
> Password:

These two should be obvious.

> JNDI Name: 

You get to make this one up. Usually it's something similar to the name
of the database, but you can make it anything you'd like (I recommend
against using / characters in the name, though). Try "lawdb" or
something. This name needs to match the JNDI data source name that your
application is expecting.

> JDBC Driver Class: 

This is the name of the JDBC driver's class. It depends on the driver
you are using for Oracle. Often, it's something like
"oracle.jdbc.driver.OracleDriver".

> Data Source URL: 

This also depends on the driver you are using. The "thin" driver takes
URLs like this:

jdbc:oracle:thin:<username/password>@<database>

For you, this would be:

jdbc:oracle:thin:sdhotre/password@cemcp62:1521:lawtst

                  ^user   ^pass   ^ host  ^ port  ^ SID

> Max. Active Connections: 
> Max. Idle Connections: 
> Max. Wait for Connection: 
> Validation Query:

These depend on what resource allocation and validation you want for
connection pooling. You should read:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
and
http://commons.apache.org/dbcp/configuration.html

For development and testing, I *always* set maxActive=1, maxIdle=1, and
maxWait=1000 (10 seconds). For Oracle, a good validation query might be
"SELECT 1 FROM DUAL".

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTaZ/9CaO5/Lv0PARAo1AAJ0VG9AvcTBrJ2vQHimRcJ1GRAy3xACfbK+U
/+n1hb2kchfkWkEyZcBIDb8=
=jOZF
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org