Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accesss database connection

 
Archana Pawar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

My connection code is:

String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.accdb)};DBQ=" + "D:\\project\\javaTest\\JavaCourse.accdb;";

Any suggestion awaited.
Thanks,
Archu :)
 
Archana Pawar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get the following error:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.

my code snippet is:
String url = "jdbc:odbc:JavaSource";
Connection conn = DriverManager.getConnection(url,"","");

Any suggestion welcome.
Thanks
Archu :)
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, do you load the jdbc/odbc driver?

Then you create the appropriate url to use when making a connection

Then you can create a connection with the appropriate username and password

Hope it helps!
Kind regards,
Roel
 
Archana Pawar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
My code is working fine after I made some changes, like
configuring the DSN etc.
I have another problem
The code snippet does not work
String sql = "DELETE FROM Customer " +
"WHERE ID = 4";
stmt.executeUpdate(sql);
Here my ID is string variable.

Any suggestions welcome
Thanks
Archu
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Archana Pawar wrote:My code is working fine after I made some changes, like
configuring the DSN etc.

It's always nice and a good practice if you share the working code or describe how you solved your issue(s). That might help other ranchers facing a similar issue.

Archana Pawar wrote:I have another problem
The code snippet does not work

So we are expected to guess which problem you currently are experiencing. Many of us are not clairvoyant Always TellTheDetails! The more information you provide, the easier it is for people to answer your questions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic