Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello everyone,

I am on my graduation project. I am working more than 1 month. I have spent too much time for this. But It has problems. I can not connect to database. Here is my code. When I run application netbeans give errors.
Java
try {
           DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
           try (Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:@O10G", "plsql_staj", "plsql_staj1");
                   Statement st = conn.createStatement()) {
               ResultSet rs = st.executeQuery("SELECT * from E_USER");
               rs.close();
           }
       } catch (SQLException ex) {
           Logger.getLogger(AddNewUser.class.getName()).log(Level.SEVERE, null, ex);
       }


When I got a run I take this error message.
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path


I downloaded ocijdbc9.dll and ocijdbc.jar I have no idea where to put these files.

That is very very very important for me. Please give a hand.
Posted
Updated 2-Aug-12 1:58am
v2

1 solution

These files need to be added to your main Java library directory or added to a separate directory, whose name is included in the PATH environment variable, or included as an option on the java call thus:
java -Djava.library.path=C:\MyLibrary  MyClass
 
Share this answer
 
Comments
FoxRoot 2-Aug-12 9:11am    
How can I do that. Could you give me steps please ?
Richard MacCutchan 2-Aug-12 9:49am    
I've given you steps, add the definition option to your java command as above. If you are running from NetBeans then you need to check the help file for instructions on how to add a directory to the library path.
FoxRoot 7-Aug-12 2:43am    
Thanks Richard. I am trying JavaDB within netbeans.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900