当前位置:网站首页>Learn how to get a database connection with JDBC
Learn how to get a database connection with JDBC
2022-07-31 06:23:00 【slx9920】
1. Preparations
1.1 Import JDBC jar package
First, we need a jar package for the JDBC driver, which you can download from the official website.
- Oracle's driver: oracle.jdbc.driver.OracleDriver
- MySQL driver: com.mysql.jdbc.Driver
Next, import the JDBC jar package into the IDEA class library: press Ctrl+Shift+Alt+s to open Project Structure, click "+",Select Java, find the storage location of your JDBC, and click OK.
The following means the import was successful
1.2 create a database in MySQL
Ideas
You can use Maven to manage the project download and import JDBC jar package. I have not tried this method. Interested friends can try it. I also want to know!
2. Create a configuration file
As follows, first create a file, here I created it under the corresponding package, of course, you can also create it under the src of the project, and write the basic information of the database connection
3. Write code
It works perfectly, very nice, perfect,
边栏推荐
猜你喜欢
Cholesterol-PEG-DBCO 胆固醇-聚乙二醇-二苯基环辛炔化学试剂
【解决问题】RuntimeError: The size of tensor a (80) must match the size of tensor b (56) at non-singleton
pyspark.ml feature transformation module
DC-CDN学习笔记
MySQL 入门:Case 语句很好用
VS2017连接MYSQL
计算图像数据集均值和方差
wangeditor编辑器内容传至后台服务器存储
Tencent Cloud GPU Desktop Server Driver Installation
CLS-PEG-FITC Fluorescein-PEG-CLS 胆固醇-聚乙二醇-荧光素简介
随机推荐
pytorch学习笔记10——卷积神经网络详解及mnist数据集多分类任务应用
学习JDBC之获取数据库连接的方式
Cholesterol-PEG-Thiol CLS-PEG-SH 胆固醇-聚乙二醇-巯基
多元线性回归方程原理及其推导
Notes on creating a new virtual machine in Hyper-V
Cholesterol-PEG-Azide CLS-PEG-N3 Cholesterol-PEG-Azide MW:3400
opencv之图像二值化处理
深度学习知识点杂谈
jenkins +miniprogram-ci upload WeChat applet with one click
应用usb_cam同时打开多个摄像头方法
Fluorescein-PEG-DSPE Phospholipid-Polyethylene Glycol-Fluorescein Fluorescent Phospholipid PEG Derivatives
Numpy常用函数
禅道安装及使用教程
np.fliplr与np.flipud
为数学而歌之伯努利家族
数据预处理、特征工程和特征学习-摘抄
unicloud cloud development record
cv2.imread()
Tencent Cloud GPU Desktop Server Driver Installation
box-shadow相关属性