wood burning stoves 2.0*
The moose likes JDBC and the fly likes Connecting to Oracle from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting to Oracle from Java" Watch "Connecting to Oracle from Java" New topic
Author

Connecting to Oracle from Java

Rajesh Agarwal
Ranch Hand

Joined: Aug 01, 2005
Posts: 79
Hi All, I am hosting a application which is runnind well on a Unix Dev region to my own local PC. Also the appserver in dev is websphere, but I am now hosting it on Weblogic. I am getting DB connection error as follows. Help is appreciated.

The system uses these 2 classes

import oracle.jdbc.pool.OracleConnectionCacheImpl;
import oracle.jdbc.pool.OracleConnectionPoolDataSource;


and sets all the database properties reading them from a property file as below.

if(datastoreProp == null)
datastoreProp = new PersistenceProperties(s, s1);
if(ocpds == null)
{
DBSCHEMA = datastoreProp.getProperty("DBSchema");
ocpds = new OracleConnectionPoolDataSource();
ocpds.(datastoreProp.getProperty("DBURL"));
ocpds.setUser(datastoreProp.getProperty("ORACLE_ID"));
ocpds.setPassword(datastoreProp.getProperty("ORACLE_PASSWORD"));
ocpds.setNetworkProtocol(datastoreProp.getProperty("Protocol"));
if(occi == null)
{
occi = new OracleConnectionCacheImpl(ocpds);
occi.setMinLimit((new Integer(datastoreProp.getProperty("MinLimit"))).intValue());
int i = occi.getMinLimit();
int j = (new Integer(datastoreProp.getProperty("MaxLimit"))).intValue();
if(i > j)
j = i;
occi.setMaxLimit(j);
occi.setCacheScheme(1);
}
}


I am not able to connect to the db using the above. My doubt is do I need to set any Datasource in weblogic. if Yes then what would be the Datasource Name, I dont see any name being used in the code.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

Originally posted by Rajesh Agarwal:
I am getting DB connection error as follows.

I see the code, but not the message in your post.


ocpds. (datastoreProp.getProperty("DBURL"));

I think there was a copy/paste error. The above line doesn't even compile. Can you fill in the blank on this one. I don't want to assume anything since it is such an important line.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connecting to Oracle from Java