10 years later, I saw such code.

Source: Internet
Author: User


While (rs. next ()){
Count ++;
String ip = rs. getString ("ip ");
Int port = rs. getInt ("port ");
String type = rs. getString ("type ");
LOG. debug (count + "get" + type + "proxy:" + ip + ":" + port );
Try {
CheckSocksProxy (ip, port, type );
} Catch (Throwable e ){
LOG.info ("check error,", e );
}
}


I am not saying that it is not good to use jdbc directly. In some special business scenarios, only one data fetch operation is required, and the data is retrieved every hour or day. You can simply use jdbc to simplify the operation.

However, the checkSocksProxy operation is performed when the connection is not released in the result set. This operation takes several hours, and the database connection is occupied by the entire checkSocksProxy.

If it is released, the database will be immediately dragged to death.

When there is no orm tool in the past, we will directly import it to CacheedResultSet to release the connection immediately, and then slowly access CacheedResultSet. Now the orm framework is so mature that each data request can directly obtain a container, the underlying connection will be released, which is the minimum principle.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.