Re: Using embedded SQL.

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема Re: Using embedded SQL.
Дата
Msg-id 20000605173717.A3899@fam-meskes.de
обсуждение исходный текст
Ответ на Using embedded SQL.  ("Robert J. Sprawls" <sprawlsr@worldnet.att.net>)
Список pgsql-general
On Sat, Jun 03, 2000 at 05:37:32PM -0500, Robert J. Sprawls wrote:
>     I'm trying to learn embedded SQL in C. However, it's not working
> and reading the documentation is not answering my question(s). Here is my

Please check the test cases in the source tree. They help a little bit.

> #include <stdlib.h>
> #include <stdio.h>
> exec sql include sqlca;
>
> int main( int argc, char *argv[] ) {
>
>    exec sql whenever sqlerror sqlprint;
>    exec sql connect tootle;

The correct syntax is

exec sql connect to tootle;

>    exit( 0 );
>    exec sql disconnect sprawlsr;

Sorry, I do not understand that line. At first your program will never
disconnect from that database since it exists before it can execute that
statement. And second you never connected to sprawlsr so how can you
dissconnect?

> }
>
> And here is what I get back:
>
> sql error Could not connect to database <DEFAULT> in line 25.
>
> What am I doing wrong? Yes, the database does exist as tootle.

Yup, that's one of those Oracle compatibility hacks. If you use connect
without 'to' ecpg expects the following term to a oracle like user
specification.

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: Compiling Error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Vacuum Question