Testing embedded SQL in C

Started by HT NBabout 19 years ago3 messagesgeneral
Jump to latest
#1HT NB
hbnt@hotmail.com

<html><div style='background-color:'><P>Hi,</P>
<P>How are you doing?</P>
<P>First, I am testing if this email address is valid. It is the first time that I am using this account. I have a question about how to start write embedded SQL in C programming code. What are the basic requirements in the .pgc file to have the embedded SQL running.</P>
<P>This is my coding which is aimed at testing if embedded SQL in C programming code is possible for my operating system Debian GNU/Linux.</P>
<P>#include &lt;stdio.h&gt;</P>
<P><BR>int main ( )<BR>{</P>
<P>EXEC SQL CONNECT TO <A href="mailto:database@sql.{ip address}.com">database@sql.{ip address}.com</A> :80;</P>
<P>EXEC SQL INSERT INTO database (tab_number) VALUES (4);<BR>EXEC SQL SELECT * FROM database;</P>
<P>return 1;</P>
<P>}</P>
<P>&nbsp;</P>
<P>Regards,</P>
<P>Huan</P>
<P>Huan Bui</P>
<P>347-602-7029</P>
<P><A href="mailto:hbnt@hotmail.com">hbnt@hotmail.com</A></P>
<P><BR><BR><BR>&nbsp;</P>
<DIV>
<P>&nbsp;</P></DIV></div><br clear=all><hr> <a href="http://g.msn.com/8HMBENUS/2755??PS=47575&quot; target="_top">Check out all that glitters with the MSN Entertainment Guide to the Academy Awards� </a> </html>

#2Reid Thompson
Reid.Thompson@ateb.com
In reply to: HT NB (#1)
Re: Testing embedded SQL in C

On Mon, 2007-02-12 at 15:16 -0500, HT NB wrote:

Hi,

How are you doing?

First, I am testing if this email address is valid. It is the first
time that I am using this account. I have a question about how to
start write embedded SQL in C programming code. What are the basic
requirements in the .pgc file to have the embedded SQL running.

This is my coding which is aimed at testing if embedded SQL in C
programming code is possible for my operating system Debian GNU/Linux.

#include <stdio.h>

int main ( )
{

EXEC SQL CONNECT TO database@sql.{ip address}.com :80;

EXEC SQL INSERT INTO database (tab_number) VALUES (4);
EXEC SQL SELECT * FROM database;

return 1;

}

see http://www.postgresql.org/docs/8.2/static/ecpg.html
see also
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/test/

#3Shane Ambler
pgsql@007Marketing.com
In reply to: HT NB (#1)
Re: Testing embedded SQL in C

HT NB wrote:

Hi,

How are you doing?

First, I am testing if this email address is valid. It is the first time that I
am using this account. I have a question about how to start write embedded SQL
in C programming code. What are the basic requirements in the .pgc file to have
the embedded SQL running.

This is my coding which is aimed at testing if embedded SQL in C programming
code is possible for my operating system Debian GNU/Linux.

#include <stdio.h>

int main ( )
{

EXEC SQL CONNECT TO database@sql.{ip address}.com <mailto:database@sql.{ip
address}.com> :80;

try -
EXEC SQL CONNECT TO database@{ip address}:5432 USER mylogin;

The one thing from your code I would question is your specifying port
80. That is the port for a web server not postgresql. Can you access the
postgresql server directly or are you trying to get to it through a web
server? If you are going through the web server then embedded sql won't
work, you will need to deal with http requests and responses.

EXEC SQL INSERT INTO database (tab_number) VALUES (4);
EXEC SQL SELECT * FROM database;

return 1;

}

--

Shane Ambler
pgSQL@007Marketing.com

Get Sheeky @ http://Sheeky.Biz