Table of Contents
基本问题解决
项目环境:
错误描述:
报错日志:
原因分析:
解决这个问题的办法有三种,推荐第二种):" >解决方案(解决这个问题的办法有三种,推荐第二种):
1. 增加 MySQL 的 wait_timeout 属性的值 
2. 减少连接池内连接的生存周期
3. 定期使用连接池内的连接
知识扩展
C3P0" >C3P0
Home Database Mysql Tutorial 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案_MySQL

使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案_MySQL

Jun 01, 2016 pm 01:17 PM
database solution project

本文提供了对c3p0与DBCP连接池连接MySql数据库时, 8小时内无请求自动断开连接的解决方案。首先介绍一下我在项目(c3p0连接池)中遇到的问题,后面还提供了使用DBCP连接池的解决方案。

基本问题解决

项目环境:

Java Web项目框架为Spring MVC+JPA,使用c3p0连接池,发布环境为Tomcat 7

错误描述:

项目运行一段时间(大概几个小时)之后访问时会出现第一次访问报错,再次访问正常的现象,且多次出现此问题。

报错日志:

[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片

  1. org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed:   
  2.     at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:428)  
  3.     at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)  
  4.     at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)  
  5.     at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)  
  6.     at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)  
  7.     at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)  
  8.     at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)  
  9.     at com.appcarcare.cube.service.UserService$$EnhancerByCGLIB$$a4429cba.getUserDao()  
  10.   
  11.     at com.appcarcare.cube.servlet.DataCenterServlet$SqlTimer.connectSql(DataCenterServlet.java:76)  
  12.     at com.appcarcare.cube.servlet.DataCenterServlet$SqlTimer.run(DataCenterServlet.java:70)  
  13.     at java.util.TimerThread.mainLoop(Timer.java:555)  
  14.     at java.util.TimerThread.run(Timer.java:505)  
  15. Caused by: javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed:   
  16.     at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)  
  17.     at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)  
  18.   
  19.     at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397)  
  20.     at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:62)  
  21.     at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:71)  
  22.     at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:60)  
  23.     at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:378)  
  24.     ... 11 more  
  25. Caused by: org.hibernate.TransactionException: JDBC begin transaction failed:   
  26.     at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:76)  
  27.     at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)  
  28.   
  29.     at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1426)  
  30.     at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59)  
  31.     ... 14 more  
  32. Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure  
  33.   
  34. The last packet successfully received from the server was 1,836,166 milliseconds ago.  The last packet sent successfully to the server was 29,134 milliseconds ago.  
  35.     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
  36.     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)  
  37.     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
  38.     at java.lang.reflect.Constructor.newInstance(Constructor.java:526)  
  39.     at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)  
  40.     at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)  
  41.     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3567)  
  42.     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3456)  
  43.   
  44.     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3997)  
  45.     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)  
  46.     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)  
  47.     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)  
  48.     at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5060)  
  49.     at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)  
  50.     at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:72)  
  51.   
  52.     ... 17 more  
  53. Caused by: java.net.SocketException: Software caused connection abort: recv failed  
  54.     at java.net.SocketInputStream.socketRead0(Native Method)  
  55.     at java.net.SocketInputStream.read(SocketInputStream.java:150)  
  56.     at java.net.SocketInputStream.read(SocketInputStream.java:121)  
  57.     at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)  
  58.     at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)  
  59.     at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)  
  60.     at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3014)  
  61.     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3467)  
  62.     ... 25 more  
org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed: 
	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:428)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:255)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
	at com.appcarcare.cube.service.UserService$EnhancerByCGLIB$a4429cba.getUserDao(<generated>)

	at com.appcarcare.cube.servlet.DataCenterServlet$SqlTimer.connectSql(DataCenterServlet.java:76)
	at com.appcarcare.cube.servlet.DataCenterServlet$SqlTimer.run(DataCenterServlet.java:70)
	at java.util.TimerThread.mainLoop(Timer.java:555)
	at java.util.TimerThread.run(Timer.java:505)
Caused by: javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed: 
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1387)
	at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1310)

	at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1397)
	at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:62)
	at org.springframework.orm.jpa.DefaultJpaDialect.beginTransaction(DefaultJpaDialect.java:71)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.beginTransaction(HibernateJpaDialect.java:60)
	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:378)
	... 11 more
Caused by: org.hibernate.TransactionException: JDBC begin transaction failed: 
	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:76)
	at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)

	at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1426)
	at org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:59)
	... 14 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 1,836,166 milliseconds ago.  The last packet sent successfully to the server was 29,134 milliseconds ago.
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
	at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3567)
	at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3456)

	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3997)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2713)
	at com.mysql.jdbc.ConnectionImpl.setAutoCommit(ConnectionImpl.java:5060)
	at com.mchange.v2.c3p0.impl.NewProxyConnection.setAutoCommit(NewProxyConnection.java:881)
	at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:72)

	... 17 more
Caused by: java.net.SocketException: Software caused connection abort: recv failed
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:150)
	at java.net.SocketInputStream.read(SocketInputStream.java:121)
	at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:114)
	at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:161)
	at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:189)
	at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3014)
	at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3467)
	... 25 more</generated>
Copy after login

 


原因分析:

MySQL服务器默认的“wait_timeout”是28800秒即8小时,意味着如果一个连接的空闲时间超过8个小时,MySQL将自动断开该连接,而连接池却认为该连接还是有效的(因为并未校验连接的有效性),当应用申请使用该连接时,就会导致上面的报错。

解决方案(解决这个问题的办法有三种,推荐第二种):

 

1. 增加 MySQL 的 wait_timeout 属性的值 

修改mysql安装目录下的配置文件 my.ini文件(如果没有此文件,复制“my-default.ini”文件,生成“复件 my-default.ini”文件。将“复件 my-default.ini”文件重命名成“my.ini” ),在文件中设置: 

[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片

  1. wait_timeout=31536000  
  2. interactive_timeout=31536000  
wait_timeout=31536000
interactive_timeout=31536000
Copy after login

这两个参数的默认值是8小时(60*60*8=28800)。

注意: 1.wait_timeout的最大值只允许2147483 (24天左右)

2.修改配置文件为网上大部分文章所提供的方式,也可以使用mysql命令对这两个属性进行修改



2. 减少连接池内连接的生存周期

减少连接池内连接的生存周期,使之小于上一项中所设置的wait_timeout 的值 

修改 c3p0 的配置文件,在 Spring 的配置文件中设置:

[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片

  1. "dataSource"  class="com.mchange.v2.c3p0.ComboPooledDataSource">       
  2. "maxIdleTime"value="1800"/>    
  3.     
  4.   
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">  	
	<property name="maxIdleTime" value="1800"></property>  
	<!--other properties -->  
	</bean>
Copy after login

3. 定期使用连接池内的连接

定期使用连接池内的连接,使得它们不会因为闲置超时而被 MySQL 断开。 

修改 c3p0 的配置文件,在 Spring 的配置文件中设置:

[java] view plaincopyprint?在CODE上查看代码片派生到我的代码片

  1.        "dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">    
  2. "preferredTestQuery" value="SELECT 1"/>    
  3. "idleConnectionTestPeriod" value="18000"/>    
  4. "testConnectionOnCheckout" value="true"/>    
  5.   
        <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">  
	<property name="preferredTestQuery" value="SELECT 1"></property>  
	<property name="idleConnectionTestPeriod" value="18000"></property>  
	<property name="testConnectionOnCheckout" value="true"></property>  
	</bean>
Copy after login

知识扩展

C3P0

C3P0是一个开放源代码的JDBC连接池,它在lib目录中与Hibernate一起发布,包括了实现jdbc3和jdbc2扩展规范说明的Connection 和Statement 池的DataSources 对象。 c3p0配置文件

 

[html] view plaincopyprint?在CODE上查看代码片派生到我的代码片

  1. default-config>   
  2.      
  3.   property name="acquireIncrement">3property>   
  4.      
  5.   property name="acquireRetryAttempts">30property>   
  6.      
  7.   property name="acquireRetryDelay">1000property>   
  8.      
  9.   property name="autoCommitOnClose">falseproperty>   
  10.      
  11.   property name="idleConnectionTestPeriod">60property>   
  12.      
  13.   property name="initialPoolSize">3property>   
  14.      
  15.   property name="maxIdleTime">60property>   
  16.      
  17.   property name="maxPoolSize">15property>   
  18.      
  19.   property name="maxStatementsPerConnection">property>   
  20.      
  21.   property name="overrideDefaultPassword">passwordproperty>   
  22.      
  23.   property name="password">property>   
  24.      
  25.   property name="propertyCycle">300property>   
  26.      
  27.   property name="testConnectionOnCheckin">trueproperty>   
  28.      
  29.   property name="user">rootproperty>   
  30.   在Hibernate(spring管理)中的配置:   
  31.   bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">   
  32.   property name="driverClass">value>oracle.jdbc.driver.OracleDrivervalue>property>   
  33.   property name="jdbcUrl">value>jdbc:oracle:thin:@localhost:1521:Testvalue>property>   
  34.   property name="user">value>Kayvalue>property>   
  35.   property name="password">value>rootvalue>property>   
  36.      
  37.   property name="minPoolSize" value="10" />   
  38.      
  39.   property name="maxPoolSize" value="100" />   
  40.      
  41.   property name="maxIdleTime" value="1800" />   
  42.      
  43.   property name="acquireIncrement" value="3" />   
  44.   property name="maxStatements" value="1000" />   
  45.   property name="initialPoolSize" value="10" />   
  46.      
  47.   property name="idleConnectionTestPeriod" value="60" />   
  48.      
  49.   property name="acquireRetryAttempts" value="30" />   
  50.   property name="breakAfterAcquireFailure" value="true" />   
  51.   property name="testConnectionOnCheckout" value="false" />   
  52.   bean>   
  53.   ###########################   
  54.   ### C3P0 Connection Pool###   
  55.   ###########################   
  56.   #hibernate.c3p0.max_size 2   
  57.   #hibernate.c3p0.min_size 2   
  58.   #hibernate.c3p0.timeout 5000   
  59.   #hibernate.c3p0.max_statements 100   
  60.   #hibernate.c3p0.idle_test_period 3000   
  61.   #hibernate.c3p0.acquire_increment 2   
  62.   #hibernate.c3p0.validate false   
  63.   在hibernate.cfg.xml文件里面加入如下的配置:   
  64.      
  65.   property name="hibernate.c3p0.max_size">20property>   
  66.      
  67.   property name="hibernate.c3p0.min_size">5property>   
  68.      
  69.   property name="hibernate.c3p0.timeout">120property>   
  70.      
  71.   property name="hibernate.c3p0.max_statements">100property>   
  72.      
  73.   property name="hibernate.c3p0.idle_test_period">120property>   
  74.      
  75.   property name="hibernate.c3p0.acquire_increment">2property>   
  76.      
  77.   property name="hibernate.c3p0.validate">trueproperty>  
Copy after login
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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 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)

Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Can AI conquer Fermat's last theorem? Mathematician gave up 5 years of his career to turn 100 pages of proof into code Apr 09, 2024 pm 03:20 PM

Fermat's last theorem, about to be conquered by AI? And the most meaningful part of the whole thing is that Fermat’s Last Theorem, which AI is about to solve, is precisely to prove that AI is useless. Once upon a time, mathematics belonged to the realm of pure human intelligence; now, this territory is being deciphered and trampled by advanced algorithms. Image Fermat's Last Theorem is a "notorious" puzzle that has puzzled mathematicians for centuries. It was proven in 1993, and now mathematicians have a big plan: to recreate the proof using computers. They hope that any logical errors in this version of the proof can be checked by a computer. Project address: https://github.com/riccardobrasca/flt

Implementing Machine Learning Algorithms in C++: Common Challenges and Solutions Implementing Machine Learning Algorithms in C++: Common Challenges and Solutions Jun 03, 2024 pm 01:25 PM

Common challenges faced by machine learning algorithms in C++ include memory management, multi-threading, performance optimization, and maintainability. Solutions include using smart pointers, modern threading libraries, SIMD instructions and third-party libraries, as well as following coding style guidelines and using automation tools. Practical cases show how to use the Eigen library to implement linear regression algorithms, effectively manage memory and use high-performance matrix operations.

How does Go language implement the addition, deletion, modification and query operations of the database? How does Go language implement the addition, deletion, modification and query operations of the database? Mar 27, 2024 pm 09:39 PM

Go language is an efficient, concise and easy-to-learn programming language. It is favored by developers because of its advantages in concurrent programming and network programming. In actual development, database operations are an indispensable part. This article will introduce how to use Go language to implement database addition, deletion, modification and query operations. In Go language, we usually use third-party libraries to operate databases, such as commonly used sql packages, gorm, etc. Here we take the sql package as an example to introduce how to implement the addition, deletion, modification and query operations of the database. Assume we are using a MySQL database.

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.

Java framework security vulnerability analysis and solutions Java framework security vulnerability analysis and solutions Jun 04, 2024 pm 06:34 PM

Analysis of Java framework security vulnerabilities shows that XSS, SQL injection and SSRF are common vulnerabilities. Solutions include: using security framework versions, input validation, output encoding, preventing SQL injection, using CSRF protection, disabling unnecessary features, setting security headers. In actual cases, the ApacheStruts2OGNL injection vulnerability can be solved by updating the framework version and using the OGNL expression checking tool.

An in-depth analysis of how HTML reads the database An in-depth analysis of how HTML reads the database Apr 09, 2024 pm 12:36 PM

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.

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

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

See all articles