Bug #1215 Table 'db.table_name' doesn't exist
Submitted: 6 Sep 2003 19:31 Modified: 15 Mar 2004 6:39
Reporter: Siva Dirisala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.0-alpha-standard OS:Linux (Linux 2.4.22)
Assigned to: Mark Matthews CPU Architecture:Any

[6 Sep 2003 19:31] Siva Dirisala
Description:
I am trying to my design for concurrent access and came across this issue.
I get the error

Exception in thread "main" java.sql.SQLException: General error,  message from server: "Table 'hlatest.hla_lookup_types' doesn't exist"
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1651)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:889)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:956)
	at com.mysql.jdbc.Connection.execSQL(Connection.java:1874)
	at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1538)
	at hla.db.JDBCConnection.main(JDBCConnection.java:110)

I am using mysql connector java 3.0.8-stable jdbc driver. However, from the
error it looks like a database issue.

How to repeat:
1. Create a table, say table1 with a column column1.
2. Insert a record into table1. 
3. Write the following java code.

     
   PreparedStatement pstmt = connection.prepareStatement("select column1 from table1");
   for(int i=0;i<1000;i++) {
     ResultSet rs = pstmt.executeQuery();
     rs.next();
     System.out.println(rs.getInt(1));
   }

4. Open a mysql session in one window.
5. Run the above java code and while it is running, update the record from the
   mysql window. 

Some times everything is fine. Sometimes I get the above jdbc error. Or a few
times the mysql session has the same error. It gives

   "ERROR 1146: Table 'db.table1' doesn't exist"

Instead of looping so many times, I did a Thread.sleep(10000) and did a 
executeQuery() before and after the sleep. When the first execute is done and
the data is printed, I updated the record. The second execute went through
successfully without any problem as I am making the process to sleep for almost
10 seconds. Note that I set the autocommit to false for the jdbc connection.
[2 Oct 2003 11:29] MySQL Verification Team
Mark I am assign you this because is Java issue.
[2 Oct 2003 11:36] MySQL Verification Team
I ma re-asssign to Venu according Mark's instructions since it is
prepared statements issue.
[15 Mar 2004 2:41] Brian Aker
Mark, can you please update this with a test case and reason as to why this bug is in the server and not 
in the JDBC driver?
Thanks.
[15 Mar 2004 6:13] Mark Matthews
Brian, the test case is in the bug report.

The reason that I'm 99.9% sure it's a server bug is if you turn off server-side prepared statements, the issue goes away.

IIRC, Dean also tested this with his C test harness.

I will re-test with a current build of MySQL before trying to come up with a C test harness, as the current prepared statement code has had a lot of work done on it (look at the version # this is reported against, it's 4.1._0_!).
[15 Mar 2004 6:39] Mark Matthews
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.

Additional info:

I can't repeat this with MySQL-4.1.2 (from BK). You should try your testcase again with the latest version of MySQL-4.1, and/or provide a _complete_ testcase including schema and data that demonstrates this issue in a repeatable fashion on the latest version of MySQL-4.1.
[19 Aug 2010 8:42] shabbir hussain
hii

i had done all database operations and its work fine on local system but when i connect to my database online it gives me error that databasename.tablename does'nt exist. why is it so happening plz anybody explain me and whats the solution for that.