一段简单的ProC连接Oracle的代码.
一段简单的ProC连接Oracle的代码.
Code
1 int connectDb()
2 {
3 EXEC SQL BEGIN DECLARE SECTION;
4 char username[20];
5 char password[20];
6 char connect_string[20];
7 EXEC SQL END DECLARE SECTION;
8
9 strcpy(username,"lbc1");
10 strcpy(password,"lbtux");
11 strcpy(connect_string, "lbc1");
12
13 EXEC SQL CONNECT :username IDENTIFIED BY :password USING :connect_string;
14 if ( sqlca.sqlcode < 0 )
15 {
16 return -1;
17
18 }
19 }
posted @
2009-06-05 11:43
中尉
阅读(
422)
评论()
编辑
收藏
举报