Hey can anyone know this I am trying to connect a jdbc example shown in the website for connecting with msaccess without dsn and I am continuously getting error:: data source name not found although there is no any declaration of dsn in as title discribes(without dsn) then why this error is going:My actual code is:: import java.sql.*; class Test{ public static void main(String ar[]){ try{ String database="db1.mdb";//Here database exists in the current directory String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=true"; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection c=DriverManager.getConnection(url); Statement st=c.createStatement(); ResultSet rs=st.executeQuery("select * from Me"); while(rs.next()){ System.out.println(rs.getString(2)); } }catch(Exception ee){System.out.println(ee);} }} I have db with name db1 and table named "Me".Please help me I tired of trying things in it and one other thing is it possible to set path variable with multiple jdk one of 1.8 and other 1.6 cebause i have to specify the path for 1.6 everytime I try ms-access for connecting..?????
| 0 |