• 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

Linking a Java program with a DBMS like MS Access.

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have been working on a school project recently. I wanted to use a DBMS like MS Access to store and retrieve data. But, I don't know how to link my program and the database. Could someone lease help me out with this?
Thanks a lot in advance.

Regards,
Anshul Kulkarni.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First a caveat. MS Access is not a multi-user database. So it's not appropriate for serious work if you're writing a web application. For such things use a true multi-user database such as SQL Server or MySQL.

In Java, the standard way to communication with a database is via the Java Database Connection protocol (JDBC). You obtain a JDBC Connection object using a JDBC URL and a JDBC Driver.

The Driver defines the database protocols that it supports. For example: "jdbc:db2" or "jdbc:postgresql". In most cases, the JDBC URL format is in a format like: "jdbc:protocol://server:port/dabatase" with possible additional options. MS Access doesn't use a database server, so instead you use a driver called the "jdbc/odbc bridge driver". ODBC is more or less the Windows equivalent to JDBC, so in addition to talking to MS Access, it's also used to talk to FoxPro databases. SQL Server has its own JDBC driver, which is more suited for heavy-duty work.

For a full example, try this: http://www.benchresources.net/jdbc-msaccess-database-connection-steps/
 
Saloon Keeper
Posts: 7585
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote: MS Access doesn't use a database server, so instead you use a driver called the "jdbc/odbc bridge driver".



That's not really an option any more, as the bridge driver ceased to be included in the JRE years ago. Unless you can get hold of a trial version of a commercial Access JDBC driver like HXTT, you should use some other DB. Maybe a Java DB like Derby or HsqlDB fits the bill.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic