Hi,
The following code connects to an access database “multilingual.mdb” located in the default folder of the java code. It does not requires to create a dsn for the same
CODE
try
{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
String myDB = “jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=multilingual.mdb”;
Connection c = DriverManager.getConnection(myDB,”",”");
Statement s=c.createStatement();
ResultSet rss=s.executeQuery(“select naam from table1 where id=1″);
rss.next();
String st=rss.getString(1);
System.out.println(“string=”+st);
}
catch (Exception ex)
{
ex.printStackTrace();
}
This entry was posted
on Saturday, November 21st, 2009 at 2:53 pm and is filed under java.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Leave a reply