返回首页

gbase数据、南大通用产品文档:GBase8s智能大对象自动化

更新日期:2024年09月11日

不以 ifx_lo 函数来访问智能大对象,您可通过使用标准 ODBC API 来访问智能大对象。
当以标准 ODBC API 来访问智能大对象时,支持的操作包括 CLOB 和 BLOB 数据类型
的选择、插入、更新和删除。不可以这种方式来访问 BYTE 和 TEXT 简单大对象。
使用 SQL_INFX_ATTR_LO_AUTOMATIC 来设置访问方法
可使用 SQL_INFX_ATTR_LO_AUTOMATIC 属性来告诉数据库服务器,是通过使用
ODBC API 还是通过使用 ifx_lo 函数,来访问智能大对象。
如果应用程序启用 SQL_INFX_ATTR_LO_AUTOMATIC 作为连接属性,则该连接的所有
语句都继承该属性值。要更改每个语句的此属性值,您必须设置并重置它作为语句属性。
如果为该语句启用此属性,
则应用程序可通过使用如前所述的标准 ODBC 的方式来访问智
能大对象。如果未为该语句启用此属性,则应用程序通过使用 ifx_lo 函数来访问智能大对
象。如果为该语句启用此属性,则应用程序不可使用 ifx_lo 函数。
对于 GBase 8s Driver DSN,
还可通过开启 ODBC Administration 的 Advanced 标签之下的
报告标准 ODBC 类型选项,来启用 SQL_INFX_ATTR_LO_AUTOMATIC 属性。
CLOB 数据类型列的 SQLDescribeCol 返回 DataPtrType 的 SQL_LONGVARCHAR。
如果
为该语句启用 SQL_INFX_ATTR_LO_AUTOMATIC 属性,则 BLOB 类型列的
SQLDescribeCol 返回 SQL_LONGVARBINARY。
CLOB 类型列的 SQLColAttributes 为 SQL_DESC_TYPE 的 Field Identifier 返回
SQL_LONGVARCHAR,而对于 BLOB 数据类型列,仅当为该语句启用
SQL_INFX_ATTR_LO_AUTOMATIC 属性时,它才返回 SQL_LONGVARBINARY。

通过使用 ODBC API,来插入、更新和删除智能大对象
当您插入、更新和删除 CLOB 或 BLOB 数据类型时,应用程序通过使用
SQLBindParameter 来将该数据类型与一 C 类型绑定。

GBase 8s ODBC Driver 程序员指南
南大通用数据技术股份有限公司
- 106 -

当您插入、更新和删除 CLOB 数据类型时,应用程序通过使用 SQLBindParameter (C 类
型为 SQL_C_CHAR,SQL 类型为 SQL_LONGVARCHAR)来将绑定 CLOB 数据类型。

当您插入、更新和删除 BLOB 数据类型时,应用程序通过使用 SQLBindParameter (C 类
型为 SQL_C_BINARY,SQL 类型为 SQL_LONGVARBINARY)来绑定 BLOB 数据类
型。
GBase 8s ODBC Driver 以下列方式来执行智能大对象的插入:
l
驱动程序发送请求至数据库服务器,来以新文件的形式在服务器端创建智能大对象。

l
驱动程序从数据库服务器取回此文件的文件描述符(例如,lofd)。
l
驱动程序将上述 lofd 文件和由应用程序以 SQLBindParameter 绑定了的智能大对
象数据发送至数据库服务器。
l
数据库服务器将数据写入文件。

使用 ODBC API 来选择智能大对象
当选择 CLOB 数据类型时,应用程序绑定该列的 C 类型作为 SQL_C_CHAR。当选择
BLOB 数据类型时,绑定该 C 类型作为 SQL_C_BINARY。
GBase 8s ODBC Driver 以下列方式来选择智能大对象:
l
驱动程序发送请求至数据库服务器,来打开智能大对象作为服务器端的文件。
l
驱动程序从数据库服务器取回此文件的文件描述符(例如,lofd)。
l
驱动程序将上述 lofd 和读请求发送至数据库服务器,
来从该文件读取智能大对象。

l
数据库服务器通过使用上述 lofd 来从对应的文件读取数据,并将它发送至驱动程
序。
l
驱动程序将该数据写入到应用程序使用 SQLBindParameter 绑定的缓冲区。

VC 已经初始化完毕,可以用如下方法确认两个VC 的HASHMAP 是否相同:
1.
查看VC 的distribution。
gcadmin showdistribution vc
vc1
镜像功能要求两个VC 的distribution 的主分片数相同。
比如VC1 的distribution
有3 个主分片,那么VC2 的distribution 也要求有3 个主分片,备份分片数无
要求。
2.
比对两个VC 的HASHMAP 是否相同。执行如下SQL 后结果如下面示例执行
结果一致就说明VC1 的HASHMAP1 与VC2 的HASHMAP2 相同。
gbase> select distinct(res.r), count(res.r) from (select count(*) r
from
gbase.nodedatamap t where t.data_distribution_id in (1,2) group by
t.hashkey, t.nodeid) res group by res.r;
+---+--------------+
| r | count(res.r) |
+---+--------------+
| 2 |
65536 |

GBase 8a MPP Cluster 产品手册
4 管理员指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
210
+---+--------------+

Cluster Monitoring Tool
The cluster monitoring tool provides reliable monitoring data, timely alarm
functions, intuitive trend displays, reliable data distribution views, and displays of
the status of database connection threads.
The cluster monitoring tool mainly monitors the running status of the cluster node
servers, resource utilization, network communication status, and other information
in the single or multiple GBase 8a MPP Cluster deployment environment. It allows

GBase 8a MPP Cluster Technical White Paper
General Data Technology Co., Ltd.
- 33 -
users to effectively monitor the running status and system resources of servers in the
cluster environment and can provide reliable basis for monitoring the running status
of the cluster and its nodes for users.
gcadmin Tool
GBase 8a MPP Cluster provides administrators with the gcadmin command-line tool.
This tool enables management functions such as adding or removing Distributions
and viewing cluster status. Specific features include:
1)
Querying cluster status information, such as node IP, node status, and
cluster service mode;
2)
Querying data distribution information, such as the location of primary
and secondary shards, and the total number of shards;
3)
Querying cluster lock information, such as lock name, node IP, and lock
creation time;
4)
Querying node exception status information, such as all error logs and
error logs for a table shard on a specific node.
DB-Link and Transparent Gateway
DB-Link is a remote database connection feature provided by GBase 8a MPP
Cluster. Working in collaboration with the Transparent Gateway service, it enables
transparent access to data tables in remote GBase 8a MPP Cluster or Oracle
databases. Passthrough mode is supported, meaning GBase 8a MPP Cluster does not
parse the specified SQL syntax, and the Transparent Gateway service directly
pushes the specified SQL to execute the relevant operations on the remote database.
The Transparent Gateway service is an independently running process responsible
for connecting GBase 8a MPP Cluster or other databases (through standard JDBC

GBase 8a MPP Cluster Technical White Paper
- 34 -
General Data Technology Co., Ltd.
interfaces) and completing data extraction and push tasks.
Through the DB-Link feature, customers can achieve the following:
1)
GBase 8a MPP Cluster applications can access an external data source that
supports GBase 8a MPP Cluster or Oracle databases. They can query data
from the external data source and perform related operations on data
association with local clusters.
2)
If the remote data source is a GBase 8a MPP Cluster and there are no
network communication restrictions, the system can perform targeted
optimizations to improve performance. DB-Link access between different
cluster versions is supported, such as supporting the DB-Link feature
between v8.6.2build43 and v9.5.3 versions.
Rsynctool: Cluster Synchronization Tool
The Cluster Synchronization Tool is based on binary file synchronization, which
synchronizes data inside the database by parsing and comparing changes in binary
files. Incremental synchronization and full synchronization are included. The tool
has the following features:
1) Supports both incremental and full data synchronization.
2) Supports read-back verification of disk data.
3) Supports synchronizing the primary shard first and then synchronizing the
backup shard after the primary shard is successful.
4) Cluster
synchronization
supports
using
ordinary
database
users
for
synchronization.

GBase 8a MPP Cluster Technical White Paper
General Data Technology Co., Ltd.
- 35 -
7 GBase 8a MPP Cluster Development Interfaces
The cluster interface driver can effectively balance the load of requests from
upper-level applications (the application calls the interface driver's connection string,
which is configured with the IP addresses of multiple cluster management nodes,
and the interface driver's internal load balancing is performed during connection).
The application layer request response node completes SQL parsing and generates
execution plans, coordinates the concurrent participation of cluster-related nodes in
computing and processing, greatly improving the concurrency of the entire cluster
nodes and fully tapping the cluster performance.
GBase 8a MPP Cluster ODBC
GBase 8a MPP Cluster ODBC is the ODBC driver for GBase 8a MPP Cluster,
which provides access to all ODBC functions of GBase 8a MPP Cluster. GBase 8a
MPP Cluster ODBC supports ODBC 3.5X level specification (all APIs + 2nd-level
features). Users can call GBase 8a MPP Cluster ODBC driver to access GBase 8a
MPP Cluster database through ODBC Data Source Administrator or directly. In
addition, visual programming tools such as C++ Builder and Visual Studio can also
utilize GBase 8a MPP Cluster ODBC for access. GBase 8a MPP Cluster ODBC
supports all platforms supported by GBase 8a MPP Cluster, including Windows,
Linux, and AIX.
The ODBC driver manager is a library that manages communication between
ODBC applications and drivers, main functions include:
1)
Resolving Data Source Names (DSN)
2)
Loading and unloading drivers
3)
Handling ODBC function calls or passing them to drivers

GBase 8a MPP Cluster Technical White Paper
- 36 -
General Data Technology Co., Ltd.
GBase 8a MPP Cluster JDBC
GBase 8a MPP Cluster JDBC is a driver compatible with JDBC specifications 3.0
and 4.0 (type 4), which means it is a pure Java program that conforms to JDBC 3.0
and 4.0 version specifications and can directly communicate with GBase servers
using the GBase protocol.
GBase 8a MPP Cluster JDBC provides access to GBase 8a MPP Cluster interfaces
for client applications using the Java programming language.
1)
GBase 8a MPP Cluster JDBC supports JDBC specifications 3.0 and 4.0
versions;
2)
GBase 8a MPP Cluster JDBC directly communicates with GBase 8a MPP
Cluster servers using the GBase protocol;
3)
GBase 8a MPP Cluster JDBC has a pass rate of 95% on Sun's JDBC
experimental platform.
GBase 8a MPP Cluster ADO.NET
GBase 8a MPP Cluster ADO.NET is an interface program that provides a
convenient, efficient, and secure interaction between .NET applications and the
GBase database. It is 100% written in C# and inherits from Microsoft ADO.NET
classes. Developers can use any .NET programming language (C#, VB.NET, F#) to
operate the GBase database through GBase 8a MPP Cluster ADO.NET.
GBase 8a MPP Cluster ADO.NET supports the following features:
1)
Supports cluster high availability and load balancing;
2)
Supports all features of the GBase database, such as stored procedures and
views;
3)
Supports protocol compression, allowing compression of the data stream

GBase 8a MPP Cluster Technical White Paper
General Data Technology Co., Ltd.
- 37 -
between the client and server;
4)
Supports TCP/IP socket connection under the Windows platform;
5)
Supports TCP/IP socket or Linux socket connection under the Linux
platform;
6)
No need to install the GBase database client, the full management function
can be implemented through the GBase 8a MPP Cluster ADO.NET class
library.
GBase 8a MPP Cluster C API
GBase 8a MPP Cluster C API is a C language access library provided by GBase 8a
MPP Cluster database. Applications can access the GBase 8a MPP Cluster database
by calling the GBase C API. The GBase C API provides the following functions:
1)
Create and disconnect the connection between the client and server;
2)
Execute SQL statements directly;
3)
Operate the database through the prepared statement mode;
4)
Get the result set of the executed SQL;
5)
Get error information.
GBase 8a MPP Cluster Python API
GBase Python interface is a driver program that connects and uses the GBase
database in the Python language. The GBase Python interface is written based on the
Python Database API Specification standard. The interface is compatible with the
standard and supports the following features:
1)
Supports Python 2.x and Python 3.x
2)
Fully supports the features of GBase 8a MPP Cluster

GBase 8a MPP Cluster Technical White Paper
- 38 -
General Data Technology Co., Ltd.
3)
Fully supports SQL standard syntax
4)
Supports binary stream insertion and update
5)
Supports batch insertion optimization
6)
Supports executing multiple SQL statements and obtaining multiple result
sets
7)
Supports TCP/IP protocol
8)
Supports mapping between Python's datetime and GBase time types.


Technical support hotline: 400-013-9696
General Data Technology Co., Ltd.
@GBase
@gbaseglobal