Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2004, 05:59 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to connect to an MS Access database?

Hallo everyone i need help on how to connect to an MS Access database.

i don't know what i need to specify in the driver and url string for the parameters in the getConnection method.

i've tried with "sun.jdbc.odbc.JdbcOdbcDriver" for the driver string, and "jdbc:odbc:C:\\dbExample.mdb" for the url string, but it won't work. any help would be very appreciated.
 
Old September 12th, 2004, 11:28 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

 ODBC
 Standard Security: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"
 Workgroup: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatab ase.mdw;"
 Exclusive: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=adm in;Pwd="

 
Old February 22nd, 2005, 01:05 AM
Authorized User
 
Join Date: Jan 2005
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by gokul_blr
  ODBC
 Standard Security: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;"
 Workgroup: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;SystemDB=C:\mydatab ase.mdw;"
 Exclusive: "Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Exclusive=1;Uid=adm in;Pwd="

I'm doing similar things, but web-based. Is the connection string similar when you access this via JSP? Would you create a Bean with the above code in it, or could you just use a database connection string in the JSP code itself? I'm trying to make a basic database connection work in JSP -> Access, so as to desktop-test some web apps.

Thanks,

--tgr

Thaddeus G. Reeves
Internet Dissemination
Church of Scientology Int'l
 
Old February 22nd, 2005, 07:28 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can add code to JSP, I use a bean that returns a recordset to keep the JSP cleaner.
Another way is to use JNDI to create a database reference in your configuration files (in tomcat at least).

The advantage of using JNDI is that you can take advantage of connection pooling. I prefer the bean as I 'think' it will be more easily ported to a different server.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Database migration MS Access 2003 to MS SQL 2000 ayazhoda SQL Server 2000 3 April 23rd, 2007 11:38 AM
How to connect to a access database with password? yuetqu VB.NET 2002/2003 Basics 1 September 10th, 2006 01:56 PM
HOW TO programatically connect to Access Database Deepa7476 Visual Basic 2005 Basics 4 May 23rd, 2006 09:12 AM
how to connect to remote ms-access database Jitendra Pro VB Databases 1 September 20th, 2004 03:13 AM
Can't connect to access database using C# code... saxitalis Access 1 November 8th, 2003 02:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.