Xref: alice comp.databases.oracle.tools:35357 Path: alice!news-feed.fnsi.net!netnews.com!newsfeed.berkeley.edu!news.ecn.ou.edu!news1.optus.net.au!optus!ozemail.com.au!news.mel.aone.net.au!newsfeed.aone.net.au!news.mel.connect.com.au!not-for-mail From: "Tom Zamani" Newsgroups: comp.databases.oracle.tools Subject: Re: Pro*C Date: Thu, 11 Nov 1999 10:26:06 +1100 Organization: Customer of Connect.com.au Pty. Ltd. Lines: 146 Message-ID: <80cuqu$jmi$1@perki.connect.com.au> References: <80avng$krg$1@perki.connect.com.au> <382963CF.74C27E@mitre.org> X-Trace: perki.connect.com.au 942276254 20178 203.63.133.169 (10 Nov 1999 23:24:14 GMT) X-Complaints-To: abuse@connect.com.au NNTP-Posting-Date: 10 Nov 1999 23:24:14 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 I went Through the manual and say that I need to include liboci.a in linking. But where is this file, I can not find it. Tom Peter Sylvester wrote in message news:382963CF.74C27E@mitre.org... > You need to link in the appropriate libraries. See the demo makefiles > that come with pro*c. > Peter > > Tom Zamani wrote: > > > > Can you help me please. > > I have this Proc Program which will insert image in to database. > > when I do Proc filename.pc > > gives me the filename.c > > then > > cc filename.c > > which I get these errors > > > > /tmp/ccXQIHcz.o: In function `connect': > > /tmp/ccXQIHcz.o(.text+0x14e): undefined reference to `sqlcxt' > > /tmp/ccXQIHcz.o: In function `sqlerror': > > /tmp/ccXQIHcz.o(.text+0x211): undefined reference to `sqlcxt' > > /tmp/ccXQIHcz.o: In function `insert': > > /tmp/ccXQIHcz.o(.text+0x532): undefined reference to `sqlcxt' > > /tmp/ccXQIHcz.o(.text+0x5b4): undefined reference to `sqlcxt' > > > > Do you know why I am Getting these errors. > > > > /*****Proc Program*****/ > > > > #define _HPUX_SOURCE /*This is necessary for HP platform*/ > > #define _POSIX_SOURCE /*This is necessary for AIX platform*/ > > #include > > #include > > #include > > #include > > EXEC SQL include sqlca; > > EXEC SQL include sqlda; > > > > #define TOTALSIZE 100000 > > typedef struct > > { > > long len; > > char buf[TOTALSIZE]; > > }longvarraw; > > > > typedef struct > > { > > long len; > > char *buf; > > }lvr_type; > > > > EXEC SQL begin declare section; > > EXEC SQL type longvarraw is long varraw(100000); > > EXEC SQL end declare section; > > > > void sqlerror(); > > > > /********************Connect**********************/ > > void connect () > > { > > EXEC SQL begin declare section; > > char *uid="lmt0/lmt0@rock"; > > EXEC SQL end declare section; > > EXEC SQL whenever sqlerror do sqlerror(); > > EXEC SQL connect :uid; > > printf("connected\n"); > > } > > > > /********************sqlerror()********************/ > > void sqlerror() > > { > > EXEC SQL whenever sqlerror continue; > > printf("\nOracle Error!\n"); > > printf("%s.*s\n",sqlca.sqlerrm.sqlerrml,sqlca.sqlerrm.sqlerrmc); > > EXEC SQL rollback work release; > > exit(1); > > } > > > > /********************int > > read_file(filename,buf,bufsize)********************/ > > #define LOCALSIZE 512 > > int read_file(filename, buf,bufsize) > > char *filename, *buf; > > long bufsize; > > { > > char local_buffer[LOCALSIZE]; > > int n; > > int total_size=0; > > int in_fd; > > in_fd=open(filename,O_RDONLY,0); > > if (in_fd=-1) > > return -1; > > while((n=read(in_fd,local_buffer,LOCALSIZE))>0) > > { > > if (total_size+n>bufsize) > > { > > close(in_fd); > > return -1; > > } > > memcpy(buf+total_size,local_buffer,n); > > total_size+=n; > > } > > close(in_fd); > > return(total_size); > > } > > /********************int insert(key,file)********************/ > > int insert(key,file) > > EXEC SQL begin declare section; > > char *key,*file; > > EXEC SQL end declare section; > > { > > EXEC SQL begin declare section; > > longvarraw lvr; > > EXEC SQL end declare section; > > lvr.len=read_file(file,lvr.buf,TOTALSIZE); > > printf("length:%d\n",lvr.len); > > if(lvr.len==-1) > > exit(fprintf(stderr,"Error while reading\n")); > > connect(); > > EXEC SQL whenever sqlerror do sqlerror(); > > EXEC SQL insert into tmp_image values(:key,:lvr); > > EXEC SQL commit; > > printf("Inserted. \n"); > > } > > > > /********************Main********************/ > > > > main (argc,argv) > > int argc; > > char **argv; > > { > > char all[TOTALSIZE]; > > int num_written; > > > > if (argc==2) > > { > > insert(argv[1],argv[2]); > > } > > else > > printf("Error"); > > }