• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Class.forname() and Access

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to get started with the good book "Database Programming with JDBC and Java". Am using Access as a local database but cannot find the driver class name needed for Class.forname(). Can anybody point this out?
Also: I really like this eporkchop site. Just what I needed to learn more Java.

------------------
Rick Casey http://rtt.colorado.edu/~caseyh
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you downloaded Java from the Sun webpage,
try the following:
Class.forName("sun.jdbc.odbc.JdcbOdbcDriver");
For the url, you will have to find out what your computer calls it. You can double-click on the ODBC icon in the Control Panel to add, modify and delete database references. Given the above classname and a database reference called, "OLE_DB_NWind_Jet", the next two lines of code may look like:
String url = "jdbc dbc:OLE_DB_NWIND_Jet";
Connection con = DriverManager.getConnection(url, "", "");
Hope that helps.
 
Trailboss
Posts: 23401
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It looks like UBB is trying to be cute.
That that you see should be replaced with

Hopefully this came out okay.
 
paul wheaton
Trailboss
Posts: 23401
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Now I've turned off the smiley face stuff which should turn off that problem with the colon followed by the letter "oh".
This added message should fix the thread.
It should say
String url = "jdbc dbc:OLE_DB_NWIND_Jet"
 
paul wheaton
Trailboss
Posts: 23401
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, that didn't work.
I'll look into this some more.
In the mean time, the statement is
String url = "jdbc: odbc:OLE_DB_NWIND_Jet"
but without spaces.
 
Ranch Hand
Posts: 85
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


rick casey, i think you looking database connectivity. so you can use above code fragment. if you using mysql, download mysql-connector-java-5.1.13-bin.jar file and use it.

knowladge is power when applied.


 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic