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).]
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
ARS Kumar, Sun Certified Programmer for Java 2 Platform
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).
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).]
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");