在linux中连接到mysql后找不到数据库

时间:2014-04-18 11:32:19

标签: java mysql linux tomcat jdbc

Linux的Ubuntu的     问题:连接到mysql后无法找到mysql数据库

1. I have a war file deployed in webapps folder at /srv/apache-tomcat-7.0.53/webapps/
War name is InIndia.war

2. I have deployed inindiadb.properties in classpath which is /srv/apache-tomcat-7.0.53/lib

Contents of inindiadb.properties

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/inindia
jdbc.username=root
jdbc.password=admin

3. I have mysql installed and running

netstat -vulntp |grep -i mysql
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      563/mysqld

4. MySql Database has inindia database and inindia has 3 tables (place , user_roles , users)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| inindia            |

| mysql              |

| performance_schema |

| test               |

+--------------------+

5 rows in set (0.00 sec)

mysql> use inindia;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;

+-------------------+

| Tables_in_inindia |

+-------------------+

| place             |

| user_roles        |

| users             |

+-------------------+

3 rows in set (0.00 sec)


5. The problem is when I restart my tomcat , a connection is made to the mysql but in tomcat logs it says that 

**catalina.out**

SEVERE: Error listenerStart
Apr 18, 2014 11:02:17 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/InIndia] startup failed due to previous errors


**localhostlocalhost.2014-04-18.log**

INFO: Initializing Spring root WebApplicationContext
Apr 18, 2014 10:50:11 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.inindia.listener.ApplicationInfoLoaderListener
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM PLACE order by placeName]; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'inindia.PLACE' doesn't exist
  • 我无法弄清楚错误。该错误表示无法找到inindia.Place,但存在数据库和表。
  • 它连接到inindiadb.properties文件中提到的URL
  • 我甚至编写了一个java类来连接mysql服务器并显示为其中一个表的输出数据。连接和数据提取都是成功的。

  • 即使我在正确部署的Windows中的本地tomcat上也部署了相同的内容。因此战争似乎有问题

我是linux新手。请告诉我是否有任何设置要在mysql server.like给数据库或类似的东西

1 个答案:

答案 0 :(得分:0)

表名称区分大小写。使用适当的情况