Oracle Learning Record nine PRC C learning

Source: Internet
Author: User

After the previous understanding, now want to use C language to program, search a lot of things, and then decided to use Pro C to learn

After you have installed the Oracle database, you can program it, and there is a command proc to pre-compile the program.

Write a test.pc and then

Proc INAME=TEST.PC oname=test.c

But I can't do this, it's always been a problem.

Later I used

Proc Parse=none code=kr_c line=yes iname=test.pc mode=oracle dbms=v8 unsafe_null=yes

This will generate the test.c file.

Then compile with GCC

GCC TEST.C-L${ORACLE_HOME}/LIB-LCLNTSH-LECPG

I have configured the path of-L here, but why should I write it here?

The problems encountered need further processing.

test.pc

#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sqlca.h>
EXEC SQL BEGIN DECLARE section;char *userid= "Scott"; Char *passwd= "XX"; EXEC SQL END DECLARE section;
int main (int argc, char *argv[]) {EXEC SQL Connect:userid identified by:p asswd;
if (Sqlca.sqlcode = = 0) {printf ("ok\n");        } else {printf ("false\n");    Exit (1); EXEC SQL SELECT * from EMP;
return 0;}

Here I also use Select this sentence, how to show the result?













Oracle Learning Record nine PRC C learning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.