Re: connecting to a database



Justin wrote:
I am designing a medical application, since I am a programming novice,
its a startup company with no capital, and I want to keep it easy to
install at Beta sites, I would like to use an Access Database to store
information.

So I really dont know how this stuff is done, but I was thinking about
having a class devoted to exchanging information between the Java
application and the Access DB. I envision a class calling a method
inside the databaseClass and passing some parameters like table names
and a DefualtListModel or an ArrayList to deposit information, or a
table name and a query field entry to retrieve information.

However, I have no idea how to set up a connection. I have spent about
2 hours tonight googling, all I can find are either super small
snippets of code that do me no good, or code that when I cut and paste
into netBeans, lights my screen up red.

So I was wondering if anyone out there had some working code for a
connection to an Access Database that they would be willing to post.
As I've said before, I learn best buy doing, so if I could just get a
start, I could most likely figure everything else on my own.

Java + Access = problems

There are no real JDBC driver for MS Access. Only the
JDBC ODBC bridge. And that is not good.

The syntax to connect is:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:;Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\somedir\\something.mdb;Uid=xxxx;Pwd=yyyy;");

Arne

.



Relevant Pages

  • Re: How to use access query computed fields in Word mailmerge
    ... Once you have gone through the connection process once, ... To make a DDE connection in code from Word 2000/2002 I think you will need ... My access databases have lots of these computed query ... >>> an access database with any data in it. ...
    (microsoft.public.word.mailmerge.fields)
  • Re: How to stop source prompt in mail merge from access
    ... Are you calling OpenDataSource in your Access code? ... connection from the Word mail merge main document because Word will try to ... > The mail merge is being called from the Access database via a Visual Basic ...
    (microsoft.public.word.mailmerge.fields)
  • Re: error messages when connecting to an MS Access query
    ... I'm actually opening the Word document from VBA in the Access database, ... It's actually easy to run a Make Table query in Access, ... I got messages saying it couldn't make the connection. ... When you try to make a DDE connection, if the database is not already ...
    (microsoft.public.word.mailmerge.fields)
  • Re: JDBC Applets - MS Access
    ... > I am working on a Applet at the moment which must be able to access ... > I need to be able to setup a jdbc connection to an Access database. ... JDataConnect also uses a server side JDBC server. ...
    (comp.lang.java.databases)