Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 6th, 2003, 10:01 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default connecting to oracle

hi,

i'm fairly new to java. i'm trying to connect to an oracle database but it's giving me the following error:

C:\JSPTests>java RPASelect
ClassNotFoundException: oracle.jdbc.driver.OracleDriver
SQLException: No suitable driver

i have j2sdk1.4 installed on my Windows NT 2000. i don't have any oracle installed on my machine. i'm basically connected to our office network. i'm not the oracle admin. i also read about the classes111.zip but i don't know if it applies to me since i'm not running oracle on my local machine. i also trying running the same code connecting to MS Access (changing what i need to change) and i get results. however, when i try modify the program to connect to oracle. i get the message above. what am i doing wrong? thanks for any help. i'm also using "thin".

here's the code i'm using:

import java.sql.*;
import java.util.*;
import java.awt.*;

public class RPASelect {
public static void main(String args[]) {
String url = "jdbc:oracle:thin:@nnnn:nnn:nnnnn";
Connection con;
String queryString;
queryString = "select * from RPA_RESOURCE where RPA_RESOURCE.COLCD = '**'";

Statement stmt;
ResultSet rs;

try {
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
//Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("JDBC driver loaded");
}
catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}

try {
con = DriverManager.getConnection(url, "myID", "myPass");
stmt = con.createStatement();
rs = stmt.executeQuery(queryString);
while (rs.next())
out.println(rs.getString(1));
stmt.close();
con.close();
}
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}

I've read some people said I need to download classes111.zip or jbdc14.jar from www.oracle.com. Is this applicable to my setup which I describe above? If in fact I need it, where to I install the file on my PC? Which one to I really need (classes111.zip or jbdc14.jar)? I'm getting confused. Please advise. Thank you in advance.

Paul


 
Old August 12th, 2003, 12:08 PM
Authorized User
 
Join Date: Jul 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

got this one to work. i downloaded jbdc14.jar and modified my classpath..

 
Old September 20th, 2003, 05:17 PM
Registered User
 
Join Date: Sep 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to yasir_lahham
Default

I'm using classes11.zip and it's working perfectly, just download it, and modify your classpath in the system environment to include it (for example c:\classes.zip), or if you're doing a web-application put it in the "WEB-INF/lib" directory and thats all, notice that in some cases you might have to rename the file to classes.jar.

MHD Yasir Al-lahham





Similar Threads
Thread Thread Starter Forum Replies Last Post
Connecting to oracle from PHP paragajoshi PHP Databases 2 November 16th, 2011 05:26 PM
Connecting to Oracle with PHP atcs2152 PHP Databases 0 December 16th, 2005 08:57 AM
Connecting to Oracle without Oracle Client mahaveerar VB Databases Basics 0 February 22nd, 2005 05:18 PM
Connecting to Oracle without Oracle Client mahaveerar Excel VBA 0 February 22nd, 2005 03:55 PM
Connecting an oracle database kelitu Oracle 0 September 4th, 2003 09:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.