当前位置: 首页 > news >正文

apache commons-dbcp Apache Commons DBCP 软件实现数据库连接池 commons-dbcp2

DBCP组件

许多Apache项目支持与关系型数据库进行交互。为每个用户创建一个新连接可能很耗时(通常需要多秒钟的时钟时间),以执行可能需要毫秒级时间的数据库事务。对于一个公开托管在互联网上的应用程序,在同时在线用户数量可能非常大的情况下,为每个用户打开一个连接可能是不可行的。因此,开发人员通常希望在所有当前应用程序用户之间共享一组“池化”的打开连接。在任何给定时间实际执行请求的用户数量通常只是活跃用户总数的非常小的百分比,在请求处理期间是唯一需要数据库连接的时间。应用程序本身登录到DBMS,并在内部处理任何用户账户问题。

已经有几个数据库连接池可用,包括Apache产品内部和其他地方。这个Commons包提供了一个机会,来协调创建和维护一个高效、功能丰富的包,以Apache许可证发布。

commons-dbcp2依赖于commons-pool2中的代码,以提供底层的对象池机制。

不同版本

DBCP现在有四个不同的版本,支持不同版本的JDBC。

它的工作原理如下:

开发中

DBCP 2.5.0及以上版本在Java 8(JDBC 4.2)及以上版本下编译和运行。

DBCP 2.4.0在Java 7(JDBC 4.1)及以上版本下编译和运行。

运行中

应用程序运行在Java 8及以上版本的情况下,应使用DBCP 2.5.0及以上版本的二进制文件。 应用程序在Java 7下运行时应使用DBCP 2.4.0的二进制文件。 DBCP 2基于Apache Commons Pool,并提供了与DBCP 1.x相比性能增强、JMX支持以及许多其他新功能。升级到2.x的用户应该注意到Java包名称已更改,以及Maven坐标已更改,因为DBCP 2.x与DBCP 1.x不是二进制兼容的。用户还应该注意,一些配置选项(例如maxActive到maxTotal)已更名以与Commons Pool使用的新名称对齐。

入门例子

您可以从我们的下载页面下载源代码和二进制文件。

或者,您可以从中央 Maven 存储库中提取它:

maven 引入

<dependency><groupId>org.apache.commons</groupId><artifactId>commons-dbcp2</artifactId><version>2.9.0</version>
</dependency>

代码

https://github.com/apache/commons-dbcp/tree/HEAD/doc

BasicDataSourceExample

这个是最基本的例子,不涉及任何池化能力。

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;import javax.sql.DataSource;//
// Here are the dbcp-specific classes.
// Note that they are only used in the setupDataSource
// method. In normal use, your classes interact
// only with the standard JDBC API
//
import org.apache.commons.dbcp2.BasicDataSource;//
// Here's a simple example of how to use the BasicDataSource.
////
// Note that this example is very similar to the PoolingDriver
// example.//
// To compile this example, you'll want:
//  * commons-pool-2.3.jar
//  * commons-dbcp-2.1.jar 
// in your classpath.
//
// To run this example, you'll want:
//  * commons-pool-2.3.jar
//  * commons-dbcp-2.1.jar 
//  * commons-logging-1.2.jar
// in your classpath.
//
//
// Invoke the class using two arguments:
//  * the connect string for your underlying JDBC driver
//  * the query you'd like to execute
// You'll also want to ensure your underlying JDBC driver
// is registered.  You can use the "jdbc.drivers"
// property to do this.
//
// For example:
//  java -Djdbc.drivers=org.h2.Driver \
//       -classpath commons-pool2-2.3.jar:commons-dbcp2-2.1.jar:commons-logging-1.2.jar:h2-1.3.152.jar:. \
//       BasicDataSourceExample \
//       "jdbc:h2:~/test" \
//       "SELECT 1"
//
public class BasicDataSourceExample {public static void main(String[] args) {// First we set up the BasicDataSource.// Normally this would be handled auto-magically by// an external configuration, but in this example we'll// do it manually.//System.out.println("Setting up data source.");DataSource dataSource = setupDataSource(args[0]);System.out.println("Done.");//// Now, we can use JDBC DataSource as we normally would.//Connection conn = null;Statement stmt = null;ResultSet rset = null;try {System.out.println("Creating connection.");conn = dataSource.getConnection();System.out.println("Creating statement.");stmt = conn.createStatement();System.out.println("Executing statement.");rset = stmt.executeQuery(args[1]);System.out.println("Results:");int numcols = rset.getMetaData().getColumnCount();while(rset.next()) {for(int i=1;i<=numcols;i++) {System.out.print("\t" + rset.getString(i));}System.out.println("");}} catch (SQLException e) {e.printStackTrace();} finally {try {if (rset != null)rset.close();} catch (Exception e) {}try {if (stmt != null)stmt.close();} catch (Exception e) {}try {if (conn != null)conn.close();} catch (Exception e) {}}}public static DataSource setupDataSource(String connectURI) {BasicDataSource ds = new BasicDataSource();ds.setDriverClassName("org.h2.Driver");ds.setUrl(connectURI);return ds;}public static void printDataSourceStats(DataSource ds) {BasicDataSource bds = (BasicDataSource) ds;System.out.println("NumActive: " + bds.getNumActive());System.out.println("NumIdle: " + bds.getNumIdle());}public static void shutdownDataSource(DataSource ds) throws SQLException {BasicDataSource bds = (BasicDataSource) ds;bds.close();}
}

PoolingDataSourceExample

这里的 datasource 是池化的。

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;//
// Here are the dbcp-specific classes.
// Note that they are only used in the setupDataSource
// method. In normal use, your classes interact
// only with the standard JDBC API
//
import org.apache.commons.pool2.ObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.dbcp2.ConnectionFactory;
import org.apache.commons.dbcp2.PoolableConnection;
import org.apache.commons.dbcp2.PoolingDataSource;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;//
// Here's a simple example of how to use the PoolingDataSource.
////
// Note that this example is very similar to the PoolingDriver
// example.  In fact, you could use the same pool in both a
// PoolingDriver and a PoolingDataSource
////
// To compile this example, you'll want:
//  * commons-pool2-2.3.jar
//  * commons-dbcp2-2.1.jar
// in your classpath.
//
// To run this example, you'll want:
//  * commons-pool2-2.3.jar
//  * commons-dbcp2-2.1.jar
//  * commons-logging-1.2.jar
//  * the classes for your (underlying) JDBC driver
// in your classpath.
//
// Invoke the class using two arguments:
//  * the connect string for your underlying JDBC driver
//  * the query you'd like to execute
// You'll also want to ensure your underlying JDBC driver
// is registered.  You can use the "jdbc.drivers"
// property to do this.
//
// For example:
//  java -Djdbc.drivers=org.h2.Driver \
//       -classpath commons-pool2-2.3.jar:commons-dbcp2-2.1.jar:commons-logging-1.2.jar:h2-1.3.152.jar:. \
//       PoolingDataSourceExample \
//       "jdbc:h2:~/test" \
//       "SELECT 1"
//
public class PoolingDataSourceExample {public static void main(String[] args) {//// First we load the underlying JDBC driver.// You need this if you don't use the jdbc.drivers// system property.//System.out.println("Loading underlying JDBC driver.");try {Class.forName("org.h2.Driver");} catch (ClassNotFoundException e) {e.printStackTrace();}System.out.println("Done.");//// Then, we set up the PoolingDataSource.// Normally this would be handled auto-magically by// an external configuration, but in this example we'll// do it manually.//System.out.println("Setting up data source.");DataSource dataSource = setupDataSource(args[0]);System.out.println("Done.");//// Now, we can use JDBC DataSource as we normally would.//Connection conn = null;Statement stmt = null;ResultSet rset = null;try {System.out.println("Creating connection.");conn = dataSource.getConnection();System.out.println("Creating statement.");stmt = conn.createStatement();System.out.println("Executing statement.");rset = stmt.executeQuery(args[1]);System.out.println("Results:");int numcols = rset.getMetaData().getColumnCount();while(rset.next()) {for(int i=1;i<=numcols;i++) {System.out.print("\t" + rset.getString(i));}System.out.println("");}} catch (SQLException e) {e.printStackTrace();} finally {try {if (rset != null)rset.close();} catch (Exception e) {}try {if (stmt != null)stmt.close();} catch (Exception e) {}try {if (conn != null)conn.close();} catch (Exception e) {}}}// 这里的 datasource 是池化的。public static DataSource setupDataSource(String connectURI) {//// First, we'll create a ConnectionFactory that the// pool will use to create Connections.// We'll use the DriverManagerConnectionFactory,// using the connect string passed in the command line// arguments.//ConnectionFactory connectionFactory =new DriverManagerConnectionFactory(connectURI, null);//// Next we'll create the PoolableConnectionFactory, which wraps// the "real" Connections created by the ConnectionFactory with// the classes that implement the pooling functionality.//PoolableConnectionFactory poolableConnectionFactory =new PoolableConnectionFactory(connectionFactory, null);//// Now we'll need a ObjectPool that serves as the// actual pool of connections.//// We'll use a GenericObjectPool instance, although// any ObjectPool implementation will suffice.//ObjectPool<PoolableConnection> connectionPool =new GenericObjectPool<>(poolableConnectionFactory);// Set the factory's pool property to the owning poolpoolableConnectionFactory.setPool(connectionPool);//// Finally, we create the PoolingDriver itself,// passing in the object pool we created.//PoolingDataSource<PoolableConnection> dataSource =new PoolingDataSource<>(connectionPool);return dataSource;}
}

PoolingDriverExample.java

这里用的是 dbcp 的驱动实现池化的?

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;import org.apache.commons.dbcp2.ConnectionFactory;
import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
import org.apache.commons.dbcp2.PoolableConnection;
import org.apache.commons.dbcp2.PoolableConnectionFactory;
import org.apache.commons.dbcp2.PoolingDriver;
//
// Here are the dbcp-specific classes.
// Note that they are only used in the setupDriver
// method. In normal use, your classes interact
// only with the standard JDBC API
//
import org.apache.commons.pool2.ObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPool;//
// Here's a simple example of how to use the PoolingDriver.
//// To compile this example, you'll want:
//  * commons-pool-2.3.jar
//  * commons-dbcp-2.1.jar 
// in your classpath.
//
// To run this example, you'll want:
//  * commons-pool-2.3.jar
//  * commons-dbcp-2.1.jar 
//  * commons-logging-1.2.jar
// in your classpath.
//
// Invoke the class using two arguments:
//  * the connect string for your underlying JDBC driver
//  * the query you'd like to execute
// You'll also want to ensure your underlying JDBC driver
// is registered.  You can use the "jdbc.drivers"
// property to do this.
//
// For example:
//  java -Djdbc.drivers=org.h2.Driver \
//       -classpath commons-pool2-2.3.jar:commons-dbcp2-2.1.jar:commons-logging-1.2.jar:h2-1.3.152.jar:. \
//       PoolingDriverExample \
//       "jdbc:h2:~/test" \
//       "SELECT 1"
//
public class PoolingDriverExample {public static void main(String[] args) {//// First we load the underlying JDBC driver.// You need this if you don't use the jdbc.drivers// system property.//System.out.println("Loading underlying JDBC driver.");try {Class.forName("org.h2.Driver");} catch (ClassNotFoundException e) {e.printStackTrace();}System.out.println("Done.");//// Then we set up and register the PoolingDriver.// Normally this would be handled auto-magically by// an external configuration, but in this example we'll// do it manually.//System.out.println("Setting up driver.");try {setupDriver(args[0]);} catch (Exception e) {e.printStackTrace();}System.out.println("Done.");//// Now, we can use JDBC as we normally would.// Using the connect string//  jdbc:apache:commons:dbcp:example// The general form being://  jdbc:apache:commons:dbcp:<name-of-pool>//Connection conn = null;Statement stmt = null;ResultSet rset = null;try {System.out.println("Creating connection.");conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");System.out.println("Creating statement.");stmt = conn.createStatement();System.out.println("Executing statement.");rset = stmt.executeQuery(args[1]);System.out.println("Results:");int numcols = rset.getMetaData().getColumnCount();while(rset.next()) {for(int i=1;i<=numcols;i++) {System.out.print("\t" + rset.getString(i));}System.out.println("");}} catch (SQLException e) {e.printStackTrace();} finally {try {if (rset != null)rset.close();} catch (Exception e) {}try {if (stmt != null)stmt.close();} catch (Exception e) {}try {if (conn != null)conn.close();} catch (Exception e) {}}// Display some pool statisticstry {printDriverStats();} catch (Exception e) {e.printStackTrace();}// closes the pooltry {shutdownDriver();} catch (Exception e) {e.printStackTrace();}}public static void setupDriver(String connectURI) throws Exception {//// First, we'll create a ConnectionFactory that the// pool will use to create Connections.// We'll use the DriverManagerConnectionFactory,// using the connect string passed in the command line// arguments.//ConnectionFactory connectionFactory =new DriverManagerConnectionFactory(connectURI, null);//// Next, we'll create the PoolableConnectionFactory, which wraps// the "real" Connections created by the ConnectionFactory with// the classes that implement the pooling functionality.//PoolableConnectionFactory poolableConnectionFactory =new PoolableConnectionFactory(connectionFactory, null);//// Now we'll need a ObjectPool that serves as the// actual pool of connections.//// We'll use a GenericObjectPool instance, although// any ObjectPool implementation will suffice.//ObjectPool<PoolableConnection> connectionPool =new GenericObjectPool<>(poolableConnectionFactory);// Set the factory's pool property to the owning poolpoolableConnectionFactory.setPool(connectionPool);//// Finally, we create the PoolingDriver itself...//Class.forName("org.apache.commons.dbcp2.PoolingDriver");PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");//// ...and register our pool with it.//driver.registerPool("example", connectionPool);//// Now we can just use the connect string "jdbc:apache:commons:dbcp:example"// to access our pool of Connections.//}public static void printDriverStats() throws Exception {PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");ObjectPool<? extends Connection> connectionPool = driver.getConnectionPool("example");System.out.println("NumActive: " + connectionPool.getNumActive());System.out.println("NumIdle: " + connectionPool.getNumIdle());}public static void shutdownDriver() throws Exception {PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");driver.closePool("example");}
}

相关文章:

apache commons-dbcp Apache Commons DBCP 软件实现数据库连接池 commons-dbcp2

DBCP组件 许多Apache项目支持与关系型数据库进行交互。为每个用户创建一个新连接可能很耗时&#xff08;通常需要多秒钟的时钟时间&#xff09;&#xff0c;以执行可能需要毫秒级时间的数据库事务。对于一个公开托管在互联网上的应用程序&#xff0c;在同时在线用户数量可能非…...

8.2K star!史上最强Web应用防火墙

&#x1f6a9; 0x01 介绍 长亭雷池SafeLine是长亭科技耗时近 10 年倾情打造的WAF(Web Application Firewall)&#xff0c;一款敢打出口号 “不让黑客越雷池一步” 的 WAF&#xff0c;我愿称之为史上最强的一款Web应用防火墙&#xff0c;足够简单、足够好用、足够强的免费且开源…...

浅谈RPC的理解

浅谈RPC的理解 前言RPC体系Dubbo架构最后 前言 本文中部分知识涉及Dubbo&#xff0c;需要对Dubbo有一定的理解&#xff0c;且对源码有一定了解 如果不了解&#xff0c;可以参考学习我之前的文章&#xff1a; 浅谈Spring整合Dubbo源码&#xff08;Service和Reference注解部分&am…...

JDK发布信息、历史及未来规划

1.未来规划 发布日期类型版本其它信息2026-01-20CPU25.0.2, 21.0.10, 17.0.18, 11.0.30, 8u4812025-10-21CPU25.0.1, 21.0.9, 17.0.17, 11.0.29, 8u4712025-09-16Feature*25 LTS2025-07-15CPU24.0.2, 21.0.8, 17.0.16, 11.0.28, 8u4612025-04-15CPU24.0.1, 21.0.7, 17.0.15, 1…...

帅帅密码管理系统使用教程

在这个账号满天飞的大环境&#xff0c;密码太多&#xff0c;又容易遗忘&#xff0c;又不方便管理&#xff0c;存在记事本上&#xff0c;又担心泄漏。帅帅密码管理系统就是帮助你解决以上烦恼&#xff0c;用来帮助个人或团队管理众多的登陆密码&#xff0c;能够快速的查询、新增…...

漫谈5种注册中心

01 注册中心基本概念 1.1 什么是注册中心&#xff1f; 注册中心主要有三种角色&#xff1a; 服务提供者&#xff08;RPC Server&#xff09;&#xff1a;在启动时&#xff0c;向 Registry 注册自身服务&#xff0c;并向 Registry 定期发送心跳汇报存活状态。 服务消费者&…...

Vulnhub靶机:Kioptrix_2014

一、介绍 运行环境&#xff1a;Virtualbox和vmware 攻击机&#xff1a;kali&#xff08;192.168.56.101&#xff09; 靶机&#xff1a;Kioptrix: 2014&#xff08;192.168.56.108&#xff09; 目标&#xff1a;获取靶机root权限和flag 靶机下载地址&#xff1a;https://ww…...

Spring Boot整合Spring Security

Spring Boot 专栏&#xff1a;Spring Boot 从零单排 Spring Cloud 专栏&#xff1a;Spring Cloud 从零单排 GitHub&#xff1a;SpringBootDemo Gitee&#xff1a;SpringBootDemo Spring Security是针对Spring项目的安全框架&#xff0c;也是Spring Boot底层安全模块的默认技术…...

Rust字符串深入理解

一、概述 Rust是一种系统级语言&#xff0c;进行操作系统等底层应用开发&#xff0c;同时又具合理的抽象处理能力。在进行Rust编程时&#xff0c;字符串处理是程序员经常碰到的工作。本文深入解析Rust语言中字符串的使用&#xff0c;包括 static string&#xff0c;String与&a…...

TSINGSEE青犀AI智能分析网关V4酿酒厂安全挂网AI检测算法

在酿酒行业中&#xff0c;安全生产一直是企业经营中至关重要的一环。为了确保酒厂生产过程中的安全&#xff0c;TSINGSEE青犀AI智能分析网关V4的安全挂网AI检测算法发挥了重要作用。 TSINGSEE青犀AI智能分析网关V4的安全挂网检测算法是针对酒厂里酒窖挂网行为进行智能检测与识…...

LeetCode第126场双周赛个人题解

目录 100262. 求出加密整数的和 原题链接 思路分析 AC代码 3080. 执行操作标记数组中的元素 原题链接 思路分析 AC代码 100249. 替换字符串中的问号使分数最小 原题链接 思路分析 AC代码 100241. 求出所有子序列的能量和 原题链接 思路分析 AC代码 100262. 求出…...

牛客NC403 编辑距离为一【中等 模拟法 Java,Go,PHP】

题目 题目链接&#xff1a; https://www.nowcoder.com/practice/0b4b22ae020247ba8ac086674f1bd2bc 思路 注意&#xff1a;必须要新增一个&#xff0c;或者删除一个&#xff0c;或者替换一个&#xff0c;所以不能相等1.如果s和t相等&#xff0c;返回false,如果s和t长度差大于1…...

C# SetWindowPos函数

在C#中&#xff0c;SetWindowPos函数用于设置窗口的位置和大小。 原型&#xff1a; [DllImport("user32.dll", SetLastError true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int …...

zookeeper快速入门五:用zookeeper实现服务注册与发现中心

系列&#xff1a; zookeeper快速入门一&#xff1a;zookeeper安装与启动-CSDN博客 zookeeper快速入门二&#xff1a;zookeeper基本概念-CSDN博客 zookeeper快速入门三&#xff1a;zookeeper的基本操作 zookeeper快速入门四&#xff1a;在java客户端中操作zookeeper-CSDN博客…...

Java 中 BitSet 类的用法

Java 中 BitSet 类的用法 API构造置位为 true清除为 false查找位反转长度运算流其他 原理底层数据结构如何工作 API 构造 无参构造 &#xff1a;默认为 64 个 bit 的容量 BitSet bitset new BitSet();有参构造 &#xff1a;设置为 n 个 bit 的容量 BitSet bitset new BitSe…...

Jenkins-pipeline流水线构建完钉钉通知

添加钉钉机器人 在钉钉群设置里添加机器人拿出Webhook地址&#xff0c;设置关键词 Jenkins安装钉钉插件 Dashboard > 系统管理 > 插件管理&#xff0c;搜索构建通知&#xff0c;直接搜索Ding Talk也行 安装DingTalk插件&#xff0c;重启Jenkins 来到Dashboard > 系…...

汽车制造业供应商管理会面临哪些问题?要如何解决?

汽车行业的供应链是及其复杂的&#xff0c;并且呈全球化分布&#xff0c;企业在知识产权方面的优势很可能是阶段性的。企业需要持续保持领先&#xff0c;将面临巨大的挑战&#xff0c;尽快地将产品推向市场是保持领先的唯一途径。然而&#xff0c;如果没有正确的方式去实现安全…...

day28|93. 复原 IP 地址|Leetcode 78. 子集|90.子集II

Leetcode 93. 复原 IP 地址 链接&#xff1a;93. 复原 IP 地址 class Solution { public:vector<string> res;string path;int pointNum 0;vector<string> restoreIpAddresses(string s) {backtracking(0, s);return res;}void backtracking(int start, string …...

怎样提升小程序日活?签到抽奖可行吗?

一、 日活运营策略 小程序应该是即用即走的&#xff0c;每个小程序都在用户中有自己的独特定位&#xff0c;可能是生活日常必备&#xff08;美食、团购、商城&#xff09;&#xff0c;也可能是工作办公必备&#xff08;文档、打卡、工具&#xff09;。 如果你想要让自己的小程…...

hive语法树分析,判断 sql语句中有没有select *

pom依赖参考以下博文java 通过 IMetaStoreClient 取 hive 元数据信息-CSDN博客1 节点处理器类 import lombok.Getter; import org.apache.hadoop.hive.ql.lib.Dispatcher; import org.apache.hadoop.hive.ql.lib.Node; import org.apache.hadoop.hive.ql.parse.ASTNode; impor…...

在rocky linux 9.5上在线安装 docker

前面是指南&#xff0c;后面是日志 sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo sudo dnf install docker-ce docker-ce-cli containerd.io -y docker version sudo systemctl start docker sudo systemctl status docker …...

高频面试之3Zookeeper

高频面试之3Zookeeper 文章目录 高频面试之3Zookeeper3.1 常用命令3.2 选举机制3.3 Zookeeper符合法则中哪两个&#xff1f;3.4 Zookeeper脑裂3.5 Zookeeper用来干嘛了 3.1 常用命令 ls、get、create、delete、deleteall3.2 选举机制 半数机制&#xff08;过半机制&#xff0…...

论文浅尝 | 基于判别指令微调生成式大语言模型的知识图谱补全方法(ISWC2024)

笔记整理&#xff1a;刘治强&#xff0c;浙江大学硕士生&#xff0c;研究方向为知识图谱表示学习&#xff0c;大语言模型 论文链接&#xff1a;http://arxiv.org/abs/2407.16127 发表会议&#xff1a;ISWC 2024 1. 动机 传统的知识图谱补全&#xff08;KGC&#xff09;模型通过…...

【7色560页】职场可视化逻辑图高级数据分析PPT模版

7种色调职场工作汇报PPT&#xff0c;橙蓝、黑红、红蓝、蓝橙灰、浅蓝、浅绿、深蓝七种色调模版 【7色560页】职场可视化逻辑图高级数据分析PPT模版&#xff1a;职场可视化逻辑图分析PPT模版https://pan.quark.cn/s/78aeabbd92d1...

2025年渗透测试面试题总结-腾讯[实习]科恩实验室-安全工程师(题目+回答)

安全领域各种资源&#xff0c;学习文档&#xff0c;以及工具分享、前沿信息分享、POC、EXP分享。不定期分享各种好玩的项目及好用的工具&#xff0c;欢迎关注。 目录 腾讯[实习]科恩实验室-安全工程师 一、网络与协议 1. TCP三次握手 2. SYN扫描原理 3. HTTPS证书机制 二…...

GO协程(Goroutine)问题总结

在使用Go语言来编写代码时&#xff0c;遇到的一些问题总结一下 [参考文档]&#xff1a;https://www.topgoer.com/%E5%B9%B6%E5%8F%91%E7%BC%96%E7%A8%8B/goroutine.html 1. main()函数默认的Goroutine 场景再现&#xff1a; 今天在看到这个教程的时候&#xff0c;在自己的电…...

Qemu arm操作系统开发环境

使用qemu虚拟arm硬件比较合适。 步骤如下&#xff1a; 安装qemu apt install qemu-system安装aarch64-none-elf-gcc 需要手动下载&#xff0c;下载地址&#xff1a;https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x…...

PHP 8.5 即将发布:管道操作符、强力调试

前不久&#xff0c;PHP宣布了即将在 2025 年 11 月 20 日 正式发布的 PHP 8.5&#xff01;作为 PHP 语言的又一次重要迭代&#xff0c;PHP 8.5 承诺带来一系列旨在提升代码可读性、健壮性以及开发者效率的改进。而更令人兴奋的是&#xff0c;借助强大的本地开发环境 ServBay&am…...

tauri项目,如何在rust端读取电脑环境变量

如果想在前端通过调用来获取环境变量的值&#xff0c;可以通过标准的依赖&#xff1a; std::env::var(name).ok() 想在前端通过调用来获取&#xff0c;可以写一个command函数&#xff1a; #[tauri::command] pub fn get_env_var(name: String) -> Result<String, Stri…...

《Docker》架构

文章目录 架构模式单机架构应用数据分离架构应用服务器集群架构读写分离/主从分离架构冷热分离架构垂直分库架构微服务架构容器编排架构什么是容器&#xff0c;docker&#xff0c;镜像&#xff0c;k8s 架构模式 单机架构 单机架构其实就是应用服务器和单机服务器都部署在同一…...