Unhandled Exception - Executing Samples

"Eric Chapdelaine" <[email protected]> Mon, 13 Feb 2006 16:47:59 -0500
Newsgroups gmane.comp.db.postgresql.cygwin
Message-ID <20060213214759.FNRG13431.tomts44-srv.bellnexxia.net@echapdelaine>
This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C630BD.3F3F8F00
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hi,

 

I have downloaded the binairies no installer version of PostgreSql for
windows.  (postgresql-8.1.3-1-binaries-no-installer)

I am able to init a database ( initdb), create users and create a database.

I am also able to use the psql executable shell too to Create Table, Insert
record and Query information in my DB.

 

Where it get complicated, is when I try to use the lib libpq and the samples
that come with it.

I am able to compile and link the sample, but when it comes to call the
first DLL function, it crashes with an unhandled exception.

 

Here is the source code where it fails with a context before and after:

 

[,,,]

conninfo = "dbname = myDb";

 

            /* Make a connection to the database */

            conn = PQconnectdb(conninfo);

 

            /* Check to see that the backend connection was successfully
made */

            if (PQstatus(conn) != CONNECTION_OK)

            {

[.]

 

Does anyone knows how I can fix that problem ?

Thank you.

Eric 
Software Engineer
newlogic Canada
[email protected]

 


------=_NextPart_000_0000_01C630BD.3F3F8F00
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"country-region"/>
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Arial Black";
	panose-1:2 11 10 4 2 1 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I have downloaded the binairies no installer version =
of PostgreSql
for windows.&nbsp; =
(postgresql-8.1.3-1-binaries-no-installer)<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I am able to init a database ( initdb), create users =
and
create a database.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I am also able to use the psql executable shell too =
to
Create Table, Insert record and Query information in my =
DB.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Where it get complicated, is when I try to use the =
lib libpq
and the samples that come with it.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I am able to compile and link the sample, but when it =
comes
to call the first DLL function, it crashes with an unhandled =
exception.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Here is the source code where it fails with a context =
before
and after:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[,,,]<o:p></o:p></span></font></p>

<p class=3DMsoNormal style=3D'text-indent:.5in'><i><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;font-style:italic'>conninfo =
=3D
&quot;dbname =3D myDb&quot;;<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'><o:p>&nbsp;</o:p></span></font></i><=
/p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
Make a connection to the database */<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; conn
=3D PQconnectdb(conninfo);<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'><o:p>&nbsp;</o:p></span></font></i><=
/p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*
Check to see that the backend connection was successfully made =
*/<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(PQstatus(conn) !=3D CONNECTION_OK)<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><i><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;font-style:italic'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<o:p></o:p></span></font></i></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>[&#8230;]<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Does anyone knows how I can fix that problem =
?<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Thank you.<o:p></o:p></span></font></p>

<p class=3DMsoNormal =
style=3D'mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><strong><b><=
font
size=3D2 color=3Dnavy face=3DArial><span lang=3DEN-CA =
style=3D'font-size:10.0pt;
font-family:Arial;color:navy'>Eric <br>
</span></font></b></strong><font size=3D2 color=3Dnavy =
face=3DArial><span lang=3DEN-CA
style=3D'font-size:10.0pt;font-family:Arial;color:navy'>Software =
Engineer<br>
</span></font><font size=3D2 color=3Dnavy face=3D"Arial Black"><span
style=3D'font-size:10.0pt;font-family:"Arial =
Black";color:navy'>new</span></font><font
size=3D2 color=3Dteal face=3DArial><span =
style=3D'font-size:10.0pt;font-family:Arial;
color:teal'>logic</span></font><font size=3D2 color=3Dnavy =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:navy'> <st1:place =
w:st=3D"on"><st1:country-region
 w:st=3D"on">Canada</st1:country-region></st1:place><br>
</span></font><font size=3D2 color=3Dblack face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial;color:black'><a =
href=3D"mailto:[email protected]">[email protected]</a></span></fon=
t><b><font
size=3D2 color=3Dnavy face=3DArial><span lang=3DEN-CA =
style=3D'font-size:10.0pt;
font-family:Arial;color:navy;font-weight:bold'><o:p></o:p></span></font><=
/b></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0000_01C630BD.3F3F8F00--