GeeCON Prague 2014*
The moose likes JDBC and the fly likes Can not connect to Oracle DB from Netbeans 7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Can not connect to Oracle DB from Netbeans 7" Watch "Can not connect to Oracle DB from Netbeans 7" New topic
Author

Can not connect to Oracle DB from Netbeans 7

Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8
Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8
run:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:220)
at java.net.URLClassLoader$1.run(URLClassLoader.java:209)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:208)
at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:270)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:338)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:186)
at DisplayAuthors.main(DisplayAuthors.java:17)
java.lang.NullPointerException
at DisplayAuthors.main(DisplayAuthors.java:44)
BUILD SUCCESSFUL (total time: 0 seconds)
Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8
please help
Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

Ahmed hosni wrote:run:
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver


The oracle jdbc driver is not added to the classpath.


OCJP6, OCWCD5
Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8
How i can insure that ?
Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8

i have another problem



Error: Could not find the main class Start.
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" Java Result: 1
Mike Zal
Ranch Hand

Joined: May 04, 2011
Posts: 144

Ahmed hosni wrote:How i can insure that ?


In the Projects window, right click on your project and select Properties. In the Properties box, select Libraries. Click on the Add JAR/Folder button to and point to the jdbc jar file.

Ahmed hosni wrote:
Error: Could not find the main class Start.
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" Java Result: 1


I cannot see your project layout so I can't answer that. I'm guessing that you intend to run the public void main(String[] args) function from a class called Start. Make sure that file exists in your project.
Ahmed hosni
Greenhorn

Joined: Dec 08, 2010
Posts: 8

run:
java.lang.NullPointerException
at DisplayAuthors.main(DisplayAuthors.java:44)
Exception in thread "main" java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/i18n/text/converter/CharacterConverter;
at oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:43)
at oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:95)
at oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:126)
at oracle.sql.CharacterSet.make(CharacterSet.java:448)
at oracle.jdbc.driver.DBConversion.init(DBConversion.java:150)
at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:111)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1007)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(DriverManager.java:620)
at java.sql.DriverManager.getConnection(DriverManager.java:222)
at DisplayAuthors.main(DisplayAuthors.java:18)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2501
    
    8

Check the instructions that come with the jdbc driver. There are extra jars to add to the classpath.


OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can not connect to Oracle DB from Netbeans 7