Обсуждение: problem to connect to database

Поиск
Список
Период
Сортировка

problem to connect to database

От
Melanie Bergeron
Дата:
Hi all!

I really need your help for this.  I installed the JDBC driver on my
machine by copying the jar file in C:\Program Files\Apache Software
Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
variable CLASSPATH to this path.  I  create a JSP page (code below).
The first time I launched this JSP page, all was ok.  I don't use it
since last week but when I try to launched it yesterday, I got an error
to connecting database :

Error establishing the connection :
Something unusual has occured to cause the driver to fail.
Please report this exception: Exception: {0}

So, I don't think the error come from my code because it already work with the same code but I don't know what I do to
causethis error now.   
Any help will be greatly appreciated.

Melanie


-------code for jsp page---------
<%
  /* Load the JDBC Driver */
  try {
    Class.forName("org.postgresql.Driver");
  }catch(ClassNotFoundException cnfe) {
    out.println("<BR>Error loading driver " + cnfe + "<BR>");
  }
  /* Define the connection URL */
  String dbName = "gec_test";
  String host = "localhost";
  String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
  /* Establish the connection */
  String username = "bergeron.melanie";
  String password = "*****";
  try{
    Connection connection = DriverManager.getConnection(postgresqlUrl,
username, password);
    ...
    }
    connection.close();
  }catch(SQLException e){
    out.println("<BR>Error establishing the connection : " + e + "<BR>");
  }




Re: problem to connect to database

От
Dave Cramer
Дата:
Melanie,

Can you telnet into the connection ?

telnet host:5432

Dave
On Thu, 2004-01-15 at 10:49, Melanie Bergeron wrote:
> Hi all!
>
> I really need your help for this.  I installed the JDBC driver on my
> machine by copying the jar file in C:\Program Files\Apache Software
> Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
> variable CLASSPATH to this path.  I  create a JSP page (code below).
> The first time I launched this JSP page, all was ok.  I don't use it
> since last week but when I try to launched it yesterday, I got an error
> to connecting database :
>
> Error establishing the connection :
> Something unusual has occured to cause the driver to fail.
> Please report this exception: Exception: {0}
>
> So, I don't think the error come from my code because it already work with the same code but I don't know what I do
tocause this error now.   
> Any help will be greatly appreciated.
>
> Melanie
>
>
> -------code for jsp page---------
> <%
>   /* Load the JDBC Driver */
>   try {
>     Class.forName("org.postgresql.Driver");
>   }catch(ClassNotFoundException cnfe) {
>     out.println("<BR>Error loading driver " + cnfe + "<BR>");
>   }
>   /* Define the connection URL */
>   String dbName = "gec_test";
>   String host = "localhost";
>   String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
>   /* Establish the connection */
>   String username = "bergeron.melanie";
>   String password = "*****";
>   try{
>     Connection connection = DriverManager.getConnection(postgresqlUrl,
> username, password);
>     ...
>     }
>     connection.close();
>   }catch(SQLException e){
>     out.println("<BR>Error establishing the connection : " + e + "<BR>");
>   }
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
--
Dave Cramer
519 939 0336
ICQ # 1467551


Re: problem to connect to database

От
Erwan Arzur
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Melanie Bergeron wrote:
| Hi all!
|
| I really need your help for this.  I installed the JDBC driver on my
| machine by copying the jar file in C:\Program Files\Apache Software
| Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
| variable CLASSPATH to this path.  I  create a JSP page (code below).
| The first time I launched this JSP page, all was ok.  I don't use it
| since last week but when I try to launched it yesterday, I got an error
| to connecting database :
|
| Error establishing the connection : Something unusual has occured to
| cause the driver to fail. Please report this exception: Exception: {0}
|
| So, I don't think the error come from my code because it already work
| with the same code but I don't know what I do to cause this error now.
| Any help will be greatly appreciated.
|
| Melanie
|
|
| -------code for jsp page---------
| <%
|  /* Load the JDBC Driver */
|  try {
|    Class.forName("org.postgresql.Driver");
|  }catch(ClassNotFoundException cnfe) {
|    out.println("<BR>Error loading driver " + cnfe + "<BR>");
|  }
|  /* Define the connection URL */
|  String dbName = "gec_test";
|  String host = "localhost";
|  String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
|  /* Establish the connection */
|  String username = "bergeron.melanie";
|  String password = "*****";
|  try{
|    Connection connection = DriverManager.getConnection(postgresqlUrl,
| username, password);
|    ...
|    }
|    connection.close();
|  }catch(SQLException e){
|    out.println("<BR>Error establishing the connection : " + e + "<BR>");
|  }
|

Don't do that kind of ugly thing :-) !

You should setup tomcat so it manages a DBCP pool of connections for
you. Then you get a connection from the pool at your JSP page startup.

All is well documented, there's a specific DBCP/Postgresql sample in
this document :
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFABr5QtchshDF9KNYRAgtAAJ0aRczp62CPefdGQqhyK2bm+uo0wACfey43
AcJ9uL15zT9zXiAD5NLWEJ4=
=PeF1
-----END PGP SIGNATURE-----


Re: problem to connect to database

От
Melanie Bergeron
Дата:
No, I can't :
Connecting To host:5432...Could not open a connection to host on port 23
: Connect failed

What does that mean?

Melanie

Dave Cramer wrote:

>Melanie,
>
>Can you telnet into the connection ?
>
>telnet host:5432
>
>Dave
>On Thu, 2004-01-15 at 10:49, Melanie Bergeron wrote:
>
>
>>Hi all!
>>
>>I really need your help for this.  I installed the JDBC driver on my
>>machine by copying the jar file in C:\Program Files\Apache Software
>>Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
>>variable CLASSPATH to this path.  I  create a JSP page (code below).
>>The first time I launched this JSP page, all was ok.  I don't use it
>>since last week but when I try to launched it yesterday, I got an error
>>to connecting database :
>>
>>Error establishing the connection :
>>Something unusual has occured to cause the driver to fail.
>>Please report this exception: Exception: {0}
>>
>>So, I don't think the error come from my code because it already work with the same code but I don't know what I do
tocause this error now.   
>>Any help will be greatly appreciated.
>>
>>Melanie
>>
>>
>>-------code for jsp page---------
>><%
>>  /* Load the JDBC Driver */
>>  try {
>>    Class.forName("org.postgresql.Driver");
>>  }catch(ClassNotFoundException cnfe) {
>>    out.println("<BR>Error loading driver " + cnfe + "<BR>");
>>  }
>>  /* Define the connection URL */
>>  String dbName = "gec_test";
>>  String host = "localhost";
>>  String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
>>  /* Establish the connection */
>>  String username = "bergeron.melanie";
>>  String password = "*****";
>>  try{
>>    Connection connection = DriverManager.getConnection(postgresqlUrl,
>>username, password);
>>    ...
>>    }
>>    connection.close();
>>  }catch(SQLException e){
>>    out.println("<BR>Error establishing the connection : " + e + "<BR>");
>>  }
>>
>>
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>>
>>
>>



Re: problem to connect to database

От
Jan de Visser
Дата:
On January 15, 2004 11:38 am, Melanie Bergeron wrote:
> No, I can't :
> Connecting To host:5432...Could not open a connection to host on port 23
>
> : Connect failed

Try
$ telnet host 5432

(Without the colon)

JdV!!

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

Re: problem to connect to database

От
Csaba Nagy
Дата:
It means telnet has a different syntax. Try 'man telnet' if you're on
Unix/Linux. Then do the following:
  - you have to replace 'host' with the DNS name (or IP address) of your
computer running the postgres server;
  - use the syntax:

telnet your.host.address 5432

Than post the result, and hopefully the others can help again :)

HTH,
Csaba

On Thu, 2004-01-15 at 17:38, Melanie Bergeron wrote:
> No, I can't :
> Connecting To host:5432...Could not open a connection to host on port 23
> : Connect failed
>
> What does that mean?
>
> Melanie
>
> Dave Cramer wrote:
>
> >Melanie,
> >
> >Can you telnet into the connection ?
> >
> >telnet host:5432
> >
> >Dave
> >On Thu, 2004-01-15 at 10:49, Melanie Bergeron wrote:
> >
> >
> >>Hi all!
> >>
> >>I really need your help for this.  I installed the JDBC driver on my
> >>machine by copying the jar file in C:\Program Files\Apache Software
> >>Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
> >>variable CLASSPATH to this path.  I  create a JSP page (code below).
> >>The first time I launched this JSP page, all was ok.  I don't use it
> >>since last week but when I try to launched it yesterday, I got an error
> >>to connecting database :
> >>
> >>Error establishing the connection :
> >>Something unusual has occured to cause the driver to fail.
> >>Please report this exception: Exception: {0}
> >>
> >>So, I don't think the error come from my code because it already work with the same code but I don't know what I do
tocause this error now.   
> >>Any help will be greatly appreciated.
> >>
> >>Melanie
> >>
> >>
> >>-------code for jsp page---------
> >><%
> >>  /* Load the JDBC Driver */
> >>  try {
> >>    Class.forName("org.postgresql.Driver");
> >>  }catch(ClassNotFoundException cnfe) {
> >>    out.println("<BR>Error loading driver " + cnfe + "<BR>");
> >>  }
> >>  /* Define the connection URL */
> >>  String dbName = "gec_test";
> >>  String host = "localhost";
> >>  String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
> >>  /* Establish the connection */
> >>  String username = "bergeron.melanie";
> >>  String password = "*****";
> >>  try{
> >>    Connection connection = DriverManager.getConnection(postgresqlUrl,
> >>username, password);
> >>    ...
> >>    }
> >>    connection.close();
> >>  }catch(SQLException e){
> >>    out.println("<BR>Error establishing the connection : " + e + "<BR>");
> >>  }
> >>
> >>
> >>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >>
> >>
> >>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


Re: problem to connect to database

От
Melanie Bergeron
Дата:
I can't use telnet.  If I try [telnet localhost:5432] it always return
the same error message "Connecting To host:5432...Could not open a
connection to host on port 23 : Connect failed" but if I do [netstat
-an], it returns :
...
  TCP    0.0.0.0:5432           0.0.0.0:0              LISTENING
...

Any idea?

Melanie Bergeron wrote:

> No, I can't :
> Connecting To host:5432...Could not open a connection to host on port
> 23 : Connect failed
>
> What does that mean?
>
> Melanie
>
> Dave Cramer wrote:
>
>> Melanie,
>>
>> Can you telnet into the connection ?
>>
>> telnet host:5432
>>
>> Dave
>> On Thu, 2004-01-15 at 10:49, Melanie Bergeron wrote:
>>
>>
>>> Hi all!
>>>
>>> I really need your help for this.  I installed the JDBC driver on my
>>> machine by copying the jar file in C:\Program Files\Apache Software
>>> Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
>>> variable CLASSPATH to this path.  I  create a JSP page (code
>>> below).  The first time I launched this JSP page, all was ok.  I
>>> don't use it since last week but when I try to launched it
>>> yesterday, I got an error to connecting database :
>>>
>>> Error establishing the connection : Something unusual has occured to
>>> cause the driver to fail. Please report this exception: Exception: {0}
>>>
>>> So, I don't think the error come from my code because it already
>>> work with the same code but I don't know what I do to cause this
>>> error now.  Any help will be greatly appreciated.
>>>
>>> Melanie
>>>
>>>
>>> -------code for jsp page---------
>>> <%
>>>  /* Load the JDBC Driver */
>>>  try {
>>>    Class.forName("org.postgresql.Driver");
>>>  }catch(ClassNotFoundException cnfe) {
>>>    out.println("<BR>Error loading driver " + cnfe + "<BR>");
>>>  }
>>>  /* Define the connection URL */
>>>  String dbName = "gec_test";
>>>  String host = "localhost";
>>>  String postgresqlUrl = "jdbc:postgresql://" + host + "/" + dbName;
>>>  /* Establish the connection */
>>>  String username = "bergeron.melanie";
>>>  String password = "*****";
>>>  try{
>>>    Connection connection =
>>> DriverManager.getConnection(postgresqlUrl, username, password);
>>>    ...
>>>    }
>>>    connection.close();
>>>  }catch(SQLException e){
>>>    out.println("<BR>Error establishing the connection : " + e +
>>> "<BR>");
>>>  }
>>>
>>>
>>>
>>>
>>> ---------------------------(end of
>>> broadcast)---------------------------
>>> TIP 1: subscribe and unsubscribe commands go to
>>> majordomo@postgresql.org
>>>
>>>
>>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
> .
>



Re: problem to connect to database

От
Jan de Visser
Дата:
On January 15, 2004 01:36 pm, you wrote:
>  If I try [telnet localhost:5432]

As I said:

$ telnet localhost 5432

Without the colon.

JdV!!

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

Re: problem to connect to database

От
Paul Thomas
Дата:
On 15/01/2004 15:49 Melanie Bergeron wrote:
> Hi all!
>
> I really need your help for this.  I installed the JDBC driver on my
> machine by copying the jar file in C:\Program Files\Apache Software
> Foundation\Tomcat 5.0\common\lib\pg73jdbc3.jar and set environment
> variable CLASSPATH to this path.  I  create a JSP page (code below).
> The first time I launched this JSP page, all was ok.  I don't use it
> since last week but when I try to launched it yesterday, I got an error
> to connecting database :

Forget classpath. Tomcat uses its own class loaders. You need to put your
jar file in common/lib. BTW, putting Java code in JSPs is not recommended.
Look at using something like Struts in combination with a persistence
framework like Hibernate or iBatis.

HTH

--
Paul Thomas
+------------------------------+---------------------------------------------+
| Thomas Micro Systems Limited | Software Solutions for the Smaller
Business |
| Computer Consultants         |
http://www.thomas-micro-systems-ltd.co.uk   |
+------------------------------+---------------------------------------------+

Re: problem to connect to database

От
Melanie Bergeron
Дата:
I added the line [host    all     all     10.0.0.0   255.255.255.0
trust] in my pg_hba.conf (the other line was already there) but no results.
I will take a look to the tutorial, maybe I will find my problem.  But I
still can't figured out why it worked last week and not today.

Thanks to all for your replies

Melanie

Erwan Arzur wrote:

> Dave wanted you to check just that, but used a syntax that just
> doesn't work on the platform you're using (did you see that it's
> trying to resolve host:5432 ?). Telnet connects you to the TCP port
> you specify on the command line, and 'man telnet' is your friend, by
> the way ...
>
>
> The output of netstat just means your server is started and listening
> on port 5432, so that's one problem solved.
>
> Now that means you have to investigate some other problems. Supposing
> you're using postgres on a linux box, your database may be in
> /var/lib/pgsql/data. Is the pg_hba.conf file there correctly setup to
> allow connections from the webserver ?
>
> You need something like this (not recommended on production
> environments) :
>
> host    all     all     127.0.0.1       255.255.255.255 trust
> host    all     all     10.0.0.0                255.255.255.0   trust
>
> have you tried "psql gec_test bergeron.melanie" ? what is the output ?
>
> reading the tutorial there might just help, also :
> http://www.postgresql.org/docs/current/static/tutorial.html
>
>
>
> .
>



Re: problem to connect to database

От
Dave Cramer
Дата:
Melanie,

If you can't telnet into it, then the driver won't connect either.

If you use windows just run telnet with no args
a box will come up and you can enter the port, and host

it should connect and nothing else.

If it doesn't then it is a network problem

Dave
On Fri, 2004-01-16 at 13:13, Melanie Bergeron wrote:
> I added the line [host    all     all     10.0.0.0   255.255.255.0
> trust] in my pg_hba.conf (the other line was already there) but no results.
> I will take a look to the tutorial, maybe I will find my problem.  But I
> still can't figured out why it worked last week and not today.
>
> Thanks to all for your replies
>
> Melanie
>
> Erwan Arzur wrote:
>
> > Dave wanted you to check just that, but used a syntax that just
> > doesn't work on the platform you're using (did you see that it's
> > trying to resolve host:5432 ?). Telnet connects you to the TCP port
> > you specify on the command line, and 'man telnet' is your friend, by
> > the way ...
> >
> >
> > The output of netstat just means your server is started and listening
> > on port 5432, so that's one problem solved.
> >
> > Now that means you have to investigate some other problems. Supposing
> > you're using postgres on a linux box, your database may be in
> > /var/lib/pgsql/data. Is the pg_hba.conf file there correctly setup to
> > allow connections from the webserver ?
> >
> > You need something like this (not recommended on production
> > environments) :
> >
> > host    all     all     127.0.0.1       255.255.255.255 trust
> > host    all     all     10.0.0.0                255.255.255.0   trust
> >
> > have you tried "psql gec_test bergeron.melanie" ? what is the output ?
> >
> > reading the tutorial there might just help, also :
> > http://www.postgresql.org/docs/current/static/tutorial.html
> >
> >
> >
> > .
> >
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
--
Dave Cramer
519 939 0336
ICQ # 1467551


Re: problem to connect to database

От
Melanie Bergeron
Дата:
I can connect to it using telnet

Melanie
Dave Cramer wrote:

>Melanie,
>
>If you can't telnet into it, then the driver won't connect either.
>
>If you use windows just run telnet with no args
>a box will come up and you can enter the port, and host
>
>it should connect and nothing else.
>
>If it doesn't then it is a network problem
>
>Dave
>On Fri, 2004-01-16 at 13:13, Melanie Bergeron wrote:
>
>
>>I added the line [host    all     all     10.0.0.0   255.255.255.0
>>trust] in my pg_hba.conf (the other line was already there) but no results.
>>I will take a look to the tutorial, maybe I will find my problem.  But I
>>still can't figured out why it worked last week and not today.
>>
>>Thanks to all for your replies
>>
>>Melanie
>>
>>Erwan Arzur wrote:
>>
>>
>>
>>>Dave wanted you to check just that, but used a syntax that just
>>>doesn't work on the platform you're using (did you see that it's
>>>trying to resolve host:5432 ?). Telnet connects you to the TCP port
>>>you specify on the command line, and 'man telnet' is your friend, by
>>>the way ...
>>>
>>>
>>>The output of netstat just means your server is started and listening
>>>on port 5432, so that's one problem solved.
>>>
>>>Now that means you have to investigate some other problems. Supposing
>>>you're using postgres on a linux box, your database may be in
>>>/var/lib/pgsql/data. Is the pg_hba.conf file there correctly setup to
>>>allow connections from the webserver ?
>>>
>>>You need something like this (not recommended on production
>>>environments) :
>>>
>>>host    all     all     127.0.0.1       255.255.255.255 trust
>>>host    all     all     10.0.0.0                255.255.255.0   trust
>>>
>>>have you tried "psql gec_test bergeron.melanie" ? what is the output ?
>>>
>>>reading the tutorial there might just help, also :
>>>http://www.postgresql.org/docs/current/static/tutorial.html
>>>
>>>
>>>
>>>.
>>>
>>>
>>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 7: don't forget to increase your free space map settings
>>
>>
>>



Re: problem to connect to database

От
Erwan Arzur
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Melanie Bergeron wrote:
| I can connect to it using telnet
|
| Melanie

Hello Melanie,

maybe reading some material about TCP/IP and sockets will give you the
answer ... it's indeed not the place for that kind of topics :-) I can
bet your local network is not 10.0.0.0/24, thus blindly copying the
sample i provided to you (off the list, my fault)  won't help. Have you
just tried to find what was this file (pg_hba.cond) for, after all ?

Did you try the 'psql gec_test bergeron.melanie' as i suggested ? Any
error message from that command ?

good luck ...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFACFMhtchshDF9KNYRAqwMAJ9i6cqGA2749oW5bRYljAw3Mevj5wCXcm5m
f7JePCCiLfAvofoa/5n87Q==
=9E93
-----END PGP SIGNATURE-----


Re: problem to connect to database

От
Melanie Bergeron
Дата:
Erwan Arzur wrote:
Hello Melanie,

maybe reading some material about TCP/IP and sockets will give you the
answer ... it's indeed not the place for that kind of topics :-) I can
bet your local network is not 10.0.0.0/24, thus blindly copying the
sample i provided to you (off the list, my fault)  won't help. Have you
just tried to find what was this file (pg_hba.cond) for, after all ?

Did you try the 'psql gec_test bergeron.melanie' as i suggested ? Any
error message from that command ?

good luck ...
Yes, I try [psql gec_test bergeron.melanie] and all was ok. 
For pg_hba.conf file, I change it to :

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
local        all                    all                                                                          trust
host         all                    all               127.0.0.1              255.255.255.255   trust

Because I read it and realize that I was just copying the line you send me and it's not appropriate for me. 

In fact, I understand how TCP/IP sockets works but I checked so many things to find the source of this problem that I begin to think that the problem is in my face and I can't see it.  I will try to forget it  for the week-end and maybe I will have more results monday.


Dave Cramer wrote:
Melanie,

phone me

519 939 0336, I have an urgent call in 30 (14:30 EST) minutes so if you
can do it now, I'll take it

Dav

Thank you Dave for the offer but I don't want to disturb you with my problem. I just want to know if you had any ideas but it seems to be a problem rather not very common.

 Thank you all for replies!

Melanie

Re: problem to connect to database

От
Erwan Arzur
Дата:
Melanie Bergeron wrote:
> I can't use telnet.  If I try [telnet localhost:5432] it always return
> the same error message "Connecting To host:5432...Could not open a
> connection to host on port 23 : Connect failed" but if I do [netstat
> -an], it returns :
> ...
>  TCP    0.0.0.0:5432           0.0.0.0:0              LISTENING
> ...
>

Dave wanted you to check just that, but used a syntax that just doesn't
work on the platform you're using (did you see that it's trying to
resolve host:5432 ?). Telnet connects you to the TCP port you specify on
the command line, and 'man telnet' is your friend, by the way ...


The output of netstat just means your server is started and listening on
port 5432, so that's one problem solved.

Now that means you have to investigate some other problems. Supposing
you're using postgres on a linux box, your database may be in
/var/lib/pgsql/data. Is the pg_hba.conf file there correctly setup to
allow connections from the webserver ?

You need something like this (not recommended on production environments) :

host    all     all     127.0.0.1       255.255.255.255 trust
host    all     all     10.0.0.0                255.255.255.0   trust

have you tried "psql gec_test bergeron.melanie" ? what is the output ?

reading the tutorial there might just help, also :
http://www.postgresql.org/docs/current/static/tutorial.html



Re: problem to connect to database

От
Arne Stoelck
Дата:
Several things come to my mind:

- 10.0.0.0 is not a "host" address, it's a "net" address, so maybe you
    should put 10.0.0.1 instead

- did you check the logfile ? on my install it's inside the data
    directory, called postgres.log. if this isn't instructive
    enough, add more verbosity by changing the postgresql.conf
    file, and...

- make sure to restart the server

    Hope this helps,

        Arne Stölck

        http://www.stolck.com

On Fri, 16 Jan 2004, Melanie Bergeron wrote:

> I can connect to it using telnet
>
> Melanie
> Dave Cramer wrote:
>
> >Melanie,
> >
> >If you can't telnet into it, then the driver won't connect either.
> >
> >If you use windows just run telnet with no args
> >a box will come up and you can enter the port, and host
> >
> >it should connect and nothing else.
> >
> >If it doesn't then it is a network problem
> >
> >Dave
> >On Fri, 2004-01-16 at 13:13, Melanie Bergeron wrote:
> >
> >
> >>I added the line [host    all     all     10.0.0.0   255.255.255.0
> >>trust] in my pg_hba.conf (the other line was already there) but no results.
> >>I will take a look to the tutorial, maybe I will find my problem.  But I
> >>still can't figured out why it worked last week and not today.
> >>
> >>Thanks to all for your replies
> >>
> >>Melanie
> >>
> >>Erwan Arzur wrote:
> >>
> >>
> >>
> >>>Dave wanted you to check just that, but used a syntax that just
> >>>doesn't work on the platform you're using (did you see that it's
> >>>trying to resolve host:5432 ?). Telnet connects you to the TCP port
> >>>you specify on the command line, and 'man telnet' is your friend, by
> >>>the way ...
> >>>
> >>>
> >>>The output of netstat just means your server is started and listening
> >>>on port 5432, so that's one problem solved.
> >>>
> >>>Now that means you have to investigate some other problems. Supposing
> >>>you're using postgres on a linux box, your database may be in
> >>>/var/lib/pgsql/data. Is the pg_hba.conf file there correctly setup to
> >>>allow connections from the webserver ?
> >>>
> >>>You need something like this (not recommended on production
> >>>environments) :
> >>>
> >>>host    all     all     127.0.0.1       255.255.255.255 trust
> >>>host    all     all     10.0.0.0                255.255.255.0   trust
> >>>
> >>>have you tried "psql gec_test bergeron.melanie" ? what is the output ?
> >>>
> >>>reading the tutorial there might just help, also :
> >>>http://www.postgresql.org/docs/current/static/tutorial.html
> >>>
> >>>
> >>>
> >>>.
> >>>
> >>>
> >>>
> >>
> >>---------------------------(end of broadcast)---------------------------
> >>TIP 7: don't forget to increase your free space map settings
> >>
> >>
> >>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>