473,774 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JDBC driver problem

Hello,

my Java-program can't load the JDBC driver.
I always get a java.lang.NoCla ssDefFoundError when I run it.

The JDBC Driver is in the directory: C:\programs\ora 92\jdbc\lib

I think I have to set ORACLE_HOME environment variable and CLASSPATH,
but I have no idea how ?????????

Thanks

Axel
--------------------------------------------------
program:

import java.sql.*;

class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.r egisterDriver(n ew oracle.jdbc.dri ver.OracleDrive r());

// Connect to the database
// You can put a database name after the @ sign in the connection URL.
Connection conn =
DriverManager.g etConnection
("jdbc:oracle:o ci8:@axel-0560nntbn1:1521 :oracle", "scott", "tiger");

// Create a Statement
Statement stmt = conn.createStat ement ();

// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQue ry ("select ENAME from EMP");

// Iterate through the result and print the employee names
while (rset.next ())
System.out.prin tln (rset.getString (1));

// Close the RseultSet
rset.close();

// Close the Statement
stmt.close();

// Close the connection
conn.close();
}
}
Jul 19 '05 #1
1 7085
ad*******@web.d e (Axel Dachtler) wrote in message news:<d6******* *************** ****@posting.go ogle.com>...
Hello,

my Java-program can't load the JDBC driver.
I always get a java.lang.NoCla ssDefFoundError when I run it.

The JDBC Driver is in the directory: C:\programs\ora 92\jdbc\lib

I think I have to set ORACLE_HOME environment variable and CLASSPATH,
You don't need ORACLE_HOME. To set CLASSPATH type in the same command session
where you want to execure java program:

SET CLASSPATH=C:\pr ograms\ora92\jd bc\lib\classes1 2.zip

If CLASSPATH is set already (check it with "echo %CLASSPATH%" command)
use:
SET CLASSPATH=%CLAS SPATH%;C:\progr ams\ora92\jdbc\ lib\classes12.z ip

Make sure you use correct name of the driver file.
but I have no idea how ?????????

Thanks

Axel
--------------------------------------------------
program:

import java.sql.*;

class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.r egisterDriver(n ew oracle.jdbc.dri ver.OracleDrive r());

// Connect to the database
// You can put a database name after the @ sign in the connection URL.
Connection conn =
DriverManager.g etConnection
("jdbc:oracle:o ci8:@axel-0560nntbn1:1521 :oracle", "scott", "tiger");

// Create a Statement
Statement stmt = conn.createStat ement ();

// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQue ry ("select ENAME from EMP");

// Iterate through the result and print the employee names
while (rset.next ())
System.out.prin tln (rset.getString (1));

// Close the RseultSet
rset.close();

// Close the Statement
stmt.close();

// Close the connection
conn.close();
}
}

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4495
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web Server 6.1 with the SQL Server 2000 JDBC Driver. The background: 1. I have downloaded the SQL Server 2000 JDBC Driver and installed it on the web server.
0
2269
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which was working fine until a while ago. I haven't watched it recently, and haven't changed anything I am aware off right now. After I realized the problem I tried many 3.08 versions with the same symptom. Watch were it says "Unknown system variable...
4
6348
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We found that it was shifted three Bytes to the left, i.e. 4 becomes hex 4000000 which is 67108864 in decimal base. This means that the value written and the value read sometimes do not match, which is of course inacceptable for all real world...
0
3083
by: Bing | last post by:
Hi, I am configuring the same DB2 v8.1 JDBC universal driver (db2jcc.jar and db2jcc_license_cisuz.jar) from DB2 SP5 fix pack under WSAD 5.1.x environment and WebSphere application Server 5.0.2 on Windows 2000 machines. I configured a connection pool data source using type 4 for a local test environment in WSAD 5.1.x, and a connection pool data source on the WebSphere Server too. Both data sources are accessing the same database.
2
9245
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered problems doing this. I wanted to implemented a generic "Helper" class like this: /** * Helper
3
27060
by: Rakesh | last post by:
Hi, I want to get connection to a DB2 database using the driver COM.ibm.db2.jdbc.DB2XADataSource. I have also included 'db2java.zip' in the classpath. However I am getting the exception java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at Conn.main(Conn.java:44)
4
4153
by: Izak van Langevelde | last post by:
Shocks. Today I came to learn that Suns jdbc-odbc bridge driver isn't meant for serious purposes; it's experimental. I already knew it isn't thread safe, but didn't think of this as problematic for the relatively simple system I'm using it. However, I suspect there are other issues. Currently I'm stuck with a query which takes less than one second if I run it somewhere in my program's main thread, while it takes easily 40 seconds when I...
1
2698
by: tom.eeraerts | last post by:
Hello, I have a problem migrating an application from v5r2 to v5r3. The problem is with the prepared statements. To see what the problem is, i extracted a small piece of code and debugged the application while running it on my local window machine (IBM WSAD) but still connecting to the AS400. For the local debugging I use "com.ibm.as400.access.AS400JDBCDriver"
1
2179
by: raj singh | last post by:
Hi, i am raj singh.I am using type 4 jdbc driver with db2 but its not working its giving the message "required user property not set". the environment variable is set properly with jar files which required for type 4 jdbc driver. if anybody know about this problem pls provide the details. how i can resolve this problem.
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.