Since Christmas, I am proud owner of an Android powered smart phone (Samsung Galaxy S Plus). The first thing I wanted to do was coding an java app to connect to Oracle database and fire lots of queries into the DBMS.
As you maybe know, a JDBC driver is needed for this intention. You can download it at Oracle Software Downloads (http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html). And as you also know, you need to add in Eclipse IDE as a JAR file to your project. If you now test your app with a connection code like the one below, you will get a lot of exceptions:
I had not even been able to investigate what exception exactly does occur or where it does come from. It's caused by the driver package odbc6.jar from Oracle 11g2 JDBC driver.
No matter what I did or which approach i tried - i got exceptions. One of them was a ClassNotFoundException, but I could not explain, why.
Google did not seem to be my friend in this issue. I found lots of forums with topics telling me to use a web service to query my database, but this was not what I wanted to do. I wnated to remote-connect me to the university's Oracle database just like i do with my netbook via VPN.
Finally I found the needle in the haystack at stackoverflow.com. Reading this post I tried to find the recommended odbc14.jar of Version 10.2 at Oracle download page, found it, added it to my Java project (replacing old JDBC driver package) and tried it out. It worked. :) Finally.
As you maybe know, a JDBC driver is needed for this intention. You can download it at Oracle Software Downloads (http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html). And as you also know, you need to add in Eclipse IDE as a JAR file to your project. If you now test your app with a connection code like the one below, you will get a lot of exceptions:
Driver d = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
DriverManager.registerDriver((d));
Connection c = DriverManager.getConnection("jdbc:oracle:thin:@instance.server.com:1521:name", "user", "password");
DriverManager.registerDriver((d));
Connection c = DriverManager.getConnection("jdbc:oracle:thin:@instance.server.com:1521:name", "user", "password");
I had not even been able to investigate what exception exactly does occur or where it does come from. It's caused by the driver package odbc6.jar from Oracle 11g2 JDBC driver.
No matter what I did or which approach i tried - i got exceptions. One of them was a ClassNotFoundException, but I could not explain, why.
Google did not seem to be my friend in this issue. I found lots of forums with topics telling me to use a web service to query my database, but this was not what I wanted to do. I wnated to remote-connect me to the university's Oracle database just like i do with my netbook via VPN.
Finally I found the needle in the haystack at stackoverflow.com. Reading this post I tried to find the recommended odbc14.jar of Version 10.2 at Oracle download page, found it, added it to my Java project (replacing old JDBC driver package) and tried it out. It worked. :) Finally.
Kommentare
Kommentar veröffentlichen