yunzhongyue 发表于 2010-03-08 09:46

我这边建立了信任关系, A机 test用户 需要访问 B机 xxx用户的数据库,老是 提示错误,而用A机的informix 连 ...
sqlnet 发表于 2010-03-06 20:44 http://bbs2.chinaunix.net/images/common/back.gif


    修改一下test的密码再试试!

sqlnet 发表于 2010-03-10 23:52

你要注意的是数据库的是基于用户的信任的连接,如果不是以数据库用户是无法接连到数据库的. 即A机 ...
liaosnet 发表于 2010-03-07 21:09 http://bbs2.chinaunix.net/images/common/back.gif


    我刚试了一下, 应该是可以的。
A机: test用户 dbaccess,输入用户密码(用户输入的test2,而这个test2 在A机上是没有的)能连接到 B机器数据库上。
SELECT DATABASE >>
Select a database with the Arrow Keys, or enter a name, then press Return.

----------------------- @test ------------------ Press CTRL-W for Help --------

sysadmin@test

sysmaster@test

sysuser@test

sysutils@test

test@test

liaosnet 发表于 2010-03-11 00:15

我刚试了一下, 应该是可以的。
A机: test用户 dbaccess,输入用户密码(用户输入的test2,而这 ...
sqlnet 发表于 2010-03-10 23:52 http://bbs2.chinaunix.net/images/common/back.gif


    这里以public的权限可以连接?? 这个怎么验证的...:((

yunzhongyue 发表于 2010-03-14 19:35

这个我以前遇到过,informix可以连通,其它的用户不可以,你可以用rlogin来试试,如果不能登录成功,修改一下test密码再试试!

sqlnet 发表于 2010-03-14 21:23

本帖最后由 sqlnet 于 2010-03-14 21:26 编辑

sco711 上:
>cat t.ec
main()
{
       $char *user_name = "test";
       $char *user_pass = "test";
       $long num1;
       $struct t1_str {
       long id;
       } t1_str;

       EXEC SQL CONNECT TO "test@test" AS 'SUSE'
       USER :user_name USING :user_pass
               WITH CONCURRENT TRANSACTION ;
       if(SQLCODE){
       printf("error,[%d\n]",SQLCODE);
       }

       $select count(*) into :num1 from t1 ;
       if(SQLCODE){
       printf("error,[%d]\n",SQLCODE);
       }
       printf("count,[%d]\n",num1);
}

>make -f t.mk
Compiling xxxxx t.ec
       esql -c -I/home/testyh/include   t.ec
       rm t.c
       esql t.o-I/home/testyh/include-L/home/testyh/lib -llog -lxxxpub -lzqyw -lcard -lprint -lx_b-o t
UX:cc: WARNING: Avoid specifying -lc; cc will ensure that libc is linked in
       the proper order. Linking libc in the wrong order may cause incorrect
       execution behavior. If you do specify -lc, make sure that no dynamic
       libraries are specified after it.
       #rm -rf t.o

结果为 t1 有4917条记录。
>./t
count,

>tail -f /etc/passwd
listen:x:37:4:Network Admin:/usr/net/nls:/usr/bin/ksh
sco:x:101:1:sco:/home/sco:/usr/bin/ksh
informix:x:102:101::/home/informix:/usr/bin/ksh
tuxedo:x:103:101::/home/tuxedo:/usr/bin/ksh
testyh:x:104:101::/home/testyh:/usr/bin/ksh
tuxtest:x:106:101::/home/tuxtest:/usr/bin/ksh
sybase:x:107:102::/sybase:/usr/bin/ksh
oracle:x:108:103::/home/oracle:/usr/bin/ksh
test111:x:109:101::/home/test111:/usr/bin/ksh
test112:x:110:101::/home/test112:/usr/bin/ksh

>tail -f ~informix/etc/sqlhosts
#
#**************************************************************************

#demo_on      onipcshm      on_hostname   on_servername
#demo_se      seipcpip      se_hostname   sqlexec
online         ontlitcp      sco             8888
test    ontlitcp      192.168.1.150            8889
#test    onsoctcp      192.168.1.150            8889



suse 10上并没有 testyh 用户:
informix@test:/home/informix> tail -f /etc/passwd
uucp:x:10:14:Unix-to-Unix CoPy system:/etc/uucp:/bin/bash
wwwrun:x:30:8:WWW daemon apache:/var/lib/wwwrun:/bin/false
dasusr1:x:1005:1004:dasusr1:/home/dasusr1:/bin/bash
db2fenc1:x:1004:1003:db2fenc1:/home/db2fenc1:/bin/bash
db2inst1:x:1003:1002:db2inst1:/home/db2inst1:/bin/bash
dw:x:1006:1005::/home/dw:/bin/bash
informix:x:1002:1001:informix:/home/informix:/usr/bin/ksh
mqm:x:1001:1000:mqm:/home/mqm:/usr/bin/ksh
testt:x:1007:1001:testt:/home/testt:/bin/bash
test:x:1000:100:test:/home/test:/bin/bash


select count(*) from t1;
----------------------- test@test -------------- Press CTRL-W for Help --------

   (count(*))

         4917


A机器上的A用户访问B机器上的 B用户,并不需要B机器上也有A用户。 我是这样理解的

zzmfs 发表于 2010-03-17 08:58

如B机 用户test 要访问A机 数据库, A 机 需要有这个用户,没有的话,需要新加用户,并给该用户赋予数据库相应权限,如果这些条件都已经满足了,就要看 这两台机器的信任关系是否还有问题, 注意下:/etc/hosts/etc/host.equiv这两个文件。
页: 1 [2]
查看完整版本: informix 主机信任问题求助,急