Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Setting the jdbc classpath variable for 10g on Java 1.4.2 ( Windows XP Pro )

Re: Setting the jdbc classpath variable for 10g on Java 1.4.2 ( Windows XP Pro )

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 11 Feb 2005 05:04:35 -0800
Message-ID: <1108125598.398750.18760@c13g2000cwb.googlegroups.com>

Jean-Benoit MORLA wrote:
> Hi
> I'm trying to compile this source from Oracle JDBC manuel:
> // JDBCVersion.java
> // get the Jdbc version from the database connexion
>
> 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:scott/tiger_at_host:port/service");
> Connection conn = ods.getConnection();
> // Create Oracle DatabaseMetaData object
> DatabaseMetaData meta = conn.getMetaData();
> // gets driver info:
> System.out.println("JDBC driver version is " +
> meta.getDriverVersion());
> }
>
> }
>
> I get the compiler errors:
> Package jdbc does not exist
> Package jdbc.pool does not exist.
>
> I have set the CLASSPATH variable to:
> ORACLE_HOME\jdbc\lib\ojdbc14.jar;ORACLE_HOME\jdbc\lib\orai18n.jar
> as stated in page 2-3 from the Oracle JDBC manual.
> My java install is in
> f:\j2sdk_1_4_2_04
> I put this directory first in the PATH variable to avoid the Oracle
> java compiler which is older.
> Maybe I need other more recent jdbc jar files for this version of
> Java?
> Many thanks for your reply.
> jbmorla_at_tiscali.fr

Must be something with your classpath or jdk version. I tested your code on an XP SP1. I am using jdk 1.4.2_02. Here is the screen dump,

C:\JavaDev\test\test>set classpath
CLASSPATH=.;C:\oracle\ora101\jdbc\lib\ojdbc14.jar;C:\oracle\ora101\jdbc\lib\nls_charset12.jar;C:\oracle\ora92\jdbc\ lib\ojdbc14.jar;C:\oracle\ora92\jdbc\lib\nls_charset12.jar;C:\j2sdk1.4.2_02\jre\lib\rt.jar;C:\j2sdk1.4.2_02\jre\lib\c harsets.jar;C:\j2sdk1.4.2_02\jre\lib\jce.jar;C:\j2sdk1.4.2_02\jre\lib\jsse.jar;C:\j2sdk1.4.2_02\jre\lib\plugin.jar;C: \j2sdk1.4.2_02\jre\lib\sunrsasign.jar

C:\JavaDev\test\test>javac Test.java

C:\JavaDev\test\test>java Test
JDBC driver version is 10.1.0.2.0

C:\JavaDev\test\test>

Regards
/Rauf Received on Fri Feb 11 2005 - 07:04:35 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US