ProC 连接Oracle代码
程序员文章站
2023-11-17 08:05:10
复制代码 代码如下:int connectdb() { exec sql begin declare section; char username[20]; char pa...
复制代码 代码如下:
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;
}
}