返回首页

gbase数据、南大通用产品文档:GBase8ax86_64linuxglibc235295342targz 下载perl

更新日期:2024年09月11日

的安装包。
2, 从
http://mirrors.sohu.com/CPAN/authors/id/M/MJ/MJEVANS/DBD-ODBC-1.39.t
ar.gz 下载DBD-ODBC-1.39。
3, 安装perl-5.14。perl 默认安装在/opt/ActivePerl-5.14 目录下。
4, 安装DBD-ODBC-1.39,先解压DBD-ODBC-1.39.tar.gz,然后执行如下
命令安装:
/opt/ActivePerl-5.14/bin/perl Makefile.PL

GBase 8a 程序员手册ODBC 篇
南大通用数据技术股份有限公司

- 81 -
make
make install
5, 接下来是创建ODBC 数据源,
创建ODBC 数据源的方法请参考3.2.2。

果涉及到中文,那么一定要设置GBase 8a ODBC 驱动的字符集(该字符集需要
与集群安装时默认的字符集保持一致)
。此用例中GBase 8a ODBC 字符集设置为
UTF8。
#!/opt/ActivePerl-5.14/bin/perl
use DBI;
use encoding 'utf-8';

$dbh=DBI->connect('dbi:ODBC:gbase8a', 'gbase', 'gbase20110531');
my $sth=$dbh->prepare("drop table if exists t_plodbc");
$sth->execute();
my $sth=$dbh->prepare("create table t_plodbc(a varchar(100), b
int)");
$sth->execute();
my $sth=$dbh->prepare("insert into t_plodbc values('南大通用',
10)");
$sth->execute();
my $sth=$dbh->prepare("select * from t_plodbc");
$sth->execute();
while(@data=$sth->fetchrow_array())
{
print "$data[0]\n";
}

MOT 错误消息
错误可能由多种场景引起。所有错误都记录在数据库服务器日志文件中。
此外,与用户
相关的错误作为对查询、
事务或存储过程执行或数据库管理操作的响应的一部分返回给用户。

服务器日志中报告的错误包括函数、实体、上下文、错误消息、错误描述和严重性。

向用户报告的错误被翻译成标准PostgreSQL 错误码,可能由MOT 特定的消息和描述
组成。
错误提示、错误描述和错误码见下文。该错误码实际上是内部代码,
不记录也不返回给
用户。
写入日志文件的错误
所有错误都记录在数据库服务器日志文件中。
以下列出了写入数据库服务器日志文件但
未返回给用户的错误。该日志位于data 文件夹中,命名为postgresql-DATE-TIME.log。
表13- 1 只写入日志文件的错误
日志消息
内部错误代码
Error code denoting success
MOT_NO_ERROR 0
Out of memory
MOT_ERROR_OOM 1
Invalid configuration
MOT_ERROR_INVALID_CFG 2
Invalid argument passed to function
MOT_ERROR_INVALID_ARG 3
System call failed
MOT_ERROR_SYSTEM_FAILURE 4
Resource limit reached
MOT_ERROR_RESOURCE_LIMIT 5

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
474
Internal logic error
MOT_ERROR_INTERNAL 6
Resource unavailable
MOT_ERROR_RESOURCE_UNAVAILABLE 7
Unique violation
MOT_ERROR_UNIQUE_VIOLATION 8
Invalid memory allocation size
MOT_ERROR_INVALID_MEMORY_SIZE 9
Index out of range
MOT_ERROR_INDEX_OUT_OF_RANGE 10
Error code unknown
MOT_ERROR_INVALID_STATE 11
返回给用户的错误
下面列出了写入数据库服务器日志文件并返回给用户的错误。
MOT 使用返回码(Return Code,RC)返回Postgres 标准错误代码至封装。某些RC 会
导致向正在与数据库交互的用户生成错误消息。
MOT 从内部返回Postgres 代码(见下文)
到数据库包,
数据库封装根据标准的Postgres
行为对其做出反应。
提示信息中的%s、%u、%lu 指代相应的错误信息(如查询、表名或其他信息)。

%s:字符串

%u:数字

%lu:数字
表13- 2 返回给用户并记录到日志文件的错误
返回给用户的短/长描述
Postgres 代码
内部错误码
Success.
Denotes success
ERRCODESUCCESSFUL
COMPLETION
RC_OK = 0
Failure
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_ERROR = 1
Unknown error has occurred.
Denotes aborted operation.
ERRCODE_FDW_ERROR
RC_ABORT

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
475
返回给用户的短/长描述
Postgres 代码
内部错误码
Column definition of %s is
not supported.
Column type %s is not
supported yet.
ERRCODE_INVALID_COL
UMN_DEFINITION
RC_UNSUPPORTED_COL_
TYPE
Column definition of %s is
not supported.
Column type Array of %s is
not supported yet.
ERRCODE_INVALID_COL
UMN_DEFINITION
RC_UNSUPPORTED_COL_
TYPE_ARR
Column size %d exceeds max
tuple size %u.
Column definition of %s is
not supported.
ERRCODE_FEATURE_NOT
_SUPPORTED
RC_EXCEEDS_MAX_ROW
_SIZE
Column name %s exceeds
max name size %u.
Column definition of %s is
not supported.
ERRCODE_INVALID_COL
UMN_DEFINITION
RC_COL_NAME_EXCEED
S_MAX_SIZE
Column size %d exceeds max
size %u.
Column definition of %s is
not supported.
ERRCODE_INVALID_COL
UMN_DEFINITION
RC_COL_SIZE_INVLALID
Cannot create table.
Cannot add column %s; as
the number of declared
columns exceeds the
maximum declared columns.
ERRCODE_FEATURENOT
SUPPORTED
RC_TABLE_EXCEEDSMA
X
DECLARED_COLS
Cannot create index.
Total column size is greater
than maximum index
size %u.
ERRCODE_FDW_KEYSIZE
EXCEEDS_MAX_ALLOWE
D
RC_INDEX_EXCEEDS_MA
X_SIZE

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
476
返回给用户的短/长描述
Postgres 代码
内部错误码
Cannot create index.
Total number of indexes for
table %s is greater than the
maximum number of indexes
allowed %u.
ERRCODE_FDW_TOOMA
NY
INDEXES
RC_TABLE_EXCEEDS_MA
X_INDEXES
Cannot execute statement.
Maximum number of DDLs
per transaction reached the
maximum %u.
ERRCODE_FDW_TOOMA
NY
DDL_CHANGESIN
TRANSACTIONNOT
ALLOWED
RC_TXN_EXCEEDS_MAX
_DDLS
Unique constraint violation
Duplicate key value violates
unique constraint \“%s\“”.
Key %s already exists.
ERRCODEUNIQUE
VIOLATION
RC_UNIQUE_VIOLATION
Table \“%s\” does not exist.
ERRCODE_UNDEFINED_T
ABLE
RC_TABLE_NOT_FOUND
Index \“%s\” does not exist.
ERRCODE_UNDEFINED_T
ABLE
RC_INDEX_NOT_FOUND
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_LOCAL_ROW_FOUND
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_LOCAL_ROW_NOT_F
OUND
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_LOCAL_ROW_DELET
ED
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_INSERT_ON_EXIST
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_INDEX_RETRY_INSER
T
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_INDEX_DELETE

GBase 8c V5 开发者手册
南大通用数据技术股份有限公司
477
返回给用户的短/长描述
Postgres 代码
内部错误码
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_LOCAL_ROW_NOT_VI
SIBLE
Memory is temporarily
unavailable.
ERRCODE_OUT_OF_LOGI
CAL_MEMORY
RC_MEMORY_ALLOCATI
ON_ERROR
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_ILLEGAL_ROW_STAT
E
Null constraint violated.
NULL value cannot be
inserted into non-null
column %s at table %s.
ERRCODE_FDW_ERROR
RC_NULL_VIOLATION
Critical error.
Critical error: %s.
ERRCODE_FDW_ERROR
RC_PANIC
A checkpoint is in progress –
cannot truncate table.
ERRCODE_FDW_OPERATI
ON_NOT_SUPPORTED
RC_NA
Unknown error has occurred.
ERRCODE_FDW_ERROR
RC_MAX_VALUE

-
ERRCODE_CONFIG_FILE_
ERROR

-
ERRCODE_INVALIDTABL
E
DEFINITION
Memory engine – Failed to
perform commit prepared.
-
ERRCODE_INVALIDTRAN
SACTION
STATE
Invalid option

java.lang.Integer 类
请参考Java 2 Platform SE 6 API java.lang.Integer 类,该类型映射
JDBC 数据类型:TINYINT、SMALLINT、INTEGER。