Forums Register Login

Creating a connection to an Access Database

+Pie Number of slices to send: Send
I am fairly new to java and i am creating an application that i think would benefit from using a database. The only DB i have available at the moment is an ACCESS database, but i can't seem to figure out how to make a connection to it in my java code. Does anyone have any examples or resourcese that can help me out?
+Pie Number of slices to send: Send
Dear Daniel Chaffee,
If you're going to write a Java application that will make use of a database, you'll first have to get yourself acquinted with JDBC. A good start would be http://java.sun.com/docs/books/tutorial/jdbc/index.html or http://developer.java.sun.com/developer/onlineTraining/Database/JDBC20Intro/ . Both can be found on Sun's Java site and should give you all the information you need to setup a connection to database.
If you need a more specific, step-by-step answer, you might want to check out the following JavaWorld page: http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html or the page I found a couple of months ago, which might be your best choice: http://home-1.worldonline.nl/~bmc88/java/jdbc/ .
Good luck,
Tim
+Pie Number of slices to send: Send
One of the nice things about the Java API is its emphasis on portability. You don't need to write different code for the Macintosh and for MS-Windows. Similarly in the database world, you don't have to re-write your database code to work with many different databases. There is an API called 'Java DataBase Connectivity' (JDBC for short; it is mostly in the package java.sql, which is in all JDK's after 1.1, in some version or another). The only non-portable part is specifying the JDBC driver (and Sun provides a reference implementation of a MS-Access driver in the standard JDK) and a "DBURL" (database URL) specifying the name of the database. There is a chapter on this in my Java Cookbook, and you can download one of the simpler code examples from JDBCQuery.java. There is also a guide to this in the JDK documentation directory, whereever you installed the JDK documentation.

Originally posted by Daniel Chaffee:
I am fairly new to java and i am creating an application that i think would benefit from using a database. The only DB i have available at the moment is an ACCESS database, but i can't seem to figure out how to make a connection to it in my java code. Does anyone have any examples or resources that can help me out?


------------------
Ian Darwin,
Author of Java Cookbook: Solutions and Examples for Java Developers
[This message has been edited by Ian Darwin (edited September 26, 2001).]
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1458 times.
Similar Threads
Program just shuts down. No error, nothing!
Program just shuts down. No error, nothing!
Java and database use
Database?
"porting" a PHP application to Java...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 05:52:43.