MySQL tables not found even though they exists and the Spring MVC application is successfully connecting to the database.

February 3, 2015 7.4k views

I have an Spring MVC application hosted in a tomcat 7 server.

The application is running smoothly. But whenever I go the any page that has a form whose entries are supposed to get persisted in any database table I am getting an error 500. From the stack trace I am pretty sure that the application is connecting to the database successfully. But even though I have all the tables in the specific database in MySQL server the error is saying 'table not found'.

The exact database and application is running flawlessly in the localhost, but just not in the droplet.

The stack trace:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:965) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:844) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'advocatoree.Employee' doesn't exist

Any short of help would be appreciated. Thanks in advance!

2 comments
  • Hi! Any chance you could share any more information? Maybe a snippet of the code that attempts to make that connection? The only thing that jumps out at me is that Linux is case sensitive, so make sure advocatoree.Employee is capitalized consistently.

  • Thanks a ton! Yes, that was the problem actually. I had my model class names capitalized. But the database table were not. I was not having any issue because I developed in a windows machine. This is the first time I am using a linux server, so it is a good lesson learnt indeed!

1 Answer

I solved the issue by following asb's suggestion above. I had all of my model class names capitalized. But the database table were not. I was not having any issue because I developed in a windows machine. But, Linux is case sensitive!

Have another answer? Share your knowledge.