/*
文件 MyConnectDB.ec
*/
#include <stdio.h>
#include <sqlca.h>
#include <sqlda.h>
#include <sqlstype.h>
#include <sqltypes.h>
int main()
{
EXEC SQL INCLUDE SQLCA;
EXEC SQL BEGIN DECLARE SECTION;
char cUserName[30];
char cPassword[30];
char cDBName[30];
EXEC SQL END DECLARE SECTION;
memset( cUserName, 0x00, sizeof( cUserName ) );
memset( cPassword, 0x00, sizeof(cPassword ) );
memset( cDBName, 0x00, sizeof( cDBName ) );
strncpy( cUserName, "informix", 29 );
strncpy( cPassword, "123456", 29 );
strncpy( cDBName, "db", 29 );
EXEC SQL CONNECT TO :cDBName user:cUserName using:cPassword;
if( sqlca.sqlcode == 0 )
{
printf( "%s", " connect successful !");
}
else
{
printf( "%s", " connect error !!" );
}
return 0;
}
ykt> esql MyConnectDB.ec 后生成的 MyConnectDB.c 与 MyConnectDB.o 文件,
请问: 在sco unix 下 用informix环境下,
如何才能让使提示语句: connect successful ! 显示出来???????
或者说: connect error !!" 显示出来也可以??
------解决方案--------------------------------------------------------
esql -o MyConnectDB MyConnectDB.o
你刚刚编译成目标文件,还没连接成可执行程序呢