java.sql.SQLException: No data found

import java.sql.*;

public class Test

{

public static void main(String[] args)

{

// change this to whatever your DSN is

String DSN = "proj-1";

String database = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};proj-1.mdb";

try {

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection con = DriverManager.getConnection(database,"","" );

}

catch (Exception err) {

System.out.println( "Error: " + err );

}

}

}

I am trying to access MS Acces from Bluej using ODBC data source. I get the error ' No data found'.

[624 byte] By [cypriot85a] at [2007-11-26 16:24:07]
# 1
If you are using DSN string you don't need to specify the complete ODBC connection string.Try simply to use:String database = "jdbc:odbc:proj-1";
topfoxya at 2007-7-8 22:47:59 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

I think it's because the DNS-less URL has incorrect syntax. Should be:

public static final String DEFAULT_URL= "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\path\\to\\file\\proj-1.mdb";

Obviously the OP should substitute the path that's appropriate for this case.

%

duffymoa at 2007-7-8 22:47:59 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...