• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to connect ms acess in java  RSS feed

Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:3
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at com.adp.test.util.DBMSConnection.getConnection(DBMSConnection.java:30

please guide me. if some where wrong.
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hope this article will be helpful to you.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!