数据库连接超时问题(求解)
问题出现的背景: 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、把其中一个数据源配置去掉,运行也没问题。
综上,怀疑:
是不是不能同时引用多个不同数据源?但此理由好像完全站不住脚。
是不是有可能和网络(数据库服务器)有关?
=求解

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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

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.

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())

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.

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
