• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC:ODBC: DRIVINGMECRAZY

 
Greg Belyea
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything I read assumes I already know a bit about JDBC the fact is I don't.. I have Java 2 installed and it says that JDBC is included however when I run a JDBCtester I found on the net it states that class sun.jdbc.odbc.SunJdbcOdbcDriver could not be found... registerDriver().. failed
Do I need to download something separate in order for JDBC to work on my machine, I'm simply trying to establish a connection with an MS ACCESS Database and am having no luck... Not nearly
easy enough
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in order to get dtarted you will have to go to your control panel click on the odbc icon and register through there
good luck
 
Greg Belyea
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am familiar with the ODBC but there is no mention of that step anywhere in any of the Java documentation. Where in the ODBC should I be registering the JDBC, I see nowhere to add it, and if if I did, I have no idea where the driver is located
 
Fred Abbot
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well click on the odbc icon then click add
click on msaccess
on the next screen fill in all the info and you should be set
good luck
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used JDBC successfully many times, but I've never done anything like "go to your control panel click on the odbc icon". Which control panel is this? Is it something specific to Access?
I have found that the easiest way to get into JDBC is to use one of the pure Java databases. I like Instant DB as it is simple to install (just add a jar file to your classpath or Java 2 lib/ext directory) and full-featured. Take a look at http://instantdb.enhydra.org/ . Another good choice is Hypersonic SQL, available at http://hsql.oron.ch/ .
 
Greg Belyea
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
perhaps it's a ClassPath problem, can somebody with their JDBC working copy-paste their CLASSPATH into a message here for me, I would sure appreciate it...
Another point of interest though, when I run the program from my KAWA editor instead of getting class not found error I get a Security Violation!!! Very different than when I run it on the command line....
Thanks for the replies guys, I'm trying everything!!!:-)
 
Paul Caudle
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is probably just a typo and not really the problem, but just in case it is I thought I'd mention it.
In your initial post you mentioned it could not find the class
SunJdbcOdbcDriver in sun.jdbc.odbc.* . I am used to using the JdbcOdbcDriver class and so was a little puzzled by this. After looking through my jar files I think there is no such driver as SunJdbcOdbcDriver, rather just JdbcOdbcDriver.
As far as Frank's quick questions about odbc in the control panel, I think that was just reference to the Windows' control panel. Inside of it there is a gui version of ODBC Data Source Administrator. This is what I use to register MS Access databases as ODBC data sources.

When I need to connect to an Access db, I always use the JDBC-ODBC bridge. In order to make use of this, the database itself needs to be registered with ODBC. To do this, open the ODBC Administrator (in control panel), hit the add button on the User DSN tab, select the access driver and hit finishe. Fill in the Data Source Name textfield with whatever you want to call your database while your coding. Hit the select button and browse/select your database file. After that, the path to the database should appear above the line of buttons where select was. Click OK a couple of times, and that's it.
My sincere apologies if this stuff was already assumed to be known here and I just missed the point. I figured there was no harm in writing it out, though, just in case.
Hope that helps, and if not, I hope I didn't offend anyone
-Paul

[This message has been edited by Paul Caudle (edited June 14, 2000).]
 
Greg Belyea
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope no offense take, yup it was a typo, I meant JdbcOdbcDriver, and although it took a while I figured out the ODBC GUI registering process... Thanks for your help though in any case. Now I have to try connecting to Oracle!!! I'll likely be back!
Thanks all
 
Megan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have tried everything mentioned here but I still get the "Class not found" exception in my code (see below) and the JDBCtester gets the "registerDriver().. failed". What is wrong? Please help.
 
Megan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have tried everything mentioned above but I still get the "Class not found" exception in my code and the JDBCtester gets the "registerDriver().. failed". What is wrong? Please help.
 
Kevin Cary
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having the same problem, "I keep getting a class not found exception" when using Class.forName( "com.imaginary.sql.msql.MsqlDriver" );. This package is located in my root directory which is in my classpath. Using "find" verifies the exact same location of MsqlDriver.class.
I've tried using Class.forName( "com.imaginary.sql.msql.MsqlDriver).newInstance() and tried moving the package to java\lib\ neither of which has worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic