QT Postgres driver no go

Code junkies hangout here

Moderators: ChrisThornett, LXF moderators

QT Postgres driver no go

Postby wiz » Tue Apr 12, 2005 8:50 pm

Does anybody know if the --qt-3.3.3 QSQLPSQL Postgres driver-- works with Postgres 8.0.1?

I am revampimg an old app which used Postgres 7.? and an earlier version of QT but I cannot get the two newer versions to connect.
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby nordle » Thu Apr 14, 2005 9:59 pm

Should work fine, mine was compiled against 8.0.0rc1 and works, I would have thought it would be the same though.

Stupid question, but is 8.0.1 setup correctly, can you use odbc or jdbc to connect to it?
User avatar
nordle
LXF regular
 
Posts: 1500
Joined: Fri Apr 08, 2005 9:56 pm

Postby wiz » Fri Apr 15, 2005 5:01 pm

Yup, I can connect ok with anything except the qt driver.
I recompiled qt from source but the postgres driver did not compile because some source header files seemed to be in the wrong location. After trying to fix this my brain is now addled so I have wiped everything and started again.GCC is happily clonking away in the background recompiling qt, so, in about 2 hours I will be ready to try again. I will report any further developments.
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby wiz » Fri Apr 15, 2005 5:09 pm

I didn't make myself very clear above. I am trying to do this on a Slack 10.1 system which does not appear to have a ready compiled qt postgres driver hence the recompilation. As a temporary measure I shifted the whole lot to a Suse system which does have the driver and that is the one I could not get to work, so I am going back to the Slack system to try again.
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby nordle » Fri Apr 15, 2005 9:45 pm

wiz wrote:I didn't make myself very clear above. I am trying to do this on a Slack 10.1 system which does not appear to have a ready compiled qt postgres


ahhh, ok, no problem. Im running Slack 10.1 with the qt postgres driver after compiling it because its not there as standard.

The file it moaned about was probably libpq-fe.h, libpq.h, or postgres.h or similar.
You DONT have to compile all of qt to get the driver up and running. I did this a while ago, so am a bit sketchy on the exact details.

1. When installing postgresql try putting the source in /usr/local/pgsql/src, then compiling with a prefix of /usr/local/pgsql

2. Add /usr/local/pgsql/lib to /etc/ld.so.conf and run ldconfig

3. Copy just the qt source directory (src) and everything below it eg qt-x11-free-3.x.x/src to /usr/lib/qt/src

4. This is the install procedure, takes seconds.
I've put my example of assuming the pgsql source is in /usr/local/pgsql/src below
http://doc.trolltech.com/3.3/sql-driver.html

cd $QTDIR/plugins/src/sqldrivers/psql
qmake -o Makefile "INCLUDEPATH+=/usr/local/pgsql/src/postgresql-8.0.2/src/include /usr/local/pgsql/src/postgresql-8.0.2/src/interfaces/libpq" "LIBS+=-L/usr/lib -lpq" psql.pro
make

Then you could checkinstall make install it to create a package for use later on, qt sql drivers last for ages before needing a recompile, I was still using 7.4.1 compiled from slack 9.1 with 8.0.0

Sorted....hopefully :)
User avatar
nordle
LXF regular
 
Posts: 1500
Joined: Fri Apr 08, 2005 9:56 pm

Postby wiz » Sat Apr 16, 2005 2:58 pm

Thanks for your help. Unfortunately, due to time limits I resorted to the dark side & did the whole job with C Builder but I will return to this as soon as I can
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer

Postby wiz » Wed Apr 20, 2005 7:17 pm

Heeeey! we're done. With a bit more time and a good look at your instructions and the link above, the driver compiled in about 5 seconds and my program connected straight away. I just needed to shift the postgres source up the directory tree one level.
It doesn't explain why the Suse system wont connect though but i'll leave that for someone else. I'm back with Slack & I'm happy:-)
wiz
LXF regular
 
Posts: 119
Joined: Thu Apr 07, 2005 6:20 pm
Location: In front of a computer


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests