Hello.

I want to join two tables with Left Outer Join, but it throws an exception:

SQL Exception: java.sql.SQLException: [Microsoft][Driver ODBC Microsoft Access] Can't find input table tab2.


The problem is that it never loads tab2. But if I change the code and I work only with tab2 (SELECT, UPDATE) then it works. Only if I want to work with both tables at the same time it does not work. Where is the problem? Thanks

public static void main(String[] args) {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbcdbcriver={Microsoft Access Driver " +
"(*.mdb, *.accdb)};DBQ=C:\\tab1.mdb";

String url1 = "jdbcdbcriver={Microsoft Access Driver " +
"(*.mdb, *.accdb)};DBQ=C:\\tab2.mdb";

Connection con = DriverManager.getConnection(url);
Connection con1 = DriverManager.getConnection(url1);

System.out.println("Conected!");

Statement stmt = null;
ResultSet rs = null;

// SQL query command
String SQL = "SELECT * FROM tab1 LEFT JOIN tab2 ON tab1.ID = tab2.ID";
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
System.out.println(rs.getString("ID") + " : "
+ rs.getString("Name")+ " : ");

}



con.close();
} catch (SQLException e) {
System.out.println("SQL Exception: "+ e.toString());
} catch (ClassNotFoundException cE) {
System.out.println("Class Not Found Exception: "+
cE.toString());
}
}
}