Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: JDBC java drivers + Oracle 8.1.7 + Red Hat 7.0
Thanks Cindy, I went ahead and unzipped the classes111.zip into the current
folder with my script, and the
Oracle driver was able to load!
However now I am getting a different error:
Exception in thread "main" java.sql.SQLException: Invalid Sytnax or Database name is null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274) at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:225) at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:252) at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:177) at QueryExample.main(QueryExample.java:13)
I am just executing a select statement on the default EMP table with the scott / tiger permissions (I can run the sql statment no problem within sqlplus).
I normally use Perl and perl DBI for databases, and I am new to Java and
JDBC for
database access. If anyone knows what small little configuration I need to
do, or what I may be doing wrong
please let me know. I've run some searches on google and Oracle and have
come up empty so far.
Many Many thanks,
Simon
here's the java code:
class QueryExample
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
Connection conn =
DriverManager.getConnection ("jdbc:oracle:oci8:", "scott", "tiger");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
while (rset.next ())
System.out.println (rset.getString (1));
}
}
"C. Ferguson" <c_ferguson_at_rationalconcepts.com> wrote in message news:3B66FDEF.C05872E2_at_rationalconcepts.com... Hi,
try using the direct path to the oracle driver in your classpath option.
Also, you should include the current directory in the classpath option so
that your class file and any other supporting classes of yours will be
found.
e.g. java -classpath .:/export/opt/oracle/jdbc/lib/classes111.zip yourclass
where . tells java to look in your current directory, : separates the
different places you want java to search for required classes.
hth,
cindy
sdang wrote:
Hi, I am a newbie and trying to run the JdbcCheckup.java file included in
the samples and am getting the following error:
Exception in thread "main" java.lang.NoClassDefFoundError:
oracle/jdbc/driver/OracleDriver
at JdbcCheckup.main(JdbcCheckup.java:13)
I added to the Classpath: CLASSPATH:$oracle_home/jdbc/lib/classes111.zip
and compiled without any problems, but excuting the code (i.e. java
JdbcCheckup) gives me the above error.
I have also tried compiling and executing with the class path flags:
javac -cp $oracle_home/jdbc/lib/classes111.zip JdbcCheckup.java (no error)
java -classpath $oracle_home/jdbc/lib/classes111.zip (get above error)
Many thanks if you have any suggestions to put me on the right track.
-Simon
I am using:
. ~/.bashrc
fi
export ORACLE_BASE=/db/u01/app/oracle
export ORACLE_HOME=/db/u01/oracle/product/8.1.7
export LD_LIBRARY_PATH=$ORACLE_HOME/jdbc/lib
export ORACLE_SID=ORA1
export ORACLE_TERM=ansi
export
PATH=$PATH:$ORACLE_HOME/bin:/usr/java/jdk1.3.1/bin:/usr/local/java/bin:/usr/
local/java/lib:/usr/java/jdk1.3.1/lib/tools.jar
export PATH=$PATH:usr/local/bin
export ORACLE_OWNER=oracle
TMPDIR=/var/tmp
export PATH TMPDIR
export CLASSPATH=/db/u01/oracle/product/8.1.7/jdbc/lib/classes111.zip
umask 022
ulimit -s 2048
#User specific environment and startup programs
PATH=$PATH:$HOME/bin
BASH_ENV=$HOME/.bashrc
export USERNAME BASH_ENV PATH ____________________________________________________________________________ ________________________Received on Tue Jul 31 2001 - 16:45:02 CDT
![]() |
![]() |