Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C63642E421E for ; Tue, 5 Feb 2008 12:15:42 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 88441-01-4 for ; Tue, 5 Feb 2008 12:15:36 -0400 (AST) Received: from beaver.fastcrypt.com (beaver.fastcrypt.com [64.7.141.17]) by postgresql.org (Postfix) with ESMTP id E484A2E40FF for ; Tue, 5 Feb 2008 12:14:18 -0400 (AST) Received: from [192.168.1.14] (dcdsl.ebox.com [64.7.143.116]) by beaver.fastcrypt.com (Postfix) with ESMTP id A42551580665; Tue, 5 Feb 2008 11:15:58 -0500 (EST) Cc: "Guy Rouillier" , pgsql-jdbc@postgresql.org Message-Id: From: Dave Cramer To: Brian Tomaszewski In-Reply-To: <4df751bf0802050802x1239b6d5s607127cbdbc0dd80@mail.gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-64-582558687 Mime-Version: 1.0 (Apple Message framework v915) Subject: Re: JDBC connection problem Date: Tue, 5 Feb 2008 11:14:17 -0500 References: <4df751bf0802041918nafe3dc4na662592641a56a5b@mail.gmail.com> <47A7FCC0.1020201@burntmail.com> <4df751bf0802050517qf027f50xd50d90de9166db1c@mail.gmail.com> <79033F6E-43A8-498F-9390-C58658339C4D@fastcrypt.com> <4df751bf0802050631udddf42o62acace6e21d08ae@mail.gmail.com> <4df751bf0802050802x1239b6d5s607127cbdbc0dd80@mail.gmail.com> X-Mailer: Apple Mail (2.915) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/15 X-Sequence-Number: 18222 --Apple-Mail-64-582558687 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Brian, So my guess is that you can connect to the lowercase_test database on that machine. if so, rename the RW_GEO to lower case. UPPER CASE really is an impedance mismatch on postgresql ( in other words don't do it) . Dave On 5-Feb-08, at 11:02 AM, Brian Tomaszewski wrote: > Dave, > > Thanks for the reply, answers below: > > On Feb 5, 2008 10:39 AM, Dave Cramer wrote: > Brian, > > So to be clear you are using jdbc:postgresql://localhost:5432/dbname > > on both your windows box and your linux box. > > yes - it works on windows but not on linux. I even tried adding > useSSL=true to the connection string and that didn't make a difference > > Both machines have copies of the database locally ? > > yes > > > what does the output of psql -l show on the debian box, > > List of databases > Name | Owner | Encoding > ----------------+----------+---------- > RW_GEO | postgres | UTF8 > lowercase_test | postgres | UTF8 > postgres | postgres | LATIN1 > template0 | postgres | LATIN1 > template1 | postgres | LATIN1 > (5 rows) > > > and is it listening on a tcpip port ? > > > Does "it" refer to the postgres server? if so, how do I check that > it is listening on a TCPIP port? (sorry if this sounds trivial, I am > relatively new to postgres on linux) > > Thanks! > > Brian > > > > Dave > > On 5-Feb-08, at 9:31 AM, Brian Tomaszewski wrote: > >> Dave, >> >> Thanks for the quick reply. >> >> I am using java code like what you show to connect to postresql in >> my app >> >> And that's part of the weird thing - java connect code with >> postgres database on windows is fine, same java code trying to >> connect to to a postgres database on debian, can't connect or even >> see the database for that matter >> >> Could it be a driver version issue? >> >> Thanks again for your time >> >> Brian >> >> >> >> On Feb 5, 2008 8:47 AM, Dave Cramer wrote: >> Brian, >> >> I have no idea why you can't connect but I have comments about >> running tomcat and pg below >> >> write a very small program which attempts to connect outside of >> tomcat >> >> ie >> >> main >> class.forName("org.postgresql.Driver") >> Driver.getConnection(.... >> >> and see if that connects >> >> see below for more comments >> On 5-Feb-08, at 8:17 AM, Brian Tomaszewski wrote: >> >>> Guy, >>> >>> Thanks for the response. See below for clarifications: >>> >>> On Feb 5, 2008 1:05 AM, Guy Rouillier >>> wrote: >>> Brian Tomaszewski wrote: >>> > I am having trouble connecting to a psql database running on >>> Debian >>> > GNU/Linux system >>> > >>> > The version of psql I am using in the system is 8.2.6. >>> > >>> > No matter what I do, I continually am getting the error: >>> > >>> > /Backend start-up failed: FATAL: database "RW_GEO" does not exist >>> > >>> > /when my JDBC component tries to connect using a URL like this: >>> > >>> > jdbc:postgresql://localhost:5432/RW_GEO >>> > >>> > from a tomcat app >>> > >>> > I have confirmed that the database RW_GEO does in fact exist as >>> I can >>> > see/query tables from it from psql. >>> > >>> > Also, when I run my app on my development machine (windows), I can >>> > connect via tomcat with no problems to my local psql server. >>> >>> I'm trying to follow your runtime environment, but some pieces are >>> missing. When you say you can query the database running on Debian >>> using psql, is that psql running on your Windows box or on the >>> Debian >>> box? >>> >>> I can run psql (the command line tool) on Debian and using the >>> psql tool on Debian see/query the database that is always being >>> reported as not existing when the app connects. >>> >>> On my Windows box, I use pgAdmin interface. I also develop the >>> Java Code for the app on windows and then upload it to the server >>> to run/tes. Also, I built the inital database on the windows box, >>> and then uploaded and restored it to the debian postgres running >>> there >>> >>> >>> >>> I don't think this has anything to do with JDBC. The URL you show >>> above has "localhost" as the server for the DB. That's probably not >>> right, is it? I wouldn't think you'd have Tomcat running on your >>> database server. >>> >>> yes, we do have tomcat running on the database server (i.e the >>> debian server), is that a bad thing? >> It's not good, since tomcat and postgresql both like memory. >> However you may not have a choice. >> >>> >>> >>> My thought with using localhost on the debain is that is that is >>> how the tomcat could easily connect >>> >>> >>> So, run psql from whatever box is running Tomcat, and figure out >>> how to >>> connect it to your DB server. >>> >>> I have done this on windows. Every thing for my app on windows is >>> on the same box (tomcat, postgres etc). When I port the app up to >>> the debian server, the connection fails >>> >>> >>> Once you've done that, you should be able >>> to just transfer the connection settings to JDBC. I'm >>> anticipating once >>> you attempt to do that, you'll encounter a connection error. That's >>> because you need to update pg_hba.conf to allow access to your >>> database >>> from remote hosts. >>> >>> >>> Ok, so is the real issue then having tomcat and postgres on the >>> same server? Should they be physically separate? If they are not, >>> what do you need to consider in terms of configuration >>> >> No, it's no real issue, other than a resource sharing problem. >> >> Dave >> >>> Thank you for your time >>> >>> Brian >>> >>> >>> -- >>> Guy Rouillier >>> >>> ---------------------------(end of >>> broadcast)--------------------------- >>> TIP 7: You can help support the PostgreSQL project by donating at >>> >>> http://www.postgresql.org/about/donate >>> >> >> > > --Apple-Mail-64-582558687 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Brian,

So my guess is that you = can connect to the lowercase_test database on that = machine.

if = so, rename the RW_GEO to lower case. UPPER CASE really is an impedance = mismatch on postgresql ( in other words don't do it) .

Dave
On = 5-Feb-08, at 11:02 AM, Brian Tomaszewski wrote:

Dave,

Thanks for the reply, answers = below:

On Feb 5, 2008 10:39 AM, Dave = Cramer <pg@fastcrypt.com> = wrote:
Brian,

So to be clear you are = using = jdbc:postgresql://localhost:5432/dbname 

on = both your windows box and your linux = box.

yes - it works on = windows but not on linux. I even tried adding useSSL=3Dtrue to the = connection string and that didn't make a difference

Both machines have copies of the database = locally ?

yes =
 

what does the output of psql = -l show on the debian box, =

      &nbs= p;   List of databases
      = Name      |  Owner   | = Encoding
----------------+----------+----------
=  RW_GEO         | postgres = | UTF8
 lowercase_test | postgres | = UTF8
 postgres       | postgres | = LATIN1
 template0      | postgres | = LATIN1
 template1      | postgres | = LATIN1
(5 rows)


and is it listening on = a tcpip port ?


Does "it" = refer to the postgres server? if so, how do I check that it is listening = on a TCPIP port? (sorry if this sounds trivial, I am relatively new to = postgres on linux)
=
Thanks!

Brian

 

Dave 

On 5-Feb-08, at 9:31 AM, Brian = Tomaszewski wrote:

Dave,

Thanks = for the quick reply.

I am using java code like what you show to = connect to postresql in my app

And that's part of the weird = thing - java connect code with postgres database on windows is fine, = same java code trying to connect to to a postgres database  on = debian, can't connect or even see the database for that matter

Could it be a driver version = issue?

Thanks again for your time

Brian



On = Feb 5, 2008 8:47 AM, Dave Cramer <pg@fastcrypt.com> wrote:
Brian, 

I have no idea why you can't = connect but I have comments about running tomcat and pg below
=

write a very small program which attempts to connect = outside of = tomcat

ie 

main
class.forName("org.postgresql.Driver")
Driver.getConnecti= on(....

and see if that = connects

see below for more = comments
On 5-Feb-08, at 8:17 AM, = Brian Tomaszewski wrote:

Guy,
=
Thanks for the response. See below for clarifications:

On Feb 5, 2008 1:05 AM, Guy Rouillier <guyr-ml1@burntmail.com> wrote:
Brian = Tomaszewski wrote:
> I am having trouble connecting to a psql = database running on  Debian
> GNU/Linux = system
>
> The version of psql I am using in the system is = 8.2.6.
>
> No matter what I do, I continually am getting the = error:
>
> /Backend start-up failed: FATAL:  database = "RW_GEO" does not exist
>
> /when my JDBC component tries = to connect using a URL like this:
>
> = jdbc:postgresql://localhost:5432/RW_GEO
>
> from a tomcat = app
>
> I have confirmed that the database RW_GEO does in = fact exist as I can
> see/query tables from it from = psql.
>
> Also, when I run my app on my development machine = (windows), I can
> connect via tomcat with no problems to my local = psql server.

I'm trying to follow your runtime environment, = but some pieces are
missing.  When you say you can query the = database running on Debian
using psql, is that psql running on your = Windows box or on the Debian
box?

I can run = psql (the command line tool) on Debian and using the psql tool on Debian = see/query the database that is always being reported as not existing = when the app connects.

On my Windows box, I use pgAdmin = interface. I also develop the Java Code for the app on windows and then = upload it to the server to run/tes. Also, I built the inital database on = the windows box, and then uploaded and restored it to the debian = postgres running there


 
 I don't think = this has anything to do with JDBC.  The URL you show
above has = "localhost" as the server for the DB.  That's probably not
= right, is it?  I wouldn't think you'd have Tomcat running on = your
database server.

yes, we do have tomcat = running on the database server (i.e the debian server), is that a bad = thing?
It's not good, since tomcat = and postgresql both like memory. However you may not have a = choice. 



My thought with using localhost = on the debain is that is that is how the tomcat could easily = connect


So, run psql from whatever box is running = Tomcat, and figure out how to
connect it to your DB server. =  

I have done this on windows. Every thing for = my app on windows is on the same box (tomcat, postgres etc). When I port = the app up to the debian server, the connection fails
=
 
Once you've done that, you should be able
to just transfer the = connection settings to JDBC.  I'm anticipating once
you attempt = to do that, you'll encounter a connection error.  That's
because = you need to update pg_hba.conf to allow access to your database
from = remote hosts.
=

Ok, so is the real issue then having tomcat and postgres on the = same server? Should they be physically separate? If they are not, what = do you need to consider in terms of = configuration

No, it's no real = issue, other than a resource sharing = problem.

Dave

Thank you for your = time

Brian
 

--
Guy = Rouillier

---------------------------(end of = broadcast)---------------------------
TIP 7: You can help support = the PostgreSQL project by donating at

      =          http://www.postgresql.org/about/donate
=
=





= --Apple-Mail-64-582558687--