Обсуждение: connecting to the database

Поиск
Список
Период
Сортировка

connecting to the database

От
"viksa verma"
Дата:
Hi,

I have some trouble making connection to the database.
This is what I use.

 EXEC SQL CONNECT TO
            tcp:postgresql://vikas.verma.com:5334/mydbname user vikasverma;

It works fine when I hard code the values like this.
But i want to use macros which i want to define in some other file and
include it.

Something like this

EXEC SQL CONNECT TO
    tcp:postgresql://DB_IP:DB_PORT/DB_NAME user USER;

where DB_IP,DB_NAME,DB_PORT etc are macros defined in some file which i will
include.

Please help with this.

Question 2
If i have to define something in an include file lets say

myheader.h
EXEC SQL DEFINE NUM 20;

then do i have to include this as EXEC SQL INCLUDE myheader.h or #include
myheader.h.


Vikas.