Difference between revisions of "PostgreSQL setup"
From ATI public wiki
((by SublimeText.Mediawiker)) |
((by SublimeText.Mediawiker)) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
# First step is to go to http://www.enterprisedb.com/products-services-training/pgdownload#windows and download the corresponding PostgreSQL installation for your system. Assuming 64 bit from further on. | # First step is to go to http://www.enterprisedb.com/products-services-training/pgdownload#windows and download the corresponding PostgreSQL installation for your system. Assuming 64 bit from further on. | ||
# Install PostgreSQL into C:\PostgreSQL. (Can be anywhere, however Dev-Cpp does not seem to work well with paths that have spaces.) | # Install PostgreSQL into C:\PostgreSQL. (Can be anywhere, however Dev-Cpp does not seem to work well with paths that have spaces.) | ||
− | # Assuming you are using Dev-Cpp, you now have to add the library and included directory paths to the IDE. Go to '''Tools->Compiler options->Directories'''. In the Libraries tab add a new directory "'''C:\PostgreSQL\lib'''" | + | # Assuming you are using Dev-Cpp, you now have to add the library and included directory paths to the IDE. |
− | # | + | ##Go to '''Tools->Compiler options->Directories'''. |
− | # Go to http://gnuwin32.sourceforge.net/downlinks/make-dep-zip.php and download the zip file. Extract | + | ##In the Libraries tab add a new directory "'''C:\PostgreSQL\lib'''" |
+ | ##In the C Includes tab add a new directory "'''C:\PostgreSQL\include'''". | ||
+ | ##Then in the '''Tools->Compiler options->General''' add the '''-lpq''' argument in the bottom textbox (can be either one really). | ||
+ | # Copy libpq.dll file from the PostgreSQL installation directory ('''C:\PostgreSQL\lib\libpq.dll''') to '''C:\Windows\System32'''. | ||
+ | # Go to http://gnuwin32.sourceforge.net/downlinks/make-dep-zip.php and download the zip file. | ||
+ | ## Extract the zip file. | ||
+ | ## Navigate to 'bin' folder | ||
+ | ## Rename libintl3.dll to '''libintl.dll'''. | ||
+ | ## Copy/move '''libintl.dll''' and '''libiconv2.dll''' both to '''C:\Windows\System32'''. | ||
+ | # In your C file add ''#include <libpq-fe.h>''. | ||
# Try compiling. | # Try compiling. | ||
+ | |||
+ | Screenshots of the process: http://ati.ttu.ee/~hkinks/iag0582/database/psql-tutorial/ |
Latest revision as of 00:08, 17 May 2016
Windows
This tutorial will walk you through the steps of how you can set up the PostgreSQL environment with necessary libpsql libraries needed to connect to PostgreSQL database with C.
- First step is to go to http://www.enterprisedb.com/products-services-training/pgdownload#windows and download the corresponding PostgreSQL installation for your system. Assuming 64 bit from further on.
- Install PostgreSQL into C:\PostgreSQL. (Can be anywhere, however Dev-Cpp does not seem to work well with paths that have spaces.)
- Assuming you are using Dev-Cpp, you now have to add the library and included directory paths to the IDE.
- Go to Tools->Compiler options->Directories.
- In the Libraries tab add a new directory "C:\PostgreSQL\lib"
- In the C Includes tab add a new directory "C:\PostgreSQL\include".
- Then in the Tools->Compiler options->General add the -lpq argument in the bottom textbox (can be either one really).
- Copy libpq.dll file from the PostgreSQL installation directory (C:\PostgreSQL\lib\libpq.dll) to C:\Windows\System32.
- Go to http://gnuwin32.sourceforge.net/downlinks/make-dep-zip.php and download the zip file.
- Extract the zip file.
- Navigate to 'bin' folder
- Rename libintl3.dll to libintl.dll.
- Copy/move libintl.dll and libiconv2.dll both to C:\Windows\System32.
- In your C file add #include <libpq-fe.h>.
- Try compiling.
Screenshots of the process: http://ati.ttu.ee/~hkinks/iag0582/database/psql-tutorial/