|
|
|
|
|
|
| Author |
Message |
Rauf Sarwar *nix forums Guru
Joined: 03 May 2005
Posts: 353
|
Posted: Fri Feb 11, 2005 12:04 pm Post subject:
Re: Setting the jdbc classpath variable for 10g on Java 1.4.2 ( Windows XP Pro )
|
|
|
Jean-Benoit MORLA wrote:
| Quote: | 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@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@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 |
|
| Back to top |
|
 |
Jean-Benoit MORLA *nix forums beginner
Joined: 11 Feb 2005
Posts: 4
|
Posted: Fri Feb 11, 2005 9:28 am Post subject:
Setting the jdbc classpath variable for 10g on Java 1.4.2 ( Windows XP Pro )
|
|
|
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@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@tiscali.fr |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 1:57 am | All times are GMT
|
|
Loans | Car Loan | Credit Card Consolidation | Lingerie | Myspace Images
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|