当前位置:网站首页>学习JDBC之获取数据库连接的方式
学习JDBC之获取数据库连接的方式
2022-07-31 05:17:00 【slx9920】
1、准备工作
1.1导入JDBC的jar包
首先,我们要有JDBC驱动的jar包,这个你去官网下载就行了。
- Oracle的驱动:oracle.jdbc.driver.OracleDriver
- MySQL的驱动:com.mysql.jdbc.Driver
接下来,将JDBC的jar包导入到IDEA的类库中:按Ctrl+Shift+Alt+s打开Project Structure,点击“+“,选择Java,找到你JDBC的存储位置,点击OK即可。

如下则表示导入成功了
1.2在MySQL创建数据库

想法
这里可以使用Maven来管理工程下载导入JDBC的jar包,这种方式我没试过,有兴趣的小伙伴可以尝试下,我也想知道呀!
2、创建配置文件
如下,先创建一个文件,这里我在对应的包下创建的,当然你也可以在工程项目的src下创建,写上数据库连接的基本信息

3、编写代码

运行即可,很完美,非常nice,perfect,
边栏推荐
猜你喜欢

化学试剂磷脂-聚乙二醇-氨基,DSPE-PEG-amine,CAS:474922-26-4

MW:3400 4-Arm PEG-DSPE 四臂-聚乙二醇-磷脂一种饱和的18碳磷脂

Fluorescein-PEG-DSPE Phospholipid-Polyethylene Glycol-Fluorescein Fluorescent Phospholipid PEG Derivatives

Xiaomi mobile phone SMS location service activation failed

Why does read in bash need to cooperate with while to read the contents of /dev/stdin

pytorch学习笔记10——卷积神经网络详解及mnist数据集多分类任务应用

After unicloud is released, the applet prompts that the connection to the local debugging service failed. Please check whether the client and the host are under the same local area network.

CNN的一点理解

变分自编码器VAE实现MNIST数据集生成by Pytorch

Sourcery插件(自动提升代码质量)
随机推荐
Pytorch学习笔记13——Basic_RNN
softmax函数详解
多元线性回归方程原理及其推导
UiBot has an open Microsoft Edge browser and cannot perform the installation
DSPE-PEG-Azide DSPE-PED-N3 磷脂-聚乙二醇-叠氮脂质PFG
CAS:1403744-37-5 DSPE-PEG-FA 科研实验用磷脂-聚乙二醇-叶酸
cv2.resize()是反的
VS connects to MYSQL through ODBC (1)
朴素贝叶斯文本分类(代码实现)
opencv之图像二值化处理
cocos2d-x-3.2 image graying effect
Phospholipids-Polyethylene Glycol-Active Esters for Scientific Research DSPE-PEG-NHS CAS: 1445723-73-8
unicloud cloud development record
活体检测PatchNet学习笔记
flutter arr dependencies
2022年SQL大厂高频实战面试题(详细解析)
Cholesterol-PEG-Amine CLS-PEG-NH2 Cholesterol-Polyethylene Glycol-Amino Research Use
微信小程序源码获取与反编译方式
机器学习和深度学习概述
Android software security and reverse analysis reading notes