Great thanks (JDBC). Another probem.

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

Great thanks (JDBC). Another probem.

От:
Mateusz Mazur <vincent@waw.pdi.net>
Дата:
Hello.

Thank you for your answer (really big thanks). But I have another problem.
I try to connect to my linux postgresql server and I have some error. I
have linux machine on my local network (e.g. 192.168.1.100), on this
machine I have postgresql 7.0.2. In my "pg_hba.conf" file is line like that:
host	all	0.0.0.0		0.0.0.0		password
so I think I could connect to psql from all network. I write Java class on
second computer (w2k) but in the same network (e.g. 192.168.1.101). The
code looks like that:

"
import java.sql.*;

class Javasql
{public static void main(String[] args){	try 	{	Class.forName("org.postgresql.Driver");			   		Connection db =
DriverManager.getConnection("jdbc:postgresql://192.168.1.100/menu","javaus",
"testpwd");	}
	catch(Exception e)	{		System.out.println("Exception !!!");	}	System.out.println("After Exception");}
}
"

where:
javaus – user in pg_shadow
menu – database
testpwd – correct password for javaus

Problem is that I can’t connect to server. Appear exception. Exception is
caused by getConnection() method not Class.for.Name(). I try also write
line like that 
DriverManager.getConnection("jdbc:postgresql://192.168.1.100:5432/menu","jav
aus”,"testpwd");
The same problem. Postgres looks fine, because he accept connection from
php script (localhost). I can't test Java localhost connection (ther is no
sDK or JVM on linux machine).

I don't know I do wrong.
If any one can help me. Please.

Mateusz.



FAQ