-1

i'm trying to get a date from a database and compare it with the date where is it entered in the texfield

 try {
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
  con = DriverManager.getConnection("jdbc:odbc:MoviesAc");
  System.out.println("Connection ok.");

  Statement stmt = con.createStatement();
  String SQL="SELECT * FROM MoviesAc";
    ResultSet rs= stmt.executeQuery(SQL);
    while (rs.next()) {

        if( rs.getString("DateOfMovies").equals( jTextField1.getText()))
            System.out.println("it worked");


       }

  con.close();

now after running the code it says

 Exception: [Microsoft][ODBC Microsoft Access Driver] The Microsoft Office Access database engine cannot find the input table or query 'MoviesAc'.  Make sure it exists and that its name is spelled correctly.

am i doing anything wrong knowing that the DB is spelled correctly and it connects when trying on any other data , appreciating all the help and any info

sher
  • 11
  • 1
  • 2
    do you have any database on top of `MoviesAc` table? If so then use this query `SELECT * FROM .MoviesAc` – Vishrant Apr 10 '17 at 18:15
  • Just a guess: case-sensitivity. Try all uppercase or lowercase on the table name: `MOVIESAC` or `moviesac`. Also are you sure the "movies" part is plural with an "s"? – Basil Bourque Apr 10 '17 at 18:16
  • By the way, the `sun.jdbc.odbc.JdbcOdbcDriver` was never meant for production use. It has been removed from recent versions of Java. – Basil Bourque Apr 10 '17 at 18:19
  • *The Microsoft Office Access database engine cannot find the input **table** or **query*** is pretty specific, if you assume your code is correct and the driver code is incorrect you are assuming the wrong thing ... –  Apr 10 '17 at 18:29

1 Answers1

2

make sure your jdk version is not jdk8+ . jdk8 no longer support JDBC:ODBC bridge database connectivity .

for above your problem read this url : https://support.microsoft.com/en-us/help/983275/-the-microsoft-office-access-database-engine-cannot-find-the-input-table-error-occurs-when-you-try-to-open-a-table-in-an-access-2010-template

SANDEEP S S
  • 68
  • 1
  • 9