Gbase8s数据库保姆级安装部署 五 CSDK的C语言使用odbc连接数据库的工具安装部署

ODBC的安装配置

1. 需要使用root用户安装csdk

[gbasedbt@node01 install]$ cd csdk/
--下列是odbc的安装包,解压后会存在installclientsdk的执行脚本,通过执行安装工具
[gbasedbt@node01 csdk]$ ll
总用量 178220
-rw-r--r-- 1 gbasedbt gbasedbt 182497280 4月  18 20:43 clientsdk_3.3.0_2_36477d_RHEL6_x86_64.tar
[gbasedbt@node01 csdk]$ tar -xvf *
installclientsdk
doc/
doc/Odbc_machine_notes_4.10.txt
doc/Libcpp_machine_notes_4.10.txt
doc/Glsapi_machine_notes_4.10.txt
doc/ESQLC_machine_notes_4.10.txt
csdk.properties
.gbase.properties
[gbasedbt@node01 csdk]$ ll
总用量 356420
-rw-r--r-- 1 gbasedbt gbasedbt 182497280 4月  18 20:43 clientsdk_3.3.0_2_36477d_RHEL6_x86_64.tar
-rw-r--r-- 1 gbasedbt gbasedbt      2792 3月  23 2021 csdk.properties
drwxr-xr-x 2 gbasedbt gbasedbt       151 3月  23 2021 doc
-rwxr-xr-x 1 gbasedbt gbasedbt 182470658 3月  23 2021 installclientsdk

--开始安装
[gbasedbt@node01 csdk]$ ./installclientsdk
Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

===============================================================================
GBase ClientSDK                                  (created with InstallAnywhere)
-------------------------------------------------------------------------------

Preparing CONSOLE Mode Installation...

Native Install API successfully initialized.
                                 Native Install API successfully initialized.
Install API successfully initialized.
                                 Install API successfully initialized.



===============================================================================
Introduction
------------

The installer will guide you through the installation of GBase Client-SDK
4.10.FC4G1.

Copyright General Data Corporation 2014, 2024, All rights reserved.

It is strongly recommended that you quit all programs before continuing with
this installation.

Respond to each prompt to proceed to the next step in the installation.  If you
want to change something on a previous step, type 'back'.

You may cancel this installation at any time by typing 'quit'.


PRESS <ENTER> TO CONTINUE:



===============================================================================
License Agreement
-----------------

Installation and Use of GBase Client-SDK Requires Acceptance of the Following
License Agreement:

Thank you for choosing GBase product!



Please read carefully the following licencing agreement before installing any
product: TIANJIN GENERAL DATA TECHNOLOGY CO. LTD. LICENSE AGREEMENT



READ THE TERMS OF THIS AGREEMENT AND ANY PROVIDED SUPPLEMENTAL LICENSETERMS
(COLLECTIVELY "AGREEMENT") CAREFULLY BEFORE OPENING THE SOFTWAREMEDIA PACKAGE.
BY OPENING THE SOFTWARE MEDIA PACKAGE, YOU AGREE TO THE TERMS OF THIS
AGREEMENT.  IF YOU ARE ACCESSING THE SOFTWARE ELECTRONICALLY, INDICATE YOUR
ACCEPTANCE OF THESE  TERMS. IF YOU DO NOT AGREE TO ALL THESE TERMS, PROMPTLY
RETURN THE UNUSED  SOFTWARE TO YOUR PLACE OF PURCHASE FOR A REFUND.

1. LICENSE TO USE. GeneralData grants you a non-exclusive and non-transferable
license for  the internal use only of the accompanying software and
documentation and any error corrections  provided by GeneralData(collectively
"Software"), by the number of users and the class of  computer hardware for
which the corresponding fee has been paid.

2. RESTRICTIONS. Software is confidential and copyrighted. Title to Software

PRESS <ENTER> TO CONTINUE:

and all  associated intellectual property rights is retained by GeneralData
and/or its licensors. Except as  specifically authorized in any Supplemental
License Terms, you may not make copies of Software,  other than a single copy
of Software for archival purposes. Unless enforcement is prohibited by
applicable law, you may not modify, decompile, or reverse engineer Software.
You acknowledge  that Software is not designed, licensed or intended for use in
the design, construction, operation  or maintenance of any nuclear facility.
GeneralData disclaims any express or implied warranty  of fitness for such
uses. No right, title or interest in or to any trademark, service mark, logo or
trade name of GeneralData or its licensors is granted under this Agreement.

3. DISCLAIMER OF WARRANTY. Unless specified in this agreement, all express of
implied  conditions, representations and warranties, including any implied
warranty of merchantability,  fitness for aparticular purpose or
non-infringement are disclaimed, except to theextent that  these disclaimers
are held to be legally invalid.

4. LIMITATION OF LIABILITY. To the extent not prohibited by law, in no event
will GeneralData  or its licensors be liable for any lost revenue, profit or
data, or for special, indirect,  consequential, incidental orpunitive damages,
however caused regardless of the theory of liability,  arising out of or
related to the use of or inability to use software, even if GeneralData has

PRESS <ENTER> TO CONTINUE:

been  advised of the possibility of such damages. In no event will
GeneralData's libility to you, whether  incontract, tort(including negligence),
or otherwise, exceed the amount paid by you for Software  under this Agreement.
The foregoing limitations will apply even if the above stated warranty  fails
of itsessential purpose.

5. TERMINATION. This Agreement is effective until terminated. You may terminate
this  Agreement at any time by destroying all copies of Software. This
Agreement will terminate  immediately without noticefrom GeneralData if you
fail to comply with any provision of this  Agreement. Upon Termination, you
must destroy all copies of Software.



6. EXPORT REGULATIONS. All Software and technical data delivered under this
Agreement are  subject to US export control laws and may be subject to export
or import regulations in other  countries. You agree to comply strictly with
all such laws and regulations and acknowledge that  you have the responsibility
to obtain such licenses to export, re-export, or import as may be  required
after delivery to you.

7. CHINESE GOVERNMENT RESTRICTED. If Software is being acquired by or on behalf

PRESS <ENTER> TO CONTINUE:

of the  Chinese Government, then the Government's rights in Software and
accompanying documentation  will be only as set forth in this Agreement.

8. GOVERNING LAW. Any action related to this Agreement will be governed by
Chinese law:  "COPYRIGHT LAW OF THE PEOPLE'S REPUBLIC OF CHINA", "PATENT LAW OF
THE PEOPLE'S  REPUBLIC OF CHINA", "TRADEMARK LAW OF THE PEOPLE'S REPUBLIC OF
CHINA", "COMPUTER  SOFTWARE PROTECTION REGULATIONS OF THE PEOPLE'S REPUBLIC OF
CHINA". No choice of  law rules of any jurisdiction will apply."

9. SEVERABILITY. If any provision of this Agreement is held to be
unenforceable, this  Agreement will remain in effect with the provision
omitted, unless omission would frustrate the  intent of the parties, in which
case this Agreement will immediately terminate.

10. INTEGRATION. This Agreement is the entire agreement between you and
GeneralData  relating to its subject matter. It supersedes all prior or
contemporaneous oral or written  communications, proposals, representations and
warranties and prevails over any conflicting or  additional terms of any quote,
order, acknowledgment, or other communication between the  parties relating to
its subject matter during the term of this Agreement. No modification of this
Agreement will be binding, unless in writing and signed by an authorize
depresentative of each  party. When the translation document has the different

PRESS <ENTER> TO CONTINUE:

meaning or has the conflicting views with  Chinese original text conflict,
should take the laws and regulations promulgation unit as well as  the
GeneralData issue Chinese original text as the standard.



All trademarks and registered trademarks mentioned herein are the  property of
their respective owners.



DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): Y



===============================================================================
Installation Location
---------------------

Where Would You Like to Install GBase Client-SDK 4.10.FC4G1?
--下列为默认的CSDK安装路径,一般项目上是会指定数据库安装的路径,csdk会将库文件整合到数据库安装的目录内,如果没有安装数据库,可以重新自行安装路径
  Default Install Folder: /opt/GBASE/gbase

ENTER AN ABSOLUTE PATH, OR PRESS <ENTER> TO ACCEPT THE DEFAULT
      :



===============================================================================
Installation Features
---------------------




===============================================================================
Choose Product Features
-----------------------

ENTER A COMMA_SEPARATED LIST OF NUMBERS REPRESENTING THE FEATURES YOU WOULD
LIKE TO SELECT, OR DESELECT. TO VIEW A FEATURE'S DESCRIPTION, ENTER
'?<NUMBER>'.  PRESS <RETURN> WHEN YOU ARE DONE:

    1- [X] GBase Client SDK
    2-  |-[X] GBase Object Interface for C++
    3-     |-[X] GBase Object Interface for C++ Demos
    4-  |-[X] GBase ESQL/C
    5-     |-[X] GBase ESQL/C Demos
    6-     |-[X] 7.2 Application Compatibility Module
    7-  |-[X] GBase LIBDMI for Client Applications
    8-  |-[X] GBase ODBC Driver
    9-     |-[X] GBase ODBC Driver Demos
   10-  |-[X] GBase Common Database Utilities
   11- [X] Global Language Support (GLS)
   12-  |-[X] West European and Americas
   13-  |-[X] Chinese
--以下是选择安装的各个插件,一般情况下直接回车,全部安装
Please choose the Features to be installed by this installer.:



===============================================================================
Installation Summary
--------------------

Type 'back' to go to the previous step or 'quit' to cancel the installation.
Please review the following before continuing:

Product Name:
    GBase Client-SDK

Install Folder:
    /opt/GBASE/gbase

Product Features:
    GBase Client SDK,
    GBase Object Interface for C++,
    GBase Object Interface for C++ Demos,
    GBase ESQL/C,
    GBase ESQL/C Demos,
    7.2 Application Compatibility Module,
    GBase LIBDMI for Client Applications,
    GBase ODBC Driver,
    GBase ODBC Driver Demos,
    GBase Common Database Utilities,
    Global Language Support (GLS),
    West European and Americas,
    Chinese

Disk Space Information (for Installation Target):
    Required:  265,155,051 Bytes
    Available: 36,645,498,880 Bytes
--检查上述信息,确认安装
PRESS <ENTER> TO CONTINUE:



===============================================================================
Installing...
-------------

 [==================|==================|==================|==================]
 [------------------|------------------|------------------|------------------]



===============================================================================
Installation Complete
---------------------

Congratulations. GBase Client-SDK 4.10.FC4G1 has been successfully installed
to:

/opt/GBASE/gbase

GBase 8s V8.8


PRESS <ENTER> TO EXIT THE INSTALLER:

[gbasedbt@node01 csdk]$

2. 使用rpm安装odbc的两个包

在linux完整的使用odbc的功能(包括isql、esql),需要安装下面两个插件包

📎unixODBC-devel-2.3.7-2.ky10.x86_64.rpm

📎unixODBC-2.3.7-2.ky10.x86_64.rpm

rpm -ivh unixODBC-2.3.7-2.ky10.x86_64.rpm
rpm -ivh unixODBC-2.3.7-2.ky10.x86_64.rpm unixODBC-devel-2.3.7-2.ky10.x86_64.rpm

3. 配置/etc/profile

--实例名称
export GBASEDBTSERVER=gbasedb1
--数据库安装路径
export GBASEDBTDIR=/home/gbasedbt/gbase
--数据库的连接配置文件
export GBASEDBTSQLHOSTS=/home/gbasedbt/gbase/etc/sqlhosts.gbasedb1
--数据库的参数文件
export ONCONFIG=onconfig.gbasedb1
--gbasedbt数据库的指令文件位置
export PATH=/home/gbasedbt/gbase/bin:$PATH
--字符集
export DB_LOCALE=zh_CN.utf8
export CLIENT_LOCALE=zh_CN.utf8
--开启偏僻字设置,需要和数据库建立时的设置一直
export GL_USEGLU=1
--时间格式设置
export GL_DATE="%Y-%m-%d"
export DATETIME="%Y-%m-%d %H:%M:%S"
--C语言连接需要使用的库文件
export LD_LIBRARY_PATH=$GBASEDBTDIR/lib:$GBASEDBTDIR/lib/cli:$GBASEDBTDIR/lib/=esql:$LD_LIBRARY_PATH
--odbc.ini文件的位置
export ODBCINI=/etc/odbc.ini

4. 配置odbcinst.ini

cat /etc/odbcinst.ini

; /etc/odbcinst.ini
; ODBC Driver for GBase 8s
[GBase ODBC DRIVER] 
--库文件的位置,可以使用ls -l进行检查是否存在,数据库3.5.0版本后库文件名称是这个名称
Driver=/home/gbasedbt/gbase/lib/cli/iclit09b.so 
Setup=/home/gbasedbt/gbase/lib/cli/iclit09b.so
--ODBC驱动程序所支持的ODBC API级别
APILevel=1
--
ConnectFunctions=YYY 
--驱动的版本
DriverODBCVer=03.51 
--驱动程序的文件使用
FileUsage=0 
SQLLevel=1 
--是否每个连接都使用单独的进程
smProcessPerConnect=Y

5. 配置odbc.ini

[ODBC Data Sources]
utf8=GBase ODBC DRIVER
;
;Define ODBC Database Driver's Below-Driver Configuration Section
;
--为每个数据库的连接起的名称
[test]
Driver=/home/gbasedbt/gbase/lib/cli/iclit09b.so
Description=GBase ODBC DRIVER
--要连接的数据库名称,本次测试连接test数据库
Database=test
--使用的用户
LogonID=gbasedbt
--密码
pwd=1q@W3e$R
--数据库实例初始化时的实例名称
Servername=gbasedb1
CursorBehavio=0
--字符集名称
CLIENT_LOCALE=zh_CN.utf8
DB_LOCALE=zh_CN.utf8
TRANSLATIONDLL=/home/gbasedbt/gbase/lib/esql/igo4a304.so
;
;UNICODE connection Section
;
[ODBC]
;uncomment the below line for UNICODE connection
;UNICODE=UCS-4
;
;Trace file Section
;
Trace=0
TraceFile=/home/gbasedbt/gbase/odbctrace.out
InstallDir=/home/gbasedbt/gbase
TRACEDLL=/home/gbasedbt/gbase/lib/cli/idmrs09a.so

6. 可能出现问题

--提示这个库文件不存在
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# isql -v test
[01000][unixODBC][Driver Manager]Can't open lib '/home/gbasedbt/gbase/lib/cli/iclit09b.so' : file not found
[ISQL]ERROR: Could not SQLConnect
--进行查找是否存在
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# ls -l /home/gbasedbt/gbase/lib/cli/iclit09b.so
-rwxr-xr-x 3 gbasedbt gbasedbt 4114212 Dec 14 18:07 /home/gbasedbt/gbase/lib/cli/iclit09b.so
--如果上述文件存在,查看依赖
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# ldd /home/gbasedbt/gbase/lib/cli/iclit09b.so
        linux-vdso.so.1 (0x00007ffcff153000)
        libifgls.so => not found
        libifglx.so => not found
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fdda0bce000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fdda04ba000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fdda0bc7000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fdda0b99000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fdda02de000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fdda0bf9000)
--上述可以看出两个依赖不存在,对其进行查找并软连接
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# find / -name libifgls.so
/home/gbasedbt/gbase/lib/esql/libifgls.so
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# find / -name libifglx.so
/home/gbasedbt/gbase/lib/esql/libifglx.so
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# ln -s /home/gbasedbt/gbase/lib/esql/libifgls.so /lib64/libifgls.so
[root@iZ2ze4p3q6wy4hzagubdmbZ install]# ln -s /home/gbasedbt/gbase/lib/esql/libifglx.so /lib64/libifglx.so
[root@iZ2ze4p3q6wy4hzagubdmbZ ~]# isql test -v
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

  • 8
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值