关于esql/c问题,程序执行连不上数据库
大家好,我使用 rhel 4.6 + informix 11.10【自带sdk】 环境
环境变量
INFORMIXDIR=/home/informix
INFORMIXSERVER=jn_dbs
ONCONFIG=onconfig.jn
DBDATE=MDY4*
INFORMIXSQLHOSTS=/home/informix/etc/sqlhosts
export INFORMIXDIR INFORMIXSERVER ONCONFIG INFORMIXSQLHOSTS
INFORMIXC=gcc
INFORMIXCPP=g++
export INFORMIXC INFORMIXCPP
LD_LIBRARY_PATH=$INFORMIXDIR/lib:$INFORMIXDIR/lib/esql
export LD_LIBRARY_PATH
数据库设置:
sqlhost
Jn_dbs onipcshm 192.168.1.132 sqlexe
jn_dbs_tcp onsoctcp 192.168.1.132 sqlexec
onconfig.jn 部分文件如下
--rootdbs路径、空间
ROOTNAME rootdbs # Root dbspace name
ROOTPATH /home/informix/dbs/rootdbs # Path for device containing root dbspace
ROOTOFFSET 0 # Offset of root dbspace into device (Kbytes)
ROOTSIZE 100000 # Size of root dbspace (Kbytes)
--物理日志的dbs空间,先用rootdbs的20M;
PHYSDBS rootdbs # Location (dbspace) of physical log
PHYSFILE 20000 # Physical log file size (Kbytes)
--逻辑日志用默认的
# Logical Log Configuration
LOGFILES 6 # Number of logical log files
LOGSIZE 2000 # Logical log size (Kbytes)
--把磁带的东西都改成/dev/null
TAPEDEV /dev/null # Tape device path
TAPEBLK 32 # Tape block size (Kbytes)
TAPESIZE 10240 # Maximum amount of data to put on tape (Kbytes)
# Log Archive Tape Device
LTAPEDEV /dev/null # Log tape device path
LTAPEBLK 32 # Log tape block size (Kbytes)
LTAPESIZE 10240 # Max amount of data to put on log tape (Kbytes)
--配置数据库服务器参数,根据自己机器配置的实际情况分配locks和buffers;
# System Configuration
SERVERNUM 0 # Unique id corresponding to a OnLine instance
DBSERVERNAME jn_dbs # Name of default database server
DBSERVERALIASES jn_dbs_tcp # List of alternate dbservernames
NETTYPE ipcshm,1,8,CPU# Configure poll thread(s) for nettype
NETTYPE soctcp,1,8,CPU# Configure poll thread(s) for nettype
DEADLOCK_TIMEOUT 60 # Max time to wait of lock in distributed env.
RESIDENT 0 # Forced residency flag (Yes = 1, No = 0)
编译没问题
运行时错误
错误信息:
** Insufficient host variables to store results.
** FILE: LINE: TIME: Sat Dec 29 22:54:53 2007
** SQLCODE=[-329]
** ERRMSG:
329信息
-329 Database not found or no system permission.The database you tried to open is not visible to the database server.
Check the spelling of the name. Possibly the database is located in a
different database server (or network system), and you have omitted to
specify the server name (or site name) with the database name. If you
are sure the database should exist just as you spelled it, your next
step depends on the database server you are using.
If you are using IBM Informix SE, the visible databases are directories
with names in the form dbname.dbs. You must be able to read from and
write to them. The database server looks first in the current working
directory and then in each directory named in the DBPATH environment
variable. The most common cause of this error is an incorrect setting
or no setting for the DBPATH environment variable.
If you are using IBM Informix Dynamic Server, IBM Informix Universal Server, or
IBM Informix OnLine Dynamic Server, the database does not exist as you spelled it.
In some environments, two or more instances of the database server can run at
once and each instance has its own collection of databases. For Version 6.0
and later, the value of the INFORMIXSERVER environment variable determines the
instance of the database server that you use. For Versions 5.1x and earlier,
the ONCONFIG environment variable points to the configuration file that
determines the instance. See your database server administrator if you think
you might be using the wrong instance.
If you are connected to a secondary database server, the database you tried
to open might exist, but is not logged. Databases are required to be logged
to be able to access them on secondary database servers.
数据库权限为 DBA
数据库权限为 DBA相同用户下可以dbaccess,可以操作
但是运行程序就出现 329 错误,很是奇怪
请各位老大帮吗
回复 #3 ningth 的帖子
我也遇到同样的问题,有高手帮忙看一下吗? 看来搞Informix的高手真是不多了啊回复 #5 wstar 的帖子
不懂esql,米办法~~:em17: :em17: 可能方向:A. EXEC SQL database :dbname; or EXEC SQL connect to :dbname;没有调用或者dbname没给对,调试一下,判断这个语句的sqlca.sqlcode.
B. 程序不是你说的那个用户下运行的,或者程序的属主不对,应该和informix在同一个组,并且你这个用户应该有要操作的数据库的dba(操作要用,如果仅仅是连接可以没有)和connect权限。
C. 环境变量,可能性很小。
回复 #4 reneyangs 的帖子
看样子好像是TUXEDO的中间键环境,你先用esqldemo的程序调通了,记得TUXEDO有自己联INFORMIX的函数库的。 楼主哪里提到用了tuxedo了,我怎么没看见。如果是tuxedo的服务,你需要自己打开数据库,例如再tuxedo的callback函数中加入连接数据库的语句 权限的问题
页:
[1]