• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Cant Connect to Oracle via JDBC

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a Java app that needs to query an oracle database. I developed the app under JBuilder 4 and it connects the database just fine.
But, when I try to run outside of JBuilder I 'm getting the following error:
Specified Driver could not be loaded due to system error 126 (Oracle ODBC Driver)
TIA,
Art
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Need more information to really dignose what is going on. It looks like you are using the JDBC-ODBC bridge to connect to your Oracle database. If so, have you registered the ODBC DSN on the system you are running the java code?
I would suggest you try Oracle's (or some 3-party vendor's) JDBC driver. The thin driver can be downloaded diurectly from technet.
 
Art Smith
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I am using the JdbcOdbc bridge. I assumed I had to since my app is running on NT.
Here is the offending code:
public void connectTODatabase() throws SQLException, ClassNotFoundException, Exception {
Class.forName(driver); // Attempt to Load the Specified Driver
con = DriverManager.getConnection(url,username,password); // Get a connection to the Database via the Driver
if (con.isClosed()) {
throw new Exception("Connection to Specified Database could not be opened");
}
if (debug) {
System.out.println("Driver :"+url+"\n");
System.out.println("Connected :"+url+"\n");
}
createStatement();
}
Any suggestions would be helpfull. I've got to get this thing into production this week.
Art
 
Art Smith
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Opps. I forgot to mention that the exception I'm getting in an SQLException. NOT a ClassNotFoundException.
Again the error message is:
Specified Driver could not be loaded due to system error 126 (Oracle ODBC Driver)
 
Robert Brunner
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of things, (1) what are the values for driver, url ? (2) Are you sure the DSN is set up properly?, and (3) are you sure the Oracle ODBC driver is installed?
To help, I need the values indicated in (1), e.g., jdbc.odbc.myOracleDatabase would be a possible value for the JDBC url. For (2) you would need to have registered the DSN myOracleDatabase using Windows ODBC administrator (odbcad32.exe, which is located in C:\WINNT\system32). Finally, Oracle has an ODBC test tool. I beleive it is installed under start->programs->oracle home (?)->newtork administration
Hope this helps.
 
Art Smith
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After talking to folks at the office I discovered that I could use the Oracle JDBC driver instead of the ODBC/JDBC driver I used durning the development phase of the project.
I've since implemented my app using the Oracle JDBC drivers. I like this solution better cause I don't have to install anything on the server where my app lives. Just drop the Oracle drivers zip file in my class path and I'm good to go. Plus, I don't have to maintain a DSN on the server of ODBC - one less thing to remember if we get a new machine or something.
So, to those who took the time to reply to my query.
THANKS,
Art
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic