Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: ProC problem: exec sql connect

Re: ProC problem: exec sql connect

From: Kenneth C Stahl <BlueSax_at_Unforgettable.com>
Date: Wed, 20 Oct 1999 08:49:39 -0400
Message-ID: <380DBA63.E306141A@Unforgettable.com>


Johannes Wilhelm wrote:

> 
> soekotjo_at_my-deja.com wrote:
> > Hi all,
> > I am trying to connect to a remote database from a ProC
> > procgram, but hit a problem.
> > I used this piece of code:
> 
> >  char localstr[200];
> >  sprintf(localstr,"user/password_at_tnsname");
> >  exec sql connect :localstr;
> 
> > and it core dumps with ILL signal (illegal instruction).
> 
> > I tried running sqlplus with the same user/password_at_tnsname
> > combination, and it works. So the tnsname part is OK.
> 
> > I'm using Oracle 7.3.4 on Digital Unix 4.0F.
> 
> > Any help will be much appreciated.
> 
> > Sent via Deja.com http://www.deja.com/

> > Before you buy.
> 
> You must enter:
> 
> EXEC SQL BEGIN DECLARE SECTION;
>    varchar localstr1[200];
>    varchar localstr2[200];
> EXEC SQL END DECLARE SECTION;
>    sprintf(localstr1.arr,"user_at_tnsname");
>    localstr1.len=strlen(localstr1.arr);
>    sprintf(localstr2.arr,"password");
>    localstr2.len=strlen(localstr2.arr);
>    EXEC SQL CONNECT :localstr1 IDENTIFIED BY :localstr2;

That is not true. The version of Pro-C which comes with 7.3.4 does not require declare sections in most cases. varchars are not required (they are a good idea however) and it is perfectly legal to have the entire login string in a single variable. The problem he is having is not with the syntax of what he is doing per-se. As I have posted in another message, he

needs to experiment with different compiler options.

...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
...........................................................
Received on Wed Oct 20 1999 - 07:49:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US