<!-- 各大数据库驱动 --> <!-- mysql驱动 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!-- oracle驱动 --> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6</artifactId> <version>11.2.0.3</version> </dependency> <!--sqlserver依赖 驱动jar --> <!-- <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> </dependency> --> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>4.0</version> </dependency> <!-- postGres驱动包 --> <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency>
装docker
vi auto_docker.sh
#!/bin/bash stop_firewalld_status(){ count = `systemctl status firewalld | grep running | wc -l` if [[ ! $count -eq 1 ]]; then systemctl stop firewalld systemctl disable firewalld systemctl restart network echo "success to stop firewalld" else echo "the firewalld has been stop" fi } update_yum_package(){ yum -y update yum remove docker docker-common docker-selinux docker-engine yum install –y yum-utils device-mapper-persistent-data lvm2 unzip yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo yum install -y docker-ce systemctl start docker systemctl enable docker } modify_docker_config(){ cd /lib/systemd/system sed -i 's#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock#ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock --registry-mirror=https://9cpn8tt6.mirror.aliyuncs.com#g' docker.service systemctl daemon-reload systemctl restart docker } stop_firewalld_status update_yum_package modify_docker_config
postGres
docker pull postgres:11.4 mkdir postgresql mkdir postgresql/data /mnt/user/appdata/postgresql/data docker run --name postgres -e POSTGRES_PASSWORD=xxxxxxxx -p 54321:5432 -v /mnt/user/appdata/postgresql/data:/var/lib/postgresql/data -d postgres:11.4 navicat 54321 postgres xxxxx driver-class-name: org.postgresql.Driver url: jdbc:postgresql://ip:54321/postgres username: postgres password: xxxxxxxx
sqlserver
docker pull mcr.microsoft.com/mssql/server:2017-latest mkdir mssql mkdir msqql/sqlserver_data /mnt/user/appdata/mssql/sqlserver_data --密码必须8位 docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=xxxxxxxx" -p 1433:1433 --name sqlserver2017 -v /mnt/user/appdata/mssql/sqlserver_data:/var/opt/mssql -d mcr.microsoft.com/mssql/server:2017-latest docker exec -it sqlserver2017 /bin/bash --登录 /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P xxxxxxxx CREATE DATABASE TestDB ---执行GO才会执行 GO select name from sys.Databases GO USE TestDB CREATE TABLE test_xxxx (id INT, LastName NVARCHAR(50), FirstName NVARCHAR(50)) GO Select * from test_xxxx GO --查询用户创建的表 select name from sysobjects where type = 'U' GO --退出 QUIT navicat连接sql需要安装驱动 C:\Program Files\PremiumSoft\Navicat Premium 12\sqlncli_x64.msi ip || ip,1433--如果开启防火墙需要port TestDB SA xxxxxxxx driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver url: jdbc:sqlserver://ip:1433;DatabaseName=TestDB username: SA password: xxxxxxxx
oracle
docker pull registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g --空间不够的 删除无用valumn docker volume rm $(docker volume ls -qf dangling=true) docker run -d -p 1521:1521 --name oracle11g registry.cn-hangzhou.aliyuncs.com/helowin/oracle_11g docker exec -it xx /bin/bash su root 密码 helowin vi /etc/profile export ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_2 export ORACLE_SID=helowin export PATH=$ORACLE_HOME/bin:$PATH source /etc/profile 加载环境变量 ln -s $ORACLE_HOME/bin/sqlplus /usr/bin su - oracle sqlplus /nolog --登录 conn /as sysdba --连接 alter user system identified by system;--修改system用户账号密码; alter user sys identified by system;--修改sys用户账号密码; create user test identified by test; -- 创建内部管理员账号密码; create user xxxx identified by xxxx; grant connect,resource,dba to xxxx; --将dba权限授权给内部管理员账号和密码; ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED; --修改密码规则策略为密码永不过期;(会出现坑,后面讲解) alter system set processes=1000 scope=spfile; --修改数据库最大连接数据; shutdown immediate; --关闭数据库 startup; --启动数据库 ip helowin name -----设计utf8 没必要 SHUTDOWN IMMEDIATE; --先关掉数据库 STARTUP MOUNT EXCLUSIVE; ALTER SYSTEM ENABLE RESTRICTED SESSION; ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; ALTER SYSTEM SET AQ_TM_PROCESSES=0; ALTER DATABASE OPEN; alter database character set internal_use utf8; SHUTDOWN immediate; --修改完毕后重启数据库 STARTUP; --- oracle的数据库schemal默认与用户名一样 即 用户名与数据库名保持一样 否则需要 "数据库名".表名 driver-class-name: oracle.jdbc.OracleDriver jdbc-url: jdbc:oracle:thin:@localhost:1521:helowin username: uop_act5 password: uop_act5_cb1cs
===============mysql
spring.datasource.url=jdbc:mysql://localhost:3306/xxl_job?Unicode=true&characterEncoding=UTF-8&serverTimezone=UTC spring.datasource.username=xx spring.datasource.password=xxxxx spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver