How to access Microsoft Access database from JDBC
By Angsuman Chakraborty, Gaea News NetworkSaturday, October 25, 2003
private static final String accessDBURLPrefix = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="; private static final String accessDBURLSuffix = ";DriverID=22;READONLY=false}"; // Initialize the JdbcOdbc Bridge Driver static { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException e) { System.err.println("JdbcOdbc Bridge Driver not found!"); } } /** Creates a Connection to a Access Database */ public static Connection getAccessDBConnection(String filename) throws SQLException { filename = filename.replace('', '/').trim(); String databaseURL = accessDBURLPrefix + filename + accessDBURLSuffix; return DriverManager.getConnection(databaseURL, "", ""); }
July 19, 2010: 3:40 am
it’s clear that people want to connect with others by location, as well as share experiences and seek recommendations by those who are well informed |
Mehul sharma |
June 1, 2010: 5:54 am
hii, i want to upload my excel file data in to database table at back end using SQL server . Can u please help me out for to send me the query for this. Thanks & Regards |
Jaspinder |
May 10, 2010: 9:57 pm
i want to access the data of MS-Access table via java AWT Components. Pls help. |
lokesh pareek |
vyella |
Sudhir S. Shinde |
January 8, 2010: 6:08 am
Please Give me Answers of my questions when i ask the questions i m hopeful for that. |
dhamu |
December 12, 2009: 4:17 am
I want, how to make jdbc connection with access in java. and i want simple example for this. and how to write jdbc connection program using queries. pls sent mail to my id. plsssss. |
Kartik |
December 6, 2009: 1:27 pm
Hi i want to show a MS-Access table in the java frame please hekp me and provide the code its important for my project |
shivraj |
July 6, 2009: 1:48 pm
R/s, |
hardik |
June 4, 2009: 1:12 pm
hi |
February 13, 2009: 2:53 pm
How to connect java with MS Excel Database, pls send me the code or mail me |
udit sharma |
Karthikeyan |
joe |
January 4, 2009: 4:18 am
Hi, jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:/temp/db.accdb |
ryan |
August 21, 2008: 7:29 pm
helu guys, could anyone give me a code… sample like JAVA connecting to MA Access Database… lets says a simple library system… you can email me thru claiven2000@gmail.com tnx guys in advance..it will help me alot |
veena |
June 3, 2008: 11:37 pm
i want to access data in excel to MS access how to write a code for this in java |
November 23, 2007: 7:59 pm
You need to use either a type 3 (A net-protocol fully Java technology-enabled driver translates JDBC API calls into a DBMS-independent net protocol which is then translated to a DBMS protocol by a server. This net server middleware is able to connect all of its Java technology-based clients to many different databases. The specific protocol used depends on the vendor. In general, this is the most flexible JDBC API alternative.) or type 4 (A native-protocol fully Java technology-enabled driver converts JDBC technology calls into the network protocol used by DBMSs directly. This allows a direct call from the client machine to the DBMS server and is a practical solution for Intranet access. Since many of these protocols are proprietary the database vendors themselves will be the primary source for this style of driver.) JDBC driver to connect properly. |
manjunath |
November 23, 2007: 8:20 am
im trying to run applet with jdbc in an html file with the internet browser but the applet is opening but the database is not getting connected ….. |
chock |
August 3, 2007: 3:06 am
how to connect ajsp file with ms access….usinf jdbc….can u send me the tags whis is used |
shuaib |
July 16, 2007: 6:25 am
i Want to access my Microsoft access file. file exist on my local mechine… can any one give me example code for the same… the executed code |
anirudh |
July 15, 2007: 5:56 am
the same question as venkat i tried using control panel but wen i ran the program it showed sql exception error… |
venkat |
July 7, 2007: 11:56 pm
It is fine to know the conection of ODBC to MS ACCESS in Program.Buti wul’d like to know how to go control panel and then to ODBC and to give the |
August 24, 2006: 8:56 am
> if i am right your code does not require the data source name.. Yes, the beauty of it is that it doesn’t require datasource name. > i would like to know what your url means and how to construct such an url.. Just reuse the code I have provided. It is the format which jdbc-odbc bridge driver understands and converts to appropriate format for underlying odbc layer. In short just reuse my code. |
ashwanth |
August 23, 2006: 11:40 pm
hi angsuman, your code was really useful. everything makes sense.. |
March 28, 2006: 5:20 am
[...] Previously I had provided the gist of how to access MS Access database from JDBC using JDBC-ODBC bridge. Today I will elaborate on that and provide you with two sample classes. The first - AccessJDBCUtil.java defines a method which provides you with a connection to the ms access database. The second - AccessJDBCTest.java uses the first to execute any given query (DDL & DML supported) on any ms access database and displays the result on console. [...] |
Carlos Espinosa |
refurbished computers