当前位置: 数据库>oracle
ProC 连接Oracle代码
来源: 互联网 发布时间:2014-09-07
本文导语: 代码如下:int connectDb() { EXEC SQL BEGIN DECLARE SECTION; char username[20]; char password[20]; char connect_string[20]; EXEC SQL END DECLARE SECTION; strcpy(username,"lbc1"); strcpy(password,"lbtux"); strcpy(connect_string, "lbc1"); EXEC SQL CONNECT :username IDENTIFIED BY :password USING :...
代码如下:
int connectDb()
{
EXEC SQL BEGIN DECLARE SECTION;
char username[20];
char password[20];
char connect_string[20];
EXEC SQL END DECLARE SECTION;
strcpy(username,"lbc1");
strcpy(password,"lbtux");
strcpy(connect_string, "lbc1");
EXEC SQL CONNECT :username IDENTIFIED BY :password USING :connect_string;
if ( sqlca.sqlcode < 0 )
{
return -1;
}
}