Path: news.easynews.com!easynews!hub1.nntpserver.com!xmission!logbridge.uoregon.edu!pln-e!spln!dex!extra.newsguy.com!newsp.newsguy.com!E From: E@E.COM (steve) Newsgroups: comp.databases.oracle.misc Subject: Re: new to jdbc-oracle Date: Thu, 13 Dec 2001 06:18:13 +0800 Organization: http://extra.newsguy.com Lines: 89 Message-ID: <1f4cc0w.1dotexol8juo0N%E@E.COM> References: NNTP-Posting-Host: p-223.newsdawg.com User-Agent: MacSOUP/2.4.6 Xref: easynews comp.databases.oracle.misc:73694 X-Received-Date: Wed, 12 Dec 2001 15:35:12 MST (news.easynews.com) HI, THIS IS WHAT I USE TO START WITH A CONNECTION, use the following to allow u to try different connevction strings etc. don't hardcode. this will make a connection ready to pass quiries to the oracle. User ="EXTERNAL_USER"; Password ="EXTERNAL_USER"; String Site ="192.168.2.1:1521:orcl"; //internal testing public Statement Open_odbc(String Site ,String User,String Password) { Statement stmt=null; try { // open the connection to the database Class.forName ("oracle.jdbc.driver.OracleDriver"); // Connect to the database dbconn = DriverManager.getConnection ("jdbc:oracle:thin:@"+Site ,User,Password); //this is needed dbconn.setAutoCommit(false); stmt = dbconn.createStatement (); } catch (Exception e) { handleError(e); } return stmt; } Rob Zwartjes wrote: > Hai, > I have installed oracle 8.1.6 on linux ( SuSE 7.2) and have trouble > running the script below : > > import java.sql.*; > import oracle.jdbc.driver.*; > > class JDBCVersion > { > public static void main (String args[]) throws SQLException > { > // Load the Oracle JDBC driver > DriverManager.registerDriver > (new oracle.jdbc.driver.OracleDriver()); > Connection conn = DriverManager.getConnection > ("jdbc:oracle:thin:@home:1521:TEST","name","passw"); > > // Create Oracle databaseMetaData object > DatabaseMetaData meta = conn.getMetaData(); > > // get drivers info: > System.out.print("JDBC driver version is " + meta.getDriverVersion()); > } > } > This little script comes from oracle doc A81354-01.pdf. After running : > javac GetDriverVersion.java ( name of the script above ), > chmod u+x GetDriverVersion.java ( to make it a exe ) and > typed GetDriverVersion.java to run it. > The only thing I get is a fat cross in my console window. Nothing else. > The values after the @ sign I retrieved from tnsnames.ora because I > didn't know what else to fill in for host, port and sid. Changing thin to > oci8 and putting after the @ sign TEST.ROB.NL ( from tnsnames.ora) > didn't solve my problem. Classpath has been set btw. And for the oci8 > the LD_LIBRARY_PATH > What am I forgetting ????? or overlooking ??? > > Thanks in advance for your time, > > Rob