Can't connect to mysql in centos
NickName:Mthk Ask DateTime:2015-07-09T17:21:54

Can't connect to mysql in centos

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&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>

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

Answers
sarav 2015-07-09T09:30:22

Please check whether table USR exist in nmnl database or not. Because exception says table USR not exists in nmnl.",


Mthk 2015-07-09T10:29:58

Yeah. I got it.\nWhen i restore database with query,My query is CREATE USR.\nI remove this char ` and restore back.\n\nAnd I changed all table names to UPPER case.",


More about “Can't connect to mysql in centos” related questions

Can Can for Rails Association

I used can-can gem for managing the roles in my application. The models are as follows class User &lt; ActiveRecord::Base has_many :projects has_and_belongs_to_many :teams end class Pr...

Show Detail

Can can with devise, admin and user

I use cancan and devise, I can update delete and show but I can't create profile. why I can't create new profile ("ActiveModel::ForbiddenAttributesError") class Ability include CanCan::Ability ...

Show Detail

rails 3 can can ability

I am using can can gem to restriction user based on role there is no model for product class ProductsController &lt; ApplicationController authorize_resource :class =&gt; false def index ...

Show Detail

GET request can be bookmarked and POST can not . Can anybody explain on this?

I am studying the HTTP methods. I read that GET request can be bookmarked and POST request can not be bookmarked. Can anybody explain this with an example? Thanks

Show Detail

Can not tnsping but can sqlplus connect

I have a question hopefully someone could explain it to me. I have an Oracle 11g installed properly on the server. From a workstation, I have installed the oracle client which tnsname.ora pointed t...

Show Detail

Can Can with Role Model restriction

I'm Trying to achieve that the user can see only HIS applications, and not the "Application Index" containing all the applications from all Users. My Header: &lt;%= link_to "My Application ",

Show Detail

CAN busoff with CAN_High and CAN_Low shorted

It is known fact that short circuiting CAN_High and CAN_Low on a CAN bus leads to a bus off condition. With respect to the physical layer, how does this condition lead to bus off condition?

Show Detail

What is CAN Active, CAN passive and Sleep state in CAN Network manager?

I am trying to understand the CAN network management in vehicle. During my research, I got to know that CAN network management(CANNM) will make some Mode state to decide the CAN transmission. Those...

Show Detail

Where is CAN ID in CAN Message Frame

I am new to the CAN-BUS protocol. So was going through the CAN Bus Specifications and related documents. I have always used the CAN ID and Frame at the application level. CANID like 0x1a1 CAN Fram...

Show Detail

Service can do ,but Asynctask can not?

I have read about difference between Service,Intent Service &amp; Asynctask ,but I have not figured out any situation where only service works but Asynctask fails. I have noticed some points: Asy...

Show Detail