
openGauss
Carlos_0
这个作者很懒,什么都没留下…
展开
-
openGauss序列&触发器实现分类编号
问题要实现的功能:根据插入数据的ptype,如果是1就按从1001开始递增,如果是0就从2001开始递增。问题解决:1.先分别创建两个序列: CREATE SEQUENCE sq_sbc_id START WITH 10001 INCREMENT BY 1 MAXVALUE 20000 CACHE 20; CREATE SEQUENCE sq_sys_id START WITH 20001 INCREMENT BY 1 MAXVALUE 30000 CA原创 2021-12-03 17:08:30 · 1156 阅读 · 2 评论 -
openGauss字段自动递增
在运行INSERT INTO "user" (username,password)VALUES ('xx','123456');时出现报错:[ERROR]执行失败错误代码:[0]SQL错误码:=23502ERROR:null value in column "id" violates not-null constraintDetail:Failing row contians (null,xx,123456).想实现的结果是运行代码后id字段自动实现递增。解决方法:原创 2021-12-02 20:40:22 · 6177 阅读 · 0 评论 -
MyBatis-plus连接OpenGauss
1.开启数据库查看数据库内容2.新建项目在Spring Initializr中勾选或者直接在pom中添加依赖: <dependency> <groupId>org.postgresql</groupId> <artifactId>postgresql</artifactId> <scope>runtime</scope> </dependency>原创 2021-12-01 16:08:09 · 6480 阅读 · 0 评论 -
JDBC连接openGauss
1.开启数据库查看数据库内容2.导入jar包postgresql.jar3.连接新建java程序openGaussDemo完整代码:package JDBC;import java.sql.*;public class openGaussDemo { static final String JDBC_DRIVER = "org.postgresql.Driver"; static final String DB_URL = "jdbc:postgresql://原创 2021-12-01 15:17:55 · 2858 阅读 · 0 评论