This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes how to connect ms acess in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "how to connect ms acess in java" Watch "how to connect ms acess in java" New topic

how to connect ms acess in java

basanta dwibedy

Joined: Feb 05, 2007
Posts: 23
hi i am trying to connect ms access through java but its having error data source name not found.
But i have created data source already in controlpanel---.> admistretive tool--> data source --> DBCON and configure to my data base file Test.mdb .

please help me regarding

public Connection getConnection() throws SQLException
try {


String path="D:/database/Test.mdb";
String database = "jdbcdbcBCON={Microsoft Access Driver (*.mdb)};DBQ= "+path+";;DriverID=22;READONLY=true";

conMain = DriverManager.getConnection(database,"","");


catch(Exception e)
{ e.printStackTrace();

return conMain;

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not fou
nd and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(
at sun.jdbc.odbc.JdbcOdbc.standardError(
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(
at sun.jdbc.odbc.JdbcOdbcDriver.connect(
at java.sql.DriverManager.getConnection(
at java.sql.DriverManager.getConnection(
at com.adp.test.util.DBMSConnection.getConnection(

please guide me. if some where wrong.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

hope this article will be helpful to you.

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Consider Paul's rocket mass heater.
subject: how to connect ms acess in java
It's not a secret anymore!