accessing MS Excel through JAVA
<p>I am trying to access the MS Excel file from java.</p>

<p>I want to execute the below query</p>

<p>SELECT NAME FROM [TABLE1$] WHERE TESTFUNKTION IS NOT NULL
             AND TESTFUNKTION NOT IN
                (SELECT NAME FROM [TABLE2$]
                    MINUS
            SELECT DAPF_NAME FROM [TABLE3$])<br>
                MINUS
            SELECT METH_NAME FROM [TABLE4$];</p>

<p>Here is my code </p>

<pre><code>Connection connODBC = null;
        ResultSet rsXls = null;
        Statement stmtXls = null;     

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

            connODBC = DriverManager
            .getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ="
                + sFileName + "");
            stmtXls = connODBC.createStatement();

  String sQuery="SELECT NAME FROM [TABLE1$] WHERE TESTFUNKTION IS NOT NULL";
            +" AND TESTFUNKTION NOT IN"
            +"( SELECT NAME FROM [TABLE2$]"
            +"MINUS"
            +"SELECT DAPF_NAME FROM [TABLE3$])"       
            +"MINUS"
            +"SELECT METH_NAME FROM [TABLE14$]";

            rsXls = stmtXls.executeQuery(sQuery);  
}
Catch (Exception e){
e. printStackTrace();
}
</code></pre>

<p>I am getting the below error.</p>

<pre><code>java.sql.SQLException: [Microsoft][ODBC Excel Driver] Syntax error in FROM clause.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)Completed The HIS_PAV_METHODE

    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
</code></pre>

<p>How we can execute the queries with “MINUS” command.</p>

<p>Can anybody have look into this and Please help me in this regard</p>
