Обсуждение: ODBC and configure
Hi List,
I have installed ODBC and configure the same in RHEL 4.4.
Configured the ODBC in the following way:
[ODBC Data Sources]
testPSQL = PostgreSQL Test
[testPSQL]
Driver=/usr/lib/psqlodbc.so
Description=Sample PostgreSQL DSN
DSN=testPSQL
SERVER=xhost+localhost
Username=postgres
Database=rtdb
ReadOnly=No
Servertype=postgres
Port=5432
FetchBufferSize=99
ServerOptions=
ConnectOptions=
Options=
ReadOnlyi=no
Trace=1
TraceFile=/home/postgres/odbc.trace
Debug=1
DebugFile = /home/postgres/odbc.debug
CommLog = 1
[Default]
Driver = /usr/lib/psqlodbc.so
Description = PostgreSQL Data Source
SERVER=localhost
Port=5432
UserName=postgres
Password=postgres
;Socket=4096
;end odbc.ini
[ODBC]
InstallDir = /usr/lib/libiodbc.so
#=============================================================================#
Steps that I followed to test the ODBC is :
- Downloaded the “odbctest.c” file from website and copied into unix machine
- Compile and run the file
Problem:
While running odbctest testPSQL earlier it was working fine, but now everytime its giving the below error:
odbctest: cannot connect to X server
Please suggest if there is any solution for this. I tried with SERVER=localhost and xhost+localhost, again Severname=localhost and xhost+localhost nothing is working after re-compiling and running the .c file.
Thanks,
Ravi Katkar
On 27/07/10 14:48, Ravi Katkar wrote: > 1. Downloaded the "odbctest.c" file from website and copied into unix machine > 2. Compile and run the file > Problem: > While running odbctest testPSQL earlier it was working fine, but now everytime its giving the below error: > odbctest: cannot connect to X server This isn't a PostgreSQL problem. Your 'odbctest.c' (where *did* you get that, anyway? What URL?) appears to be using a GUI toolkit that requires an X11 graphical environment. That's what "cannot connect to X server" refers to ; it's nothing to do with the PostgreSQL server. If you have an X11 server running on your local machine, connect to the machine odbctest is on using "ssh -X" to enable ssh X11 forwarding. Then odbctest should run over the SSH X11 tunnel. Otherwise, compile odbctest without any GUI requirements. Without some idea of where you got "odbctest.c" and what it is, I can't really help you with that. -- Craig Ringer
Odbctest.c downloaded from the below website http://wwwmath.uni-muenster.de/u/beckelu/DB0506/ODBC/ Please refer if I can get the same .c file from other location. Its not using GUI toolkit . -----Original Message----- From: Craig Ringer [mailto:craig@postnewspapers.com.au] Sent: Tuesday, July 27, 2010 1:37 PM To: Ravi Katkar Cc: 'pgsql-odbc@postgresql.org' Subject: Re: [ODBC] ODBC and configure On 27/07/10 14:48, Ravi Katkar wrote: > 1. Downloaded the "odbctest.c" file from website and copied into unix machine > 2. Compile and run the file > Problem: > While running odbctest testPSQL earlier it was working fine, but now everytime its giving the below error: > odbctest: cannot connect to X server This isn't a PostgreSQL problem. Your 'odbctest.c' (where *did* you get that, anyway? What URL?) appears to be using a GUI toolkit that requires an X11 graphical environment. That's what "cannot connect to X server" refers to ; it's nothing to do with the PostgreSQL server. If you have an X11 server running on your local machine, connect to the machine odbctest is on using "ssh -X" to enable ssh X11 forwarding. Then odbctest should run over the SSH X11 tunnel. Otherwise, compile odbctest without any GUI requirements. Without some idea of where you got "odbctest.c" and what it is, I can't really help you with that. -- Craig Ringer
On 27/07/10 18:23, Ravi Katkar wrote: > Odbctest.c downloaded from the below website http://wwwmath.uni-muenster.de/u/beckelu/DB0506/ODBC/ > Its not using GUI toolkit . Nope, it certainly isn't. But something seems to be trying to talk to your X server, unless that message is somehow weirdly misleading. Here, installing unixodbc from debian packages and compiling odbctest as: gcc -o odbctest odbctest.c -lodbc it runs fine with DISPLAY unset (ie with no access to an X server). My next step in your position would be to strace the binary to see what it's doing, use ldd to examine what it's linking to, or use LD_DEBUG to trace what libraries it accesses. Though, of course, I'd also know how I'd compiled it, which you didn't mention. In any case, though, there's no sign this issue has anything to do with PostgreSQL. I hope this sets you vaguely on the right track, but I'm not really into ODBC at the best of times, so I think I might be about done with my usefulness here. -- Craig Ringer
Craig Ringer <craig@postnewspapers.com.au> writes: > On 27/07/10 18:23, Ravi Katkar wrote: >> Odbctest.c downloaded from the below website http://wwwmath.uni-muenster.de/u/beckelu/DB0506/ODBC/ >> Its not using GUI toolkit . > Nope, it certainly isn't. But something seems to be trying to talk to > your X server, unless that message is somehow weirdly misleading. There's a program called odbctest in (some releases of) the unixODBC package. I suspect Ravi is executing that, not his own program. regards, tom lane
Hi Tom, You are right I am executing odbcTest program in unix odbc package. Regards, Ravi Katkar -----Original Message----- From: Tom Lane [mailto:tgl@sss.pgh.pa.us] Sent: Tuesday, July 27, 2010 8:01 PM To: Craig Ringer Cc: Ravi Katkar; 'pgsql-odbc@postgresql.org' Subject: Re: [ODBC] ODBC and configure Craig Ringer <craig@postnewspapers.com.au> writes: > On 27/07/10 18:23, Ravi Katkar wrote: >> Odbctest.c downloaded from the below website http://wwwmath.uni-muenster.de/u/beckelu/DB0506/ODBC/ >> Its not using GUI toolkit . > Nope, it certainly isn't. But something seems to be trying to talk to > your X server, unless that message is somehow weirdly misleading. There's a program called odbctest in (some releases of) the unixODBC package. I suspect Ravi is executing that, not his own program. regards, tom lane