当前位置:网站首页>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,
边栏推荐
猜你喜欢

学习JDBC之获取数据库连接的方式

mPEG-DMPE Methoxy-polyethylene glycol-bismyristyl phosphatidylethanolamine for stealth liposome formation

jenkins +miniprogram-ci upload WeChat applet with one click

CAS:474922-22-0 Maleimide-PEG-DSPE 磷脂-聚乙二醇-马来酰亚胺简述

CAS:1403744-37-5 DSPE-PEG-FA 科研实验用磷脂-聚乙二醇-叶酸

DC-CDN学习笔记

Pytorch学习笔记7——处理多维特征的输入

Flutter mixed development module dependencies

mPEG-DSPE 178744-28-0 甲氧基-聚乙二醇-磷脂酰乙醇胺线性PEG磷脂

Cholesterol-PEG-NHS NHS-PEG-CLS cholesterol-polyethylene glycol-active ester can modify small molecular materials
随机推荐
Tencent Cloud GPU Desktop Server Driver Installation
Shell/Vim相关list
如何修改数据库密码
MySQL 免安装版的下载与配置教程
Principle analysis of famous website msdn.itellyou.cn
opencv之图像二值化处理
jenkins +miniprogram-ci 一键上传微信小程序
Tensorflow边用边踩坑
OpenCV中的图像数据格式CV_8U定义
二进制转换成十六进制、位运算、结构体
Phospholipids-Polyethylene Glycol-Active Esters for Scientific Research DSPE-PEG-NHS CAS: 1445723-73-8
cocos2d-x implements cross-platform directory traversal
Hyperparameter Optimization - Excerpt
crontab的定时操作
2021-09-30
mPEG-DMPE 甲氧基-聚乙二醇-双肉豆蔻磷脂酰乙醇胺用于形成隐形脂质体
Shell/Vim related list
浏览器中的画中画(Picture-in-Picture)API
网页截图与反向代理
ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error