这是我的pojo课程
@Entity
public class Department {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="Department_Id")
private Integer deptId;
@Column(name="Department_Name",unique=true,nullable=false)
private String deptName;
@Column(name="Department_Description")
@NotNull
private String deptDesc;
//geters and setters
Run Code Online (Sandbox Code Playgroud)
我想要的是department_id必须是此Department表的主键,此键的条目必须为DEP0001,DEP0002,DEP0003
我想编写一个shell脚本来运行这些命令.我通常使用如下命令从终端连接
//first go to the directory
cd /opt/novell/sentinel/3rdparty/postgresql/bin/
// then type following
export LD_LIBRARY_PATH=/opt/novell/sentinel/3rdparty/postgresql/lib/
// then fire following command
./psql --host 127.0.0.1 --port 5432 --dbname=SIEM --username=dbauser
Password for user dbauser: ****
Run Code Online (Sandbox Code Playgroud) 这是我的shell脚本
#!/bin/bash
psql --host=127.0.0.1 --port=5432 --dbname=SIEM --username=dbauser
vacuumdb --analyze --verbose --table 'vuln' SIEM
Run Code Online (Sandbox Code Playgroud)
但它没有正常工作,并给出错误:
linux-lxh4:/home/gaurav # ./script.sh
psql (9.2.5)
Type "help" for help.
SIEM=# \q
vacuumdb: could not connect to database root: FATAL: Peer authentication failed for user "root"
Run Code Online (Sandbox Code Playgroud)
Edit1:我使用了这段代码:
psql --host=127.0.0.1 --port=5432 --dbname=SIEM --username=dbauser
VACUUM FULL VERBOSE vuln
Run Code Online (Sandbox Code Playgroud)
这是错误:
./script.sh: line 4: VACUUM: command not found
Run Code Online (Sandbox Code Playgroud)