1 Replies - 376 Views - Last Post: 19 August 2009 - 05:27 PM Rate Topic: -----

#1 abhishekbhardwaj241  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 26-July 09

Database Access

Post icon  Posted 19 August 2009 - 05:15 PM

I want to access MS Access database using File Dsn.From Control panel>Administrative Tools\Data Sources (ODBC) and then FileDsn Tab.
But there is always an error occurs "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not fou
nd and no default driver specified"
MyCode was:

import java.sql.*;
class A
{
static String name,address;
public static void main(String args[]) 
{
Connection con=null;
Statement st=null;
try
{
name="abhi";
address="shek";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:dbfileDSN","","");
st=con.createStatement();
st.executeUpdate("insert into mytable where(nam,add)values('"+name+"','"+address+"')");
System.err.println("done!!!!!!!");
}
catch(Exception e){System.err.println(e);}
}
}



Is This A Good Question/Topic? 0
  • +

Replies To: Database Access

#2 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 562
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Database Access

Posted 19 August 2009 - 05:27 PM

Firstly, to make sure, you database table is saved under the name dbfileDSN?

Secondly, have you mapped your database table in the odbc manager?

Thirdly, does your dbmc use a username and password or not? You seem to create variables for them but never use them.

Lastly, you did download the correct driver for this didnt you?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1