• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JDBC using Oracle with Servlets

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to access a database from Oracle through servlets.
I have a Oracle ODBC Driver in my ODBC32 , if I Add that driver it doesn't ask me for DSN, Description and a Database directory as I get in MS Access. I have given class and getconnection statements like below
Class.forName("oracle.jdbc.driver.Oracle ODBC Driver");
con=DriverManager.getConnection("jdbc racle:thin:cc939767-a:8080:ORCL","","");
I created a table with Oracle 8i . What else do I need?
Do I have to download some other driver ?
In getconnection I have given my computer name(cc939767-a:8080)and the port , is it correct?
Please help me with this .............

thanks
sah devine

[This message has been edited by Sah Devine (edited October 12, 2000).]
 
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess for Oracle you have to use the JDBC driver ( not the ODBC:JDBC driver ). You can get this from Oracle web site.
I am NOT sure this is the ONLY solution, but when I coded my servlet to connect to Oracle 8i I have used the JDBC driver.
Regards
ARSKumar
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your URL is wrong:


con=DriverManager.getConnection("jdbc racle:thin:cc939767-a:8080:ORCL","","");


and should read
con=DriverManager.getConnection("jdbc racle:thin:@cc939767-a:8080:ORCL","","");
and most likely the port should be 1521 and not 8080, as this is the port used by Oracle, not the webserver or HTTP proxy.
And you indeed need the JDBC driver, version 8.1.6 or later (classes12.zip or newer).
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to find 'classes11.zip'. This file contains the oracle thin client drivers for jdk ver 1.2. Add this file to you CLASSPATH.
In you program... add the following code.
// localhost is ip address of host name
// portname is most often 1521
// sid or system id
// UID is user id
// PWD is password
String url = "jdbc racle:thin:@localhost :portname:sid";
con = DriverManager.getConnection(url, "UID", "PWD");
Hope this helps
p.s. There is more than one way to code the url for oracle THIN and OCI jdbc drivers. This URL format has work for me...
------------------
We learn more from our mistake's than from our success's.
[This message has been edited by Monty Ireland (edited October 13, 2000).]
[This message has been edited by Monty Ireland (edited October 13, 2000).]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
download the thin drivers from the url : http://technet.oracle.com/software/tech/java/sqlj_jdbc/software_index.htm
and the code should be in the connection part should be
Class.forName("oracle.jdbc.driver.OracleDriver");
//(jdbc racle:thin:@systemname ort:sid withrespectto oracle);
conn = DriverManager.getConnection("jdbc racle:thin:@intranet:1521 racle","scott","tiger");

it will work.
------------------
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic