当前位置:网站首页>Connect orcale
Connect orcale
2022-04-23 12:57:00 【Look at the data at the top of the mountain】
package com.asiniafo.dpi_new.dpi.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
* Connect oracle
*/
public class DBUtilSjzx {
private static String driver = "oracle.jdbc.driver.OracleDriver";
private static String url = "jdbc:oracle:thin:@ip: port : Database name ";
private static String username = "";
private static String password = "";
public static Connection getConnection() {
Connection con = null;
try {
Class.forName(driver);
con = DriverManager.getConnection(url,username,password);
return con;
}catch (Exception e){
e.printStackTrace();
}
return con;
}
/**
* close oracle Database connection
*/
public static void close(Connection con, PreparedStatement pstmt, ResultSet rs){
// close rs
try {
if (rs != null && !(rs.isClosed())){
rs.close();
}
}catch (Exception e){
e.printStackTrace();
}
// close PreparedStatement
try {
if (pstmt != null && !(pstmt.isClosed())){
pstmt.close();
}
}catch (Exception e ){
e.printStackTrace();
}
// close Connection
try {
if (con != null && !(con.isClosed())){
con.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
}
版权声明
本文为[Look at the data at the top of the mountain]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230615024700.html
边栏推荐
- Golang realizes regular matching: the password contains at least one digit, letter and special character, and the length is 8-16
- Customize classloader and implement hot deployment - use loadclass
- Packet capturing and sorting -- TCP protocol [8]
- Unable to create servlet under SRC subfile of idea
- 【蓝桥杯】4月17日省赛刷题训练(前3道题)
- Golang implements a five insurance and one gold calculator with web interface
- V-model binding value in El select, data echo only displays value, not label
- 21 天学习MongoDB笔记
- 云原生KubeSphere部署Redis
- Servlet监听器&过滤器介绍
猜你喜欢

The accuracy and speed are perfectly balanced, and the latest image segmentation SOTA model is released!!!

MySQL supports IP access

mysql中 innoDB执行过程分析

Labels and paths

梳理網絡IP代理的幾大用途

Synchronously update the newly added and edited data to the list

SSM framework series - annotation development day2-2

Calculate the past date and days online, and calculate the number of live days

风尚云网学习-h5的input:type属性的image属性

标签与路径
随机推荐
box-sizing
Idea的src子文件下无法创建servlet
BaseRecyclerViewAdapterHelper 实现下拉刷新和上拉加载
Software testing weekly (issue 68): the best way to solve difficult problems is to wait and see the changes and push the boat with the current.
Record the problems encountered in using v-print
mysql支持ip访问
V-model binding value in El select, data echo only displays value, not label
Start mqbroker CMD failure resolution
Record Alibaba cloud server mining program processing
22. 括号生成
[csnote] ER diagram
BUUCTF WEB [BJDCTF2020]The mystery of ip
No idle servers? Import OVF image to quickly experience smartx super fusion community version
Recommended website for drawing result map
C#,二维贝塞尔拟合曲线(Bézier Curve)参数点的计算代码
Aviation core technology sharing | overview of safety characteristics of acm32 MCU
4.DRF 权限&访问频率&过滤&排序
Go language array operation
The quill editor image zooms, multiple rich text boxes are used on one page, and the quill editor upload image address is the server address
只是不断地建构平台,不断地收拢流量,并不能够做好产业互联网