In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the use of JDBC driver package", friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what's the use of the JDBC driver package"?
JDBC connection pool is mainly used to manage objects such as Connnection, Statement and ResultSet, but users only get their proxy objects (the management of these objects needs to be implemented by simulation drivers). These proxy objects also follow the JDBC interface specification, and these native objects are built through JDBC drivers, so let's take a look at how these objects are built inside the driver. Take MySQL driver (mysql-connector-java-5.1.48.jar) as an example
Step 1: extract the Jar package: first use the Winrar tool to extract the package
Step 2: find the directory where the driver class is located
Step 3: find the Connnection, Statement, ResultSet implementation classes under the package
Step 4: drag these three classes into Idea using the mouse, and they will be decompiled automatically
Step 5: see how Connection creates Statement and PreparedStatement
StatementImpl stmt = new StatementImpl (this.getMultiHostSafeProxy (), this.database)
* the driver itself supports PreparedStatement cache
Let's take a look at how it is turned off (Close)
Synchronization method off
Automatically closes the Statement,PreparedStatement,CallableStatement opened by it when the connection is closed
Step 6: take a look at the Statement internal implementation class
Put the openStatements property (CopyOnWriteArrayList) of ConnectionImpl when constructing
When Statement is turned off, it is automatically removed from the openStatements attribute (CopyOnWriteArrayList) of ConnectionImpl
Many business methods have this:
Synchronized (this.checkClosed () .getConnectionMutex ())
Such code actually only locks the Connection object.
* think again about the three-level shutdown check of the Little Bee connection Pool (BeeCP). Is it a bit similar?
How the driver package of Oracle is implemented (ojdbc7-12.1.0.2.jar) is actually similar internally.
Take a look at an example of stealing a beam for a post.
At this point, I believe you have a deeper understanding of "what is the use of the JDBC driver package?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.