Thread: PostgreSQL connect with Visual C++

PostgreSQL connect with Visual C++

From
dhaval257
Date:
Hello friends,
 I am new to postgres. I am doing Project on Image processing in OpenCV(IDE
i am using is Visual C++ 2010). I have downloaded PostgreSQL 8.4 and
installed it successfully. I want to know how to connect postgres with
visual C++.

Please do reply if you know anything. Because I have tried so many sites and
got nothing.



Thanks in advance.



--
View this message in context: http://postgresql.1045698.n5.nabble.com/PostgreSQL-connect-with-Visual-C-tp5747463.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: PostgreSQL connect with Visual C++

From
Guy Rouillier
Date:
On 3/4/2013 11:17 PM, dhaval257 wrote:
> Hello friends,
>   I am new to postgres. I am doing Project on Image processing in OpenCV(IDE
> i am using is Visual C++ 2010). I have downloaded PostgreSQL 8.4 and
> installed it successfully. I want to know how to connect postgres with
> visual C++.

You don't mention if you are using ODBC or a direction connection to the
pgsql library.  I'll assume the latter.  I did a Google search for
"postgresql visual c" and found this example:

http://www.askyb.com/cpp/c-postgresql-example/

If you are just starting with PostgreSQL, you might as well start with
the latest version.  You can get 9.2.3 from the web site
(http://www.postgresql.org/).

--
Guy Rouillier


Re: PostgreSQL connect with Visual C++

From
Albe Laurenz
Date:
dhaval257 wrote:
>  I am new to postgres. I am doing Project on Image processing in OpenCV(IDE
> i am using is Visual C++ 2010). I have downloaded PostgreSQL 8.4 and
> installed it successfully. I want to know how to connect postgres with
> visual C++.

Use something more recent than 8.4 if you can.

You should be able to use the C API (libpq) from C++.
That's part of PostgreSQL core.

Alternatively, you can use the C++ connector libpqxx
(http://pqxx.org/development/libpqxx/)

Yours,
Laurenz Albe


Re: PostgreSQL connect with Visual C++

From
John R Pierce
Date:
On 3/4/2013 8:17 PM, dhaval257 wrote:
> I am new to postgres. I am doing Project on Image processing in OpenCV(IDE
> i am using is Visual C++ 2010). I have downloaded PostgreSQL 8.4 and
> installed it successfully. I want to know how to connect postgres with
> visual C++.

is this app using the .net framework ?   if so, you might want to use
the .net postgresql database connector,
http://npgsql.projects.pgfoundry.org/

if you're NOT using .net then you probably do NOT want to use that
stuff. and should stick with either the libpq C bindings, or the libpqxx
C++ wrapper.


--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: PostgreSQL connect with Visual C++

From
dhaval257
Date:
No It is not using .NET framework. I tried with libpq but ended up with error that "Application can not run because SSLEAY32.dll is missing" (something like this). So I left that thing. Have you used libpq?
Thanks


View this message in context: Re: PostgreSQL connect with Visual C++
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

Re: PostgreSQL connect with Visual C++

From
Christian Ullrich
Date:
* dhaval257 wrote:

> No It is not using .NET framework. I tried with libpq but ended up with
> error that "Application can not run because SSLEAY32.dll is missing"
> (something like this). So I left that thing. Have you used libpq?

ssleay32.dll is part of the PostgreSQL distribution, and is installed in
the /bin/ directory. Since you are getting that error for ssleay32.dll
and not for libpq.dll, I assume you copied libpq.dll somewhere. Copy
ssleay32.dll to the same place.

You will probably get similar errors for other DLLs; all of them are
likely to be in the PostgreSQL /bin/ directory.

As an alternative, you can just add that directory to your %PATH% variable.

--
Christian


Re: PostgreSQL connect with Visual C++

From
dhaval257
Date:
I worked upon this link you sent. It ends up giving error "This applcation
can not start because SSLEAY32.dll is missing." I want to connect in any
form whether it is ODBC or direct. If you know then please help me. I am
stuck here. Thank you



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/PostgreSQL-connect-with-Visual-C-tp5747463p5747642.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


Re: PostgreSQL connect with Visual C++

From
Albe Laurenz
Date:
dhaval257 wrote:
> I worked upon this link you sent. It ends up giving error "This applcation
> can not start because SSLEAY32.dll is missing." I want to connect in any
> form whether it is ODBC or direct. If you know then please help me. I am
> stuck here. Thank you

So why don't you copy ssleay32.dll along with libpq.dll?

Yours,
Laurenz Albe