Re: Connect via odbc from Windows to Linux - Mailing list pgsql-jdbc
From | John R Pierce |
---|---|
Subject | Re: Connect via odbc from Windows to Linux |
Date | |
Msg-id | 49336FF0.3070100@hogranch.com Whole thread Raw |
In response to | Connect via odbc from Windows to Linux (Bruce Hyatt <brucejhyatt@yahoo.com>) |
Responses |
Re: Connect via odbc from Windows to Linux
(Bruce Hyatt <brucejhyatt@yahoo.com>)
|
List | pgsql-jdbc |
Bruce Hyatt wrote: > I am trying to set up an odbc connection from Windows 2000 to Postgresql running on Linux (CentOS 4.7). > > I have the appropriate Postgresql jdbc driver on the windows box as well as the hosts file with the linux host. Postgresql.confhas listen_addresses = '*'. The port is the same on both ends. > > Trying various configurations with the odbc datasource administrator, the most friendly response I can get from a testis that the connected party/host failed to respond ("properly after a period of time" in the case of the 'party'). > > I do have portsentry running on the linux host but the windows box is not blocked. > > I'm afraid there must be a simple solution but I can't figure out what it is. Where should I look? > the postgres JDBC driver doesn't use ODBC at all. its a native Java driver that speaks the Postgres protocol directly. to use ODBC, you'd need the Windows ODBC Postgres stack, which is fairly complex to get working right and has little to do with Postgres JDBC, and would just serve to confuse things. In your Java app, you specify jdbc:postgresql://host/database as the connection string... I'd probably run tcpdump on hte linux side, `tcpdump -n tcp port 5432` then try and connect, this will show you if the windows/java app is attemping to connect and its packets are getting through... ideally you should see a whole >SYN <ACK >... tcp connection handshake. it /should/ look something like... 20:56:01.930328 IP 10.0.0.100.34307 > 10.0.0.10.postgres: S 3335832814:3335832814(0) win 32792 <mss 16396,sackOK,timestamp 671638094 0,nop,wscale 7> 20:56:01.930393 IP 10.0.0.10.postgres > 10.0.0.100.34307: S 3338209742:3338209742(0) ack 3335832815 win 32768 <mss 16396,sackOK,timestamp 671638094 671638094,nop,wscale 7> 20:56:01.930439 IP 10.0.0.100.34307 > 10.0.0.10.postgres: . ack 1 win 257 <nop,nop,timestamp 671638094 671638094> 20:56:01.930556 IP 10.0.0.100.34307 > 10.0.0.100.postgres: P 1:9(8) ack 1 win 257 <nop,nop,timestamp 671638094 671638094 ...... (many more packets should follow) where 10.0.0.100 is the Windows PC's IP, 10.0.0.10 is the Postgres server's IP, and 34307 is a random 'source' port (this can be almost anything. if you're using a different port than 5432, then 'postgres' would be replaced with this other port (and, of course, you should specify this port on the tcpdump command instead of 5432...) so... if you DO see this, the network is working and its some other problem. if you don't see it, its a network problem. or the JDBC client isn't specifying the host correctly, or somehting like that.
pgsql-jdbc by date: