I use Spring+Mybatis
and try to connect mysql server 5.1 in Centos.
The Connection of mysqldatabase is ok and there is no problem when I'm testing with Test Class.
And There is no problem when connecting MYSQL5.5 in Window Server with same config.
In Connecting to MYSQL5.1 in Centos,
When my web application project make a select query, an exception is occurred.
Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'nmnl.USR' doesn't exist
How can I solve?
This is config in 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&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>
Copyright Notice:Content Author:「Mthk」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31313273/cant-connect-to-mysql-in-centos