Note that there are some explanatory texts on larger screens.

plurals
  1. POFresh install of JDBC for Oracle - does not execute
    primarykey
    data
    text
    <p>This is my first attempt to connect to an Oracle DB (10g) using JDBC. I have JDK 6 installed on my machine and trying to connect to an Oracle DB on a server. I have downloaded <strong>ojdbc6.jar</strong> and copied it to <strong>C:\oracle\product\10.2.0\client_1\jdbc\lib</strong>.</p> <p>I have also set the following CLASS PATH:</p> <pre><code>.; C:\; C:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc6.jar; C:\oracle\product\10.2.0\client_1\jlib\orai18n.jar; C:\Program Files\QuickTime\QTSystem\QTJava.zip </code></pre> <p>The following code gets compiled, however when I try to run the class file, it throws an error </p> <pre><code>C:\&gt;java JDBCVersion java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at JDBCVersion.main(JDBCVersion.java:10) </code></pre> <p>I save my .java files in C:\ to compile and run from this directory.</p> <pre><code>import java.io.*; import java.sql.*; class JDBCVersion { public static void main (String args[]) throws SQLException{ try{ Connection con=null; Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection( "jdbc:oracle:thin:@HOSTNAME:1521:MYORADB", "SCOTT", "TIGER"); Statement s=con.createStatement(); s.execute("SELECT * FROM EMPLOYEE"); s.close(); con.close(); } catch(Exception e){e.printStackTrace();} } } </code></pre> <p>@dardo...I added the .jar file directly in the CLASSPATH and it compiled but when I run the class file I get the following error message</p> <pre><code>C:\&gt;java JDBCVersion Exception in thread "main" java.lang.NoSuchMethodError: oracle.i18n.text.convert er.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterConverter; at oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:43) at oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:97) at oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:129) at oracle.sql.CharacterSet.make(CharacterSet.java:514) at oracle.jdbc.driver.DBConversion.init(DBConversion.java:169) at oracle.jdbc.driver.DBConversion.&lt;init&gt;(DBConversion.java:120) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1135) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320) at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:546) at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:236) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at JDBCVersion.main(JDBCVersion.java:15) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload