Thread: postgresql jdbc connect via hostname instead of just ip
Hi all, I'm a bit new to postgresql. I've been able to configure the database and the jdbc interface successfully. I interface via PAM (krb5) and that works OK in the pg_hba.conf file. I've added the -i option to the postmaster startup script service (using binary RPMs on Fedora Core 4) for tcp connections (default port 5432). The only way I can connect to the database via JDBC seems to be by IP address (both locally and on another system allowed by the pg_hba.conf file). jdbc:postgresql://theipaddressofdatabaseserver/mydatabase I'd like to be able to connect to the database this way using a DNS name / computer host name. The specific error I recieve is on the lines of no route to host. I'm sure I'm just missing a simple setting somewhere. Can anyone point me in the right direction? pg_hba.conf host mydatabase all 127.0.0.1/32 pam host mydatabase all theipsubnet/24 pam Many thanks, Jonathan
Jonathan Schreiter <jonathanschreiter@yahoo.com> writes: > The only way I can connect to the database via JDBC > seems to be by IP address (both locally and on another > system allowed by the pg_hba.conf file). > > jdbc:postgresql://theipaddressofdatabaseserver/mydatabase > > I'd like to be able to connect to the database this > way using a DNS name / computer host name. The > specific error I recieve is on the lines of no route > to host. This implies that the IP address in DNS or /etc/hosts is different from the IP address you're using in the URL. It's almost certainly not a Postgres misconfiguration. What happens when you do telnet server.host.name 5432 on the JDBC client machine? -Doug
Hi, I noticed that when I create a primary key with ALTER TABLE ... ADD CONSTRAINT ... PRIMARY KEY (...), and then drop this constraint, then the "not null" modifier stays on the column on which the primary key was defined although there were no constraint on that column before. Is this normal? Pg 8.0.4 create table pritest(id integer); \d pritest alter table pritest add constraint pk_pritest primary key (id); \d pritest alter table pritest drop constraint pk_pritest; \d pritest drop table pritest; Best regards, Otto
Thanks for the help - it was a dns resolving issue after all as you described. Jonathan --- Douglas McNaught <doug@mcnaught.org> wrote: > Jonathan Schreiter <jonathanschreiter@yahoo.com> > writes: > > > The only way I can connect to the database via > JDBC > > seems to be by IP address (both locally and on > another > > system allowed by the pg_hba.conf file). > > > > > jdbc:postgresql://theipaddressofdatabaseserver/mydatabase > > > > I'd like to be able to connect to the database > this > > way using a DNS name / computer host name. The > > specific error I recieve is on the lines of no > route > > to host. > > This implies that the IP address in DNS or > /etc/hosts is different > from the IP address you're using in the URL. It's > almost certainly > not a Postgres misconfiguration. What happens when > you do > > telnet server.host.name 5432 > > on the JDBC client machine? > > -Doug >
Hi, I am writing a driver for PostgreSQL, and I need some rare info: How can I query the collation/locale of the database cluster? What can be the maximal length of the indexed part of the string. So I have a text field, and I create an index on it. How long can be one index key max in this case? How deep can be the subquery nesting? How long can be the index key? What is maximal number of compare operations for a single query? What is maximal length of a query text (characters) ? What is maximal length of a row (bytes) ? What is the maximal length of char/varchar/text ? What operations cannot be rolled back with Rollback ? Thanks in advance, Otto
The answers to these are either "unlimited" or mentioned in the FAQ. --------------------------------------------------------------------------- Havasv�lgyi Ott� wrote: > Hi, > > I am writing a driver for PostgreSQL, and I need some rare info: > > > How can I query the collation/locale of the database cluster? > > What can be the maximal length of the indexed part of the string. So I have > a text field, and I create an index on it. How long can be one index key max > in this case? > > How deep can be the subquery nesting? > > How long can be the index key? > > What is maximal number of compare operations for a single query? > > What is maximal length of a query text (characters) ? > > What is maximal length of a row (bytes) ? > > What is the maximal length of char/varchar/text ? > > What operations cannot be rolled back with Rollback ? > > Thanks in advance, > Otto > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073