Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Installing Oracle JDBC Thin Driver

joelsFeb 26 2008 — edited Oct 15 2014
Hi,

I am totally not familiar with JDBC. I hope you guys can help me to figure out if my JDBC is installed properly.

I have installed a Oracle Client 10g Rel 1 (10.1.0.3.0), and i have the following files under $ORACLE_HOME/jdbc
================================================================
classes12dms.jar* classes12.zip* ocrs12.jar* ojdbc14dms.jar* ojdbc14.jar*
classes12.jar* nls_charset12.jar* ojdbc14dms_g.jar* ojdbc14_g.jar* orai18n.jar*
================================================================

jdbc/lib> echo $JAVA_HOME
/usr/lib/jvm/java
jdbc/lib> echo $CLASSPATH
/sww/tools/oracle/product/10.1.0/jdbc/lib/ojdbc14.jar:/sww/tools/oracle/product/10.1.0/jdbc/lib/orai18n.jar

I have this code (i got it from oracle doc):
======================================================
import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;

class JDBCVersion
{
public static void main (String args[]) throws SQLException
{
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:hr/hr@myhost:1521:lasdev");
Connection conn = ods.getConnection();

// Create Oracle DatabaseMetaData object
DatabaseMetaData meta = conn.getMetaData();

// gets driver info:
System.out.println("JDBC driver version is " + meta.getDriverVersion());
}
}
================================================================

Compiling
========================
/home/ysusanto> javac JDBCVersion.java
/home/ysusanto> java JDBCVersion
Exception in thread "main" java.lang.NoClassDefFoundError: JDBCVersion
=========================

Can you enlighten me what this error means and how to solve it?
I am running this on SUSE9

Thanks before for any response.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 25 2008
Added on Feb 26 2008
3 comments
3,251 views