|
如何用SQLarkv4.3客户端工具连接PG数据库
好久没用到达梦的SQLark客户端工具了,该工具可以支持连接达梦数据库、ORACLE数据库、MYSQL数据库,同时该工具可以对数据库的表生成数据,这对开发人员、测试人员来说不错的福音。今天在打开SQLark客户端工具时,系统提示有软件更新。到官网查询,该工具发布新版本,新增特性如下:
SQLark V3.4
新增支持 PostgreSQL 数据库
SQL 编辑器:常用代码段
表设计器体验优化
数据查看和编辑
数据导入:新增 MySQL 数据库
数据迁移
Linux
快捷键
问题修复
发布时间:2025-04-15
问题反馈
本次 4 月发版的 SQLark V3.4 版本,新增对 PostgreSQL 数据库的支持,实现 PostgreSQL 12 至 16 版本的连接、数据库对象管理、SQL 查询执行、数据查看与编辑、与表对象相关的数据迁移等功能;此外,更新优化了多项功能,SQL 编辑器新增常用代码段功能,表设计器与单元格编辑器使用体验进一步优化,数据导入功能支持 MySQL 数据库等;修复了部分已知问题。以下是详细更新内容:
版本信息
当前版本: V3.4
前置版本: V3.3
发版时间: 2025 年 4 月 15 日
支持的升级路径: 对于 SQLark V3.0 及之后的版本,均可直接升级至本版本。
支持的数据库版本
SQLark V3.4 版本支持下述版本的数据库:
DM 7.0 及以上
Oracle 11g 及以上
MySQL 5.7、8.0
PostgreSQL 12、13、14、15、16
新增支持 PostgreSQL 数据库
支持版本:PostgreSQL 12、13、14、15、16 #0866 @于、#0866 @高剑客
主要功能:
数据库连接:提供默认用户名/密码与 URL 两种连接方式。
数据库对象:支持对 PostgreSQL 基础对象的可视化管理,包括数据库、模式、表、视图、物化视图、函数、存储过程、序列、触发器、自定义类型和角色;支持基于对象名称和对象 DDL 内容的搜索功能。
SQL 功能与查询执行:支持 PostgreSQL 基础语法,提供关键字、模式、表(包括字段、索引)、视图等对象名的智能提示与代码补全功能;支持以表格形式展示 SQL 执行计划。
数据查看与编辑:支持对表数据进行增删改查、复制粘贴、排序、筛选等操作。
数据迁移:支持 PostgreSQL 迁移至达梦数据库,V3.4 版本仅支持迁移表及表相关对象(包括序列、视图、物化视图、索引、主键、唯一键、约束、外键和注释);V3.5 将实现对全部类型对象的迁移支持。
从功能上看,新增了对PG数据库(12、13、14、15、16)的支持,PG数据库以功能强大、扩展丰富闻名,其数据据生态和影响力最近几年得到极大扩展。但美中不足的是,SQLark最新版本不支持对PG表生成数据,非常希望下一版本能够得以实现。
我的虚拟机操作系统为CENTOS7,数据库为PG14。如下所示
[root@oel7:/root]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@oel7:/root]# su -l postgres
-bash-4.2$ psql
psql (14.14)
要想使用SQLark V3.4连接PG数据库,先要做好以下设置。红线部分为必须要设置的地方
-bash-4.2$ cat pg_hba.conf
# PostgreSQL Client Authentication Configuration File
# ===================================================
#
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
#
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
#
# local DATABASE USER METHOD [OPTIONS]
# host DATABASE USER ADDRESS METHOD [OPTIONS]
# hostssl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnossl DATABASE USER ADDRESS METHOD [OPTIONS]
# hostgssenc DATABASE USER ADDRESS METHOD [OPTIONS]
# hostnogssenc DATABASE USER ADDRESS METHOD [OPTIONS]
#
# (The uppercase items must be replaced by actual values.)
#
# The first field is the connection type:
# - "local" is a Unix-domain socket
# - "host" is a TCP/IP socket (encrypted or not)
# - "hostssl" is a TCP/IP socket that is SSL-encrypted
# - "hostnossl" is a TCP/IP socket that is not SSL-encrypted
# - "hostgssenc" is a TCP/IP socket that is GSSAPI-encrypted
# - "hostnogssenc" is a TCP/IP socket that is not GSSAPI-encrypted
#
# DATABASE can be "all", "sameuser", "samerole", "replication", a
# database name, or a comma-separated list thereof. The "all"
# keyword does not match "replication". Access to replication
# must be enabled in a separate record (see example below).
#
# USER can be "all", a user name, a group name prefixed with "+", or a
# comma-separated list thereof. In both the DATABASE and USER fields
# you can also write a file name prefixed with "@" to include names
# from a separate file.
#
# ADDRESS specifies the set of hosts the record matches. It can be a
# host name, or it is made up of an IP address and a CIDR mask that is
# an integer (between 0 and 32 (IPv4) or 128 (IPv6) inclusive) that
# specifies the number of significant bits in the mask. A host name
# that starts with a dot (.) matches a suffix of the actual host name.
# Alternatively, you can write an IP address and netmask in separate
# columns to specify the set of hosts. Instead of a CIDR-address, you
# can write "samehost" to match any of the server's own IP addresses,
# or "samenet" to match any address in any subnet that the server is
# directly connected to.
#
# METHOD can be "trust", "reject", "md5", "password", "scram-sha-256",
# "gss", "sspi", "ident", "peer", "pam", "ldap", "radius" or "cert".
# Note that "password" sends passwords in clear text; "md5" or
# "scram-sha-256" are preferred since they send encrypted passwords.
#
# OPTIONS are a set of options for the authentication in the format
# NAME=VALUE. The available options depend on the different
# authentication methods -- refer to the "Client Authentication"
# section in the documentation for a list of which options are
# available for which authentication methods.
#
# Database and user names containing spaces, commas, quotes and other
# special characters must be quoted. Quoting one of the keywords
# "all", "sameuser", "samerole" or "replication" makes the name lose
# its special character, and just match a database or username with
# that name.
#
# This file is read on server startup and when the server receives a
# SIGHUP signal. If you edit the file on a running system, you have to
# SIGHUP the server for the changes to take effect, run "pg_ctl reload",
# or execute "SELECT pg_reload_conf()".
#
# Put your actual configuration here
# ----------------------------------
#
# If you want to allow non-local connections, you need to add more
# "host" records. In that case you will also need to make PostgreSQL
# listen on a non-local interface via the listen_addresses
# configuration parameter, or via the -i or -h command line switches.
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all peer
host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
-bash-4.2$ cat -n postgresql.conf
1 # -----------------------------
2 # PostgreSQL configuration file
3 # -----------------------------
4 #
5 # This file consists of lines of the form:
6 #
7 # name = value
8 #
9 # (The "=" is optional.) Whitespace may be used. Comments are introduced with
10 # "#" anywhere on a line. The complete list of parameter names and allowed
11 # values can be found in the PostgreSQL documentation.
12 #
13 # The commented-out settings shown in this file represent the default values.
14 # Re-commenting a setting is NOT sufficient to revert it to the default value;
15 # you need to reload the server.
16 #
17 # This file is read on server startup and when the server receives a SIGHUP
18 # signal. If you edit the file on a running system, you have to SIGHUP the
19 # server for the changes to take effect, run "pg_ctl reload", or execute
20 # "SELECT pg_reload_conf()". Some parameters, which are marked below,
21 # require a server shutdown and restart to take effect.
22 #
23 # Any parameter can also be given as a command-line option to the server, e.g.,
24 # "postgres -c log_connections=on". Some parameters can be changed at run time
25 # with the "SET" SQL command.
26 #
27 # Memory units: B = bytes Time units: us = microseconds
28 # kB = kilobytes ms = milliseconds
29 # MB = megabytes s = seconds
30 # GB = gigabytes min = minutes
31 # TB = terabytes h = hours
32 # d = days
33
34
35 #------------------------------------------------------------------------------
36 # FILE LOCATIONS
37 #------------------------------------------------------------------------------
38
39 # The default values of these variables are driven from the -D command-line
40 # option or PGDATA environment variable, represented here as ConfigDir.
41
42 #data_directory = 'ConfigDir' # use data in another directory
43 # (change requires restart)
44 #hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
45 # (change requires restart)
46 #ident_file = 'ConfigDir/pg_ident.conf' # ident configuration file
47 # (change requires restart)
48
49 # If external_pid_file is not explicitly set, no extra PID file is written.
50 #external_pid_file = '' # write an extra PID file
51 # (change requires restart)
52
53
54 #------------------------------------------------------------------------------
55 # CONNECTIONS AND AUTHENTICATION
56 #------------------------------------------------------------------------------
57
58 # - Connection Settings -
59
60 listen_addresses = '*' # what IP address(es) to listen on;
61 # comma-separated list of addresses;
62 # defaults to 'localhost'; use '*' for all
63 # (change requires restart)
64 port = 5432 # (change requires restart)
postgresql.conf中有些参数是静态参数,做好以上设置后,要重启一下数据。这样的话,任何主机从以用户名密码的方式从客户端工具连接到PG数据库。
PG数据库安装后有个默认角色是postgres,同时它也是数据库安装后第一个用户。我们可以对该用户设置密码。该用户名权限如下:
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
前期的设置都搞好了,我们现在用客户端工具连接看一下。
填写连接参数,然后做一下测试连接,最后保存连接。
打开刚才建立的连接,如图所示。
合作电话:010-64087828
社区邮箱:greatsql@greatdb.com