Skip to main content

left outer join problem

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-03-31


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 {
        String url = "jdbc:odbc:Driver={Microsoft Access Driver " +
            "(*.mdb, *.accdb)};DBQ=C:\\tab1.mdb";
        String url1 = "jdbc:odbc:Driver={Microsoft Access Driver " +
            "(*.mdb, *.accdb)};DBQ=C:\\tab2.mdb";
        Connection con = DriverManager.getConnection(url);
        Connection con1 = DriverManager.getConnection(url1);
        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 ( {
                System.out.println(rs.getString("ID") + " : "
                        + rs.getString("Name")+ " : ");
        } catch (SQLException e) {
            System.out.println("SQL Exception: "+ e.toString());
        } catch (ClassNotFoundException cE) {
            System.out.println("Class Not Found Exception: "+