Re: Connecting to Oracle from a ProC program.

From: Paul722532 <paul722532_at_aol.com>
Date: 1998/03/06
Message-ID: <19980306135601.IAA11963_at_ladder03.news.aol.com>#1/1


Hi James,

A couple of things to look at.

Try using strcpy instead of strncpy so that SQL_username and SQL_password contain what you want with no extras. Currently both these variables (I presume declared as VARCHARs elsewhere in the program) will be of length MAXSIZE which I doubt they really are. Ensure that your default database as set up by your DBA is the one you want to be connecting to otherwise you will have to use the AT ....USING clause of the CONNECT statement. Finally I suggest you look at datatype equivalencing to make your programming easier and neater, once you've sussed it you'll know what I mean.

e.g.

typedef char t_21(21);

EXEC SQL t_21 IS STRING(21)

void f_connect()
{
t_21 username, password;

printf("Username please\n");
scanf("%s", username);
printf("Password please");
scanf("%s", password);

EXEC SQL CONNECT :username IDENTIFIED BY :password;

}

I can't recall if this is precise at the moment, but I'm sure you get the idea.  Check it out, it's worth knowing. Personally I use the SQLCA to check for errors.

I hope this helps.

Cheers,

Paul Received on Fri Mar 06 1998 - 00:00:00 CET

Original text of this message