Home Database Mysql Tutorial 数据库连接超时问题(求解)

数据库连接超时问题(求解)

Jun 07, 2016 pm 03:41 PM
app Appear database Solve background time out connect question

问题出现的背景: APP框架,生产者和消费者模式,数据源配置包括mysql(mysql的分支maria DB)的数据源和oracle。 问题描述: 初始化时注册c3p0没有问题,在第一次使用数据库连接(此时创建c3p0连接池)时也没异常,但获取数据库连接时异常(如下): java.s

问题出现的背景:

APP框架,生产者和消费者模式,数据源配置包括mysql(mysql的分支maria DB)的数据源和oracle。

问题描述:

初始化时注册c3p0没有问题,在第一次使用数据库连接(此时创建c3p0连接池)时也没异常,但获取数据库连接时异常(如下):

java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

......

Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@6bf51e5c -- timeout at awaitAvailable()

......

java.lang.IllegalArgumentException: Connection must not be null

......

问题出现的规律:

无规律可言,时不时的,有时候隔一次出现一次连接超时,有时候可能连续几次都会超时。但只要第一次连接成功,运行就没问题。

 

造成数据库连接超时问题的原因,网上解释很多,大都是和c3p0配置有关,但都不能解决上述问题。

 

可能的原因分析:

和数据源有关。

为什么这么说?

1、之前项目(只有oracle数据源)运行一直没问题,本次改动就是新增了mysql(mysql的分支maria DB)数据源。

2、把其中一个数据源配置去掉,运行也没问题。

综上,怀疑:

是不是不能同时引用多个不同数据源?但此理由好像完全站不住脚。

是不是有可能和网络(数据库服务器)有关?

=求解

 

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Steps and precautions for registering a Hong Kong Apple ID (enjoy the unique advantages of the Hong Kong Apple Store) Steps and precautions for registering a Hong Kong Apple ID (enjoy the unique advantages of the Hong Kong Apple Store) Sep 02, 2024 pm 03:47 PM

Apple's products and services have always been loved by users around the world. Registering a Hong Kong Apple ID will bring more convenience and privileges to users. Let’s take a look at the steps to register a Hong Kong Apple ID and what you need to pay attention to. How to register a Hong Kong Apple ID When using Apple devices, many applications and functions require using Apple ID to log in. If you want to download applications from Hong Kong or enjoy the preferential content of the Hong Kong AppStore, it is very necessary to register a Hong Kong Apple ID. This article will detail the steps on how to register a Hong Kong Apple ID and what you need to pay attention to. Steps: Select language and region: Find the "Settings" option on your Apple device and enter

Blackmagic\'s pro-level video app lands on Android, but your phone probably can\'t run it Blackmagic\'s pro-level video app lands on Android, but your phone probably can\'t run it Jun 25, 2024 am 07:06 AM

Blackmagic Design has finally brought its well-praised Blackmagic Camera app to Android. The professional video camera app is free to download, and it offers complete manual controls. These controls aim to make it easier for you to take pro-level cin

The birth background and original intention of Go language The birth background and original intention of Go language Apr 04, 2024 am 08:48 AM

The Go language was born at Google to solve the problems of complexity and insufficient concurrency support of C++. Its original intention is to create a simple, easy-to-learn, efficient concurrency, memory-safe, cross-platform language to improve programmer productivity, build reliable and scalable systems, and promote code porting and sharing.

What to do if Meituan's errand delivery times out_How to deal with Meituan's errand delivery timeout What to do if Meituan's errand delivery times out_How to deal with Meituan's errand delivery timeout Mar 28, 2024 am 09:26 AM

1. First of all, when taking out food, you need to know whether the order is delivered by the merchant itself or by Meituan. Generally speaking, the order receiving efficiency of the merchant's self-delivery is low and timeouts often occur. However, since Meituan is not involved in the delivery, there is no timeout. Compensation principle. At this time, you can check to see if the order submitted contains a compensation clause for overtime delivery. If there is a relevant clause in the claim, there is no need to say more, the merchant will claim the claim. If there are no relevant rules, it is recommended that you leave a negative review or leave a message about the meal delivery service on the platform, or contact the merchant directly to complain about the delivery service so as to negotiate compensation. If you really can't negotiate, you can only admit that you are out of luck. Please pay more attention next time. 2. Overtime compensation model: The merchant promises a delivery time and a discount, and receives payment from the user

How to change the background color of photos on Meitu Xiuxiu How to change the background color of photos on Meitu Xiuxiu Apr 08, 2024 pm 03:56 PM

1. Open the Meitu Xiu Xiu software, select [Picture Beautification], and import photos from the album. 2. Click [Cutting] on the bottom toolbar and select the [Background Replacement] function. 3. In the [Background] option, select the desired background color from the solid color box, or upload a custom image. 4. After confirming the selection, click [Save] to complete the background color change.

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

See all articles