免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3227 | 回复: 6
打印 上一主题 下一主题

新手救助:OCS12.5测试例子问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-25 11:11 |只看该作者 |倒序浏览
最近有个项目需要在本机vm-fedora11环境里写程序,连接局域网内的sybase数据库(IQ 12.6)进行数据读取

在fedora11环境里,补充了一些必须库之后 顺利安装了
sybase-common-12.5.0.1DE-1.i386.rpm
sybase-ase-12.5.0.1ESD-1.i386.rpm
sybase-openclient-12.5.0.1ESD-1.i386.rpm


编译连接通过了官方提供的ctfirst.c例子  -lct -lcs -lsybtcl -lcomn -lintl -linsck -lnsl -ldl -lm

在interfaces中添加了
  1. P
  2.         mrr tcp ether IP PORT
复制代码
执行测试程序后显示错误
Client-Library Message: LAYER = (5) ORIGIN = (3) SEVERITY = (4) NUMBER = (2)
Message String: ct_connect(): network packet layer: internal net library error: Netlib state error - Netlib initialization may have failed
Fatal error line 252: (0) Connection attempt failed.

本机与sybase数据库网络是正常的,可以用客户端连接上,也可以ping通
在网络上检索“ Netlib initialization may have failed” 很多说是版本问题
很无解  请指教

论坛徽章:
6
水瓶座
日期:2014-06-04 03:34:37水瓶座
日期:2014-06-17 13:20:31数据库技术版块每日发帖之星
日期:2016-07-09 06:20:00数据库技术版块每日发帖之星
日期:2016-07-17 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-04 06:20:00
2 [报告]
发表于 2010-03-25 11:21 |只看该作者
Netlib initialization may have failed

感觉网络配置的问题较大。 在物理机上都有这样的问题,何况虚拟机?

论坛徽章:
0
3 [报告]
发表于 2010-03-25 11:38 |只看该作者
这么说 在非vm的linux机器上再试试?

论坛徽章:
0
4 [报告]
发表于 2010-03-25 18:08 |只看该作者
本帖最后由 senic 于 2010-03-25 18:11 编辑

问题解决了,配置问题
包括系统环境变量以及interfaces,新手问题
寻找问题最佳的方法还是老实的官方的文档看一遍尤其是
Configuration Guide Open Client™ and Open Server™  UNIX
Client-Library™/C Reference Manual Open Client™ UNIX

sybase相关的网络资料远少于其他数据库,不方便“懒人”

论坛徽章:
0
5 [报告]
发表于 2010-03-30 21:50 |只看该作者
你的ip该不会用的是127.0.0.1吧?

论坛徽章:
0
6 [报告]
发表于 2010-03-30 23:51 |只看该作者
需要配置OCS的配置,配置服务器的名字,就跟oracle的tnsname.ora一样:

Using dscp to configure an OCS server definition
The follwing instructions describe how to use the Sybase dscp utility, which is provided with OCS, to create a server definition. For more information about dscp and its definition options, please see the Configuration Guide Open Client and Open Server 15.0 for UNIX, specifically Chapter 7, "Using dscp," and Appendix A, "Utility Commands Reference."
Before you can use dscp, you need to set the Sybase environment variables. Change to the $SYBASE directory and run the Sybase environment variable script (SYBASE.(c)sh). The script will set the $SYBASE and $SYBASE_OCS variables as well as others. For example, for a C shell environment, enter the following command:
        source SYBASE.cshOpen the dscp utility by changing to the $SYBASE/bin directory, entering the following command and pressing Enter:
        dscpThe dscp command prompt (>>) should return. To see a list of dscp commands, enter a question mark (?) at the command prompt.

To open the default session, enter the following at the command prompt and press Enter.
        openThe status of the command returns, which should be "ok" and then the prompt changes, for example, to "Session 1 InterfacesDriver>> ".

Add the new server by entering "add <server_name>" and pressing Enter. For example, to create an OCS server definition for the Sybase IQ demo database, enter the following and press Enter.
        add asiqdemoThe following prompts will return to gather connection information about the target database server. Enter the information appropriate for each prompt and press Enter in between:

Service: [ASE] - press Enter to accept this default value for all supported Sybase databases, even IQ.

Transport Type: [tcp] - press Enter to accept this default value.

Transport Address: - enter the target Sybase database server host machine name, a space, and the port number, and then press Enter. For example, enter "test_host 2638", for a Sybase IQ host machine named "test_host" with the default Sybase IQ demo database port of 2638. Note that dscp allows you to enter multiple entries for the address information. Thus, the Transport Type: [tcp] prompt returns again followed by the Transport Address prompt. You can either add additional entries or leave the both prompts blank and press Enter after each. Then dscp will continue with the remaining prompts.

Security Mechanism[]: - for the sake of this sample configuration leave this prompt blank and press Enter. Then do so for the remaining parameters: HA Failoverserver, Retry Count and Retry Delay. When you press Enter after the last prompt, dscp returns the message "Added <server_name>", for example, "Added asiqdemo." Then it returns to the dscp command prompt: Session 1 InterfacesDriver>>.

You can view information about the server definition you just added by entering "read <server_name>" and pressing Enter. This command returns the following information for the Sybase IQ asiqdemo sample information:
        DIT base for objects: interfaces
        Distinguish name: asiqdemo
        Server Entry Version: 1       
        Server Name: asiqdemo
        Server Service: SQL Server
        Server Status: 4 (Unknown)
        Server Address:
        Transport Type: tcp
        Transport Address: test_host 2638                               
        Then dscp returns to the command prompt.

To make any modifications, you can enter "mod <server_name>" and dscp will prompt you with the parameters like it does when you are adding a new server definition. Note that if you enter into the modification mode and do not make any changes to the properties, dscp will return a message after the last parameter prompt saying "Error in modifying <server_name>."
To exit the dscp utility, type "quit" or "exit" and press Enter. The regular UNIX command prompt returns.
The Sybase OCS configuration is ready for client connectivity.

论坛徽章:
6
水瓶座
日期:2014-06-04 03:34:37水瓶座
日期:2014-06-17 13:20:31数据库技术版块每日发帖之星
日期:2016-07-09 06:20:00数据库技术版块每日发帖之星
日期:2016-07-17 06:20:00数据库技术版块每日发帖之星
日期:2016-08-01 06:20:00数据库技术版块每日发帖之星
日期:2016-08-04 06:20:00
7 [报告]
发表于 2010-03-31 09:05 |只看该作者
vi $SYBASE/interfaces

asiqdemo
           master tcp ether test_host 2638
           query tcp ether test_host 2638


:wq

搞定@!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP