If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > Oracle Java OCI and Thin

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-20-07, 06:30
adnanyounus adnanyounus is offline
Registered User
 
Join Date: Nov 2007
Posts: 5
Oracle Java OCI and Thin

people say oci drivers are platform dependent jdbc thin are independent..im a lil confused..
im new to java n was working on .net previosuly....

ive only downloaded this ojdbc14.jar and working for both OCI and thin...so where the platform dependent part comes in...?? is it the oracle client installation which is platform dependent? in any case my application will remain platform independent, only the installation of oracle client services will vary; i wont have to change my data access libraries.. am i right?

for oci we need to install oracle client..i might be doing some thing wrong here..but ive totally deleted/renamed my tnsnames file n still able to connect to oracle on a different server using OCI ...
"jdbc:oracle:oci:@192.168.60.214:1521:[SID]"

i do have oracle client installed...but does it mean i need not configure the net8 service and can directly talk to oracle using ip port and sid???

one last question; does jdbc thin has implicit pooling functionality like oracle oci?? i c the pooled datasource but there aint a straight fwd implementation wher i just initialize the pool of connections n issue get connection command like in OCI....

Last edited by adnanyounus; 11-20-07 at 07:22.
Reply With Quote
  #2 (permalink)  
Old 11-20-07, 11:53
adnanyounus adnanyounus is offline
Registered User
 
Join Date: Nov 2007
Posts: 5
phuffff...this java is getting on my nerves....ihad to implement pooling for teh first time in dotNet like yrs ago...i looked at msdn great articles and explanations...it was implemented, bulk tested on oracle n sql server in no time and code went live few days later.... but i really cant find such basic thing straight fwd way in java...evry ones pouring evry thing in and ive found like 10 ways to implement pooling not a sinlge one is clean n straigh forward...or do i have to re invent the wheel and implement a pooling class my self....

here is what i found for thin client jdbc oracle..

OracleConnectionPoolDataSource ocpds = new OracleConnectionPoolDataSource();
ocpds.setURL("jdbcracle:thin:@[IP]:1521:[SID]");
ocpds.setUser("usr");
ocpds.setPassword("pwd");

PooledConnection pc = ocpds.getPooledConnection(); //Which pool what pool, did i specify any pool ,whtas the pool size yes default is 0 how can i change it. no //documentation at all

Connection con = pc.getConnection();

...do something...

con.Close();

----QUESTIONS NOT ANSWERED IN DOCUMENTATION ;NO DETAILED EXPLAINATION OF WHATS GOING ON IN THESE CLASSES-- GOOGLED IT AS WELL---

Q1 - How can i set the initial pool size, the max pool size and the connection wait time if all connections r busy; i tried to set connection cache enable true and the cache property but getting exception
"Connection Caching Not Enabled or Not a Valid Cache Enabled DataSource"; didnt find any answer for this

Q2 The OracleConnectionCacheImpl is deprecated n lots of example use this class so i guess they r all void now?

Q3 How do i return a connection back to a pool; Con.close would return it?

Q4 Some example say call con.close and then pool.close which closes the physical connection so whts the use of pooling then ??

please provide a simple sstright fwd way for oracle thin client connection pooling ; i chkd the OCI n it has good simple features...

Last edited by adnanyounus; 11-20-07 at 12:17.
Reply With Quote
  #3 (permalink)  
Old 11-20-07, 13:01
amthomas amthomas is offline
Registered User
 
Join Date: May 2005
Location: San Antonio, Texas
Posts: 134
I can't help you to much since I haven't messed around with pooling.

have you tried c3p0? http://sourceforge.net/project/downloading.php

I just downloaded it and checked and it has documentation with it on the download that looks decent. I use hibernate so I have about 5 config lines and dropped in the library and haven't looked at it since

I have no worked with oracle so I am not sure about the oracle drivers for jdbc. jdbc offers some abstraction but you can always write specific queries that only work with a specific db I am not sure what is going on in your first post though. java and its acronyms are a confusing forest of doom to me still.
__________________
Vi veri veniversum vivus vici
By the power of truth, I, a living man, have conquered the universe
Reply With Quote
  #4 (permalink)  
Old 11-21-07, 04:18
adnanyounus adnanyounus is offline
Registered User
 
Join Date: Nov 2007
Posts: 5
nops didnt try it..will try n let u know....
Reply With Quote
  #5 (permalink)  
Old 11-21-07, 06:12
adnanyounus adnanyounus is offline
Registered User
 
Join Date: Nov 2007
Posts: 5
Every time i issue a PooledConnection pc = ocpds.getPooledConnection(); a new session is created in oracle v$session; although i issue a con.close commond which shud return back the connection to the pool; and after some time the connections in the session gets cleared(clean up i suppose);
any ways my search for pooling in java goes on..atleast it will help in understanding java a lil bit more....working in java one feels he's back in univ
Reply With Quote
  #6 (permalink)  
Old 11-21-07, 07:01
adnanyounus adnanyounus is offline
Registered User
 
Join Date: Nov 2007
Posts: 5
GREAT..FINALLY got it working.....heres the way...
as if it was so obvious i found this link http://www-1.ibm.com/support/docview...27010723&aid=1 in a ppt in an IBM website saying

Oracle 10g JDBC driver connection pooling requires the use of the
OracleDataSource.
– Attempt to use the OracleConnectionPoolDataSource results in:
java.sql.SQLException: Connection Caching Not Enabled or Not a Valid Cache Enabled DataSource

i used that n it works....

so is it an easter egg or what that OracleConnectionPoolDataSource doesnt work with 10g; http://rakeshv.org/docs/oracle/jdbc3...ataSource.html
this is the documentation for 10g jdbc.....no where to be seen that theres some problem n the pool thing that doesnt work with 10g....

ppl thinking to switch to dotNet please do...i so badly want to return to dotNEt after working 1 yr in java and 5 yrs of dotNet...java is good example or 2 many cooks spoil the broth....u can c my frustration ...apologies if any one hurt...my problem is solved ...

thank u evry java guru for helping me...

SUN ...please do some decent documentation ....
Reply With Quote
  #7 (permalink)  
Old 11-26-07, 14:29
amthomas amthomas is offline
Registered User
 
Join Date: May 2005
Location: San Antonio, Texas
Posts: 134
I would blame the drive folks for that one.. not SUN/JAVA. well.. unless they wrote the driver :P

my expectation of java stops at the jdbc boundry.. they have an abstraction layer that is very beneficial for programmers.
__________________
Vi veri veniversum vivus vici
By the power of truth, I, a living man, have conquered the universe
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On