当前位置:网站首页>Pure white tutorial using Druid database connection pool in idea
Pure white tutorial using Druid database connection pool in idea
2022-07-24 05:26:00 【Xinxin vegetation】
1. download druid Related documents
Official download website https://repo1.maven.org/maven2/com/alibaba/druid/1.2.6/
Download these three jar After the document , Put three files in the same folder 

Add : What is? jar file ?
In the field of software ,JAR file (Java file , English :Java ARchive) Is a package file format , Usually used to aggregate a large number of Java Class file 、 Related metadata and resources ( Text 、 Pictures, etc ) File to a file , To distribute Java Platform applications or libraries .
2. stay idea Import druid and mysql

Left click druid-1.2.6jar file , Choose ,ctrl+c Key Copy .
With jdbc_demo Module as an example .
Right click jdbc_demo, Click New , Click on the table of contents , Name it lib, determine .
Left click lib Catalog 
Press ctrl+v Realization Paste 
Click ok 
You can see this jar Documents and in lib Inside the folder .
then
Right click druid-1.2.6jar, Click Add to Library ( The last line )
In the same way , take mysql-connector-java-8.0.29 Import and add to the Library
The premise is that you downloaded mysql 了 .
mysql Please search the tutorial separately for the installation configuration of .
Recommend a software ,everythingeverything Download address You can quickly find the desired file and get the location address 
3. To configure
stay src New file in , Name it druid.properties
stay druid.properties Paste the following code into the file
#druid File configuration ,MySQL edition 8.0.29,druid edition 1.2.6//
driverClassName = com.mysql.cj.jdbc.Driver
# Fill in your own database name in the database name below ,password Fill in your own database password
#url = jdbc:mysql://localhost:3306/ Database name ?useUnicode=true&characterEncoding=utf-8&userSSL=false&serverTimezone=GMT%2B8
url=jdbc:mysql://localhost:3306/datebase2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=CONVERT_TO_NULL&allowPublicKeyRetrieval=true
username=root
password=*******
# Number of initial connections
initialSize = 5
# maximum connection
maxActive = 10
# Maximum timeout
maxWait = 3000
complete
边栏推荐
猜你喜欢

栈与队列的互相实现(C)

JMeter upload and download files

C语言从入门到入土(一)

递归还能这么玩?递归实现扫雷游戏

【Pytorch】conv2d torchvision.transforms

How can NFT, whose stars enter the market against the market, get out of the independent market?

SSM整合

OSS file upload

A collation of the basic usage of numpy

Scikit learn -- steps of machine learning application development
随机推荐
ssm的整合
【深度学习】(三)图像分类
Relational database 10 minutes to understand MySQL
【Pytorch】nn.Module
C语言从入门到入土(二)
反射
【STL】Map &unordered_map
谈谈对未来的想法
模拟加法 & 结构体基本用法
文本摘要 ACL2021
【Pytorch】Dataset_DataLoader
空杯心态,重新开始
【常用技巧】
Jsp+dao integration
Implementation and comparison of nine sorting (ten thousand words summary)
Generics and annotations
web开发
Detailed explanation of string constant pool and intern() of string
T 6-10
利用二分法从数组中寻找具体数值