esql/c on remote machine
Posted in 1998
Topics: Installation, Setup & Upgrades, Connectivity: ESQL/C, 4GL & Embedded SQL, Security, Permissions & Auditing, Platform-Specific Issues
hi all:
I am running solaris 2.6 with online 7.23 as the server. Client is
solaris 2.6 with client sdk installed. I did a script using perl DBD
stuff on the client machine to
access my sever, everything is fine. Now I am trying a esql/c program as
following:
#include <stdio.h>
EXEC SQL define FNAME_LEN 30;
EXEC SQL define LNAME_LEN 20;
main()
{
EXEC SQL BEGIN DECLARE SECTION;
char fname[ FNAME_LEN + 1 ];
char lname[ LNAME_LEN + 1 ];
EXEC SQL END DECLARE SECTION;
printf( "DEMO1 Sample ESQL Program running.\\n\\n");
EXEC SQL connect to 'tracy@Macbeth';
EXEC SQL declare democursor cursor for
select name, city
into :fname, :lname
from siuaudfil243;
EXEC SQL open democursor;
for (;;)
{
EXEC SQL fetch democursor;
if (strncmp(SQLSTATE, "00", 2) != 0)
break;
printf("%s %s\\n",fname, lname);
}
if (strncmp(SQLSTATE, "02", 2) != 0)
printf("SQLSTATE after fetch is %s\\n", SQLSTATE);
EXEC SQL close democursor;
EXEC SQL free democursor;
EXEC SQL disconnect current;
printf("\\nDEMO1 Sample Program over.\\n\\n");
}
now, this program works if I run it on the server itself, when I run it
on the client, it goes:
DEMO1 Sample ESQL Program running.
SQLSTATE after fetch is 07003
DEMO1 Sample Program over.
What does this indicate?
By the way, how do I specify a user name and password in a esql/c
program?
thanks a lot.
yan
Yan Zhu wrote: > > hi all: > > I am running solaris 2.6 with online 7.23 as the server. Client is > solaris 2.6 with client sdk installed. I did a script using perl DBD > stuff on the client machine to > access my sever, everything is fine. Now I am trying a esql/c program as > following: [SNIP] > now, this program works if I run it on the server itself, when I run it > on the client, it goes: > > DEMO1 Sample ESQL Program running. > > SQLSTATE after fetch is 07003 > DEMO1 Sample Program over. > What does this indicate? > By the way, how do I specify a user name and password in a esql/c > program? You don't have to but you can as an option in the CONNECT statement. ESQL/C uses the Informix connect interface by default which check the client's username against his login permissions on the server. Each user must have a login on the server and the client machine must be trusted either in /etc/hosts.equiv or ~/.rhosts. The users do not have to have a valid password on the server with this type of login. Anyway. In the client's environment you must have INFORMIXSERVER set and you must have an Informix runtime environment installed and the sqlhosts file must list the server/host/service with the service in the local /etc/services file. Art S. Kagel