Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在centos中连接到mysql_Java_Mysql_Linux_Spring_Mybatis - Fatal编程技术网

Java 无法在centos中连接到mysql

Java 无法在centos中连接到mysql,java,mysql,linux,spring,mybatis,Java,Mysql,Linux,Spring,Mybatis,我使用Spring+Mybatis并尝试在Centos中连接mysql服务器5.1。 mysqldatabase的连接是正常的,在使用测试类进行测试时没有问题。 在windowserver中使用相同的配置连接MYSQL5.5也没有问题 在Centos中连接MYSQL5.1时, 当我的web应用程序项目进行select查询时,会发生异常 Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nmnl.USR

我使用Spring+Mybatis并尝试在Centos中连接mysql服务器5.1。 mysqldatabase的连接是正常的,在使用测试类进行测试时没有问题。 在windowserver中使用相同的配置连接MYSQL5.5也没有问题

在Centos中连接MYSQL5.1时, 当我的web应用程序项目进行select查询时,会发生异常

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nmnl.USR' doesn't exist
我怎样才能解决这个问题

这是spring-beans.xml中的配置

<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="transactionManager"
    class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
</bean>
<util:properties id="SQL_ERROR_CODE" location="classpath:SQL_ERROR_CODE.properties" />

<util:properties id="APPLICATION_CONFIG" location="classpath:APPLICATION_CONFIG.properties" />

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="jdbc:mysql://192.168.0.99:3306/nmnl?useUnicode=yes&amp;characterEncoding=UTF-8" />
    <property name="username" value="root" />
    <property name="password" value="root" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="configLocation" value="classpath:sqlmap-config.xml" />
</bean>

<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
    <constructor-arg index="0" ref="sqlSessionFactory" />
</bean>

请检查nmnl数据库中是否存在表USR。因为异常说明nmnl中不存在表USR。

是的。我得到了它。 当我用query恢复数据库时,我的查询是createusr。 我删除这个字符并还原回来


我把所有的表名都改成大写。

。linux中的MySQL区分大小写。只有上下两种颜色可供选择。我在mybatis sql映射中的查询是上下两种。所以我被全部改为大写。

用POJO检查表映射。还要检查db中是否有表。表映射、POJO和表是否存在。当使用主类JDBC进行测试时,它是alerady ok。我想这将是我的batis的原因。我的意思是检查表映射是否有输入错误