Tags: cal common data Source Comm HTTPS creates interface complex RGScollection (+) Tomcat has been using COMMONS-DBCP as a connection pool for the previous version of 7.0, but DBCP has been criticised for the following reasons:
DBCP is single-threaded, in order to ensure that the entire connection pool is locked by the line Shuo plenary
DBCP Poor performance
DBCP is too complex, more than
Label:JDBC Core API Java.sql.* and Javax.sql.* |-Driver Interface: Represents the Java driver interface. All of the specific database vendors are going to implement this interface. |-Connect (URL, properties): A way to connect to a database. URL: The URL of the connection database URL syntax: JDBC Protocol: Database Sub-protocol://HOST: Port/Database User: Username for database Password: Database user pass
acquisition are The Abstractplatformtransactionmanager.gettransaction method completes theFor @transaction (propagation=propagation.supports), lazy gets connection when lazy gets the session, and only when the database operation is actually attempted.The simple stack that gets connection is as follows.Connectionmanager.openconnection () line:446//Note: Find no connecti
= drivermanager.getconnection (URL, prop);Interface
The Java.sql class DriverManager in driver
Common methods are: getconnection (string url, string user, string password) attempt to establish a connection to a given database URL.
Connection interfac
On the basis of jdbc, advanced step C3p0 connection pool (DBCP cannot read xml configuration files and has been eliminated) and use of two main classes of QueryRunner and ResultSetHandler in DBUtils,
First, check the C3p0 connection pool. The biggest advantage is that the default configuration file can be automatically read.
The configuration file contains four
/** the JDBC database driver. */Specifies the connection driver public static final String db_driver = "DRIVER"; /** the JDBC database URL. */connection string public static final Strin
attempted Gets the connection. Get a simple stack of connection such as the following. ConnectionManager. Open Connection () line:446 // Note: Find no connection, get a connection from the thread pool Connectionmanager.getconnection () line:167 Batchingbatcher (Abstractbat
Skills | Connecting to a database Java database connection (JDBC) consists of a set of classes and interfaces written in the Java programming language. JDBC provides tools/database developers with a standard API that enables them to write database applications with a pure Java API. However, each developer's interface is not exactly the same, so the development en
Recently, I was working on an azure Cloud project. The front-end is the Java code. The Java code uses the JDBC driver to access SQL azure.
After a JDBC connection string is used, it is found that the connection times out in about 2 minutes, and it can work normally on SQL Se
Label:Java provides a series of API--JDBC for database programming, in fact, it is through the interface defines a set of access to the database specification, and the implementation of these specifications are the database vendors, and the interface implementation encapsulated as. jar package, and we programmers only need to get the database vendor encapsulated. jar Package, The JDBC API is called to conne
(this machine is generally default to localhost);Port: Port number, default 3306
————————— SQL Server ——————Drive: Com.microsoft.jdbc.sqlserver.SQLServerDriverurl:jdbc:microsoft:sqlserver://Note: machine_name: The name of the machine where the database is located;Port: Port number, default is 1433
———————— –db2 ———————— – Driver: Com.ibm.db2.jdbc.app.DB2Driver url:jdbc:db2:// Note: machine_name: The name of the machine on which the database resides (port default 5000) here, for example, My
.jar.
First, see a class for database connection. In actual development, this class is used as a tool class, put it in the util package, and name it JdbcUtil.
Package util; import java. SQL. connection; import java. SQL. driverManager; import java. SQL. SQLException; public class JdbcUtil {public static Connection getConnection () {
static void Main (string[] args) {3 Connection conn=null;
4 Statement Stmt=null;
5 ResultSet Rs=null; 6 list In fact, we can continue to encapsulate, to encapsulate the traversal result set. 1 public class TestDQL5 {2 3 public static void main (string[] args) {4 Connection conn=null;
5 Statement Stmt=null;
6 Re
//when JDBC closes a database connection, it implies a commit transaction operation private final static String Db_driver="Oracle.jdbc.driver.OracleDriver"; Private final static String db_connection="Jdbc:oracle:thin:@127.0.0.1:1521: Mydb01 "; Private final static Stringdb_name ="Scott"; Private final static
: Project right mouse button Project->properties->java Build path->libraries->add External jars-> Find SQLJDBC4 LoadWhy put a database driver package into a project instead of the entire system?Put into the system, the project and the project will have an impact, different versions of the jar package will create a conflict2 Registration to DriverManagerDriverManager: Basic service for managing databases, to connect to a database, you need to register with DriverManager. (Autoenrollment when inst
Tomcat has been using COMMONS-DBCP as a connection pool for the previous version of 7.0, but DBCP has been criticised for the following reasons:
DBCP is single-threaded, in order to ensure that the entire connection pool is locked by the line Shuo plenary
DBCP Poor performance
DBCP is too complex, more than 60 classes
DBCP using static interface, compile in JDK 1.6 problem
DBCP Deve
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.