Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

问题:维护团队原有java项目,spring + mybatis。所在机器重启后,重启项目,tomcat已启动,报以下错

解决:

根据错误信息推测与数据库有关,在Linux上执行mysql,报错

which mysql
sh xx/bin/mysqld_safe   # xx为安装地址

执行mysql无问题,项目仍报错。mysql语句链接项目使用数据库,报错;链接另一个一直数据库,可链接

进入项目所在目录下使用的mysql文件夹,执行sh xx/bin/mysqld_safe

梳理:

mysql作为基本环境,使用环境都已安装,上学学习数据库相关也遗忘,梳理之。

[mysql 和 mysqld]

mysql (sometimes referred to as the “terminal monitor” or just “monitor”) is an interactive program that enables you to connect to a MySQL server, run queries, and view the results. mysql may also be used in batch mode: you place your queries in a file beforehand, then tell mysql to execute the contents of the file. Both ways of using mysql are covered here. 简单理解mysql为一条语句

mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files.mysqld 为后台server,所有client都需要通过mysqld去连接

mysqld_safe is the recommended way to start a mysqld server on Unix. mysqld_safe adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log. 启动mysqld的脚本,读取的是对应目录下的etc/my.cof

【cannot connect】

A MySQL client on Unix can connect to the mysqld server in two different ways: By using a Unix socket file to connect through a file in the file system (default /tmp/mysql.sock), or by using TCP/IP, which connects through a port number. A Unix socket file connection is faster than TCP/IP, but can be used only when connecting to a server on the same computer. A Unix socket file is used if you do not specify a host name or if you specify the special host name localhost.

https://dev.mysql.com/doc/refman/5.7/en/can-not-connect-to-server.html



原文地址:https://www.cnblogs.com/matric/p/8476647.html

时间: 2024-11-06 09:37:36

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection的相关文章

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection;

解决报错 This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Jan 07 21:06:43 CST 2020 There was an unexpected error (type=Internal Server Error, status=500). nested exception is org.apache.ibatis.exceptions.Pers

springMVC中出现Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:怎么办

出现这个是因为你的数据库没有连接上导致的 检查以下几个地方 1.你的db.properties文件是否配置正确    useUnicode=true&&characterEncoding=UTF-8表示你设置的编码为utf-8保证与数据库的一致   防止乱码 2.检查你的spring/applicationContext-dao.xml是否配置了数据源   而且是否配置正确 3.你的连接名是否是正确的和你在db.properties中配置的是否一样 . 4.你电脑中的服务是否打开 5.检查

org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection

org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot cr

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for …

编译通过并且运行web成功后,访问的页面不需要连接数据库,不牵扯到反射调用实体类就不会报错, 报错内容如下: [WARNING] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exce

jdbc连接oracle时报错 Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableC

错误: Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure Last packet sent

mybatis查询异常-Error querying database. Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List

背景,mybatis查询的时候直接取的sqlsession,没有包装成SqlSessionTemplate,没有走spring提供的代理. 然后我写的获取sqlsession的代码没有考虑到并发的情况,导致sqlsession建的太多 并发大了之后,查询报错 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.ClassCastException: org

搭建Mybatis 出现 Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mapper.BatchCustomer.findBatchCustomerOneToOne

Error querying database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for mapper.BatchCustomer.findBatchCustomerOneToOne### Cause: java.lang.IllegalArgumentException: Mapped Statements collection does

Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCustom

再用 junit 测试MyBatis时发现的错误: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'ItemsCustom' in 'class com.pojo.OrderDetailCust

Mybatis报错 Error querying database. Cause: org.apache.ibatis.reflection.ReflectionException: Error instantiating class com.me.mybatis.pojo.Orders with invalid types () or values ().

在学mybaits的时候遇到了这个错误,而且卡住了我三个小时也找不到,最后分析出来不能初始化类,然后就结合着之前自己以前的一点经验发现只有有参构造没有无参构造,因此只需要添加上无参构造就可以了. 错误源码 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  Cause: org.apache.ibatis.reflection.ReflectionException: Error ins