From: | "Apichart Asavarojpanich" <apicharta(at)hotmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Need help on connect to postgresql |
Date: | 2002-09-05 08:16:01 |
Message-ID: | F103PrPrvCWO6hm8Ua800000073@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi!
I'm try to use java to connect to PostgreSQL7.2.1 by using JDBC driver
(pgjdbc2.jar). I add up this line on pg_hba.conf under data directory as
the following.
"host all 172.16.1.0 255.255.255.0 password userpasswds"
and create userpasswds file by using pg_password
My client machine IP is 172.16.1.100 and I can use pgaccess to connect to my
database without any problem but I cannot connect to database by using java
code. This is the part that generating an error when debugging.
"line 1 Class.forName("org.postgresql.Driver");
line 2 System.out.println("Driver registered");
line 3 Connection conn = DriverManager.getConnection(url, logname, passwd);
line 4 System.out.println("Database connected"); "
After line 2 it create this errors.
"Driver registered
Something unusual has occured to cause the driver to fail. Please report
this exception: Exception: java.security.AccessControlException: access
denied (java.net.SocketPermission Ldna resolve)
Stack Trace:
java.security.AccessControlException: access denied
(java.net.SocketPermission Ldna resolve)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
at
java.security.AccessController.checkPermission(AccessController.java:401)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:542)
at java.lang.SecurityManager.checkConnect(SecurityManager.java:1042)
at java.net.InetAddress.getAllByName0(InetAddress.java:909)
at java.net.InetAddress.getAllByName0(InetAddress.java:890)
at java.net.InetAddress.getAllByName(InetAddress.java:884)
at java.net.InetAddress.getByName(InetAddress.java:814)
at java.net.InetSocketAddress.<init>(InetSocketAddress.java:109)
at java.net.Socket.<init>(Socket.java:118)
at org.postgresql.PG_Stream.<init>(PG_Stream.java:41)
at org.postgresql.Connection.openConnection(Connection.java:134)
at org.postgresql.Driver.connect(Driver.java:149)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at rmidemo.StudentImpl.initializeDB(StudentImpl.java:28)
at rmidemo.StudentImpl.<init>(StudentImpl.java:12)
at rmidemo.StudentServer.main(StudentServer.java:12)
End of Stack Trace"
It looks like that an access denied occurs but I use the same username and
password to access Postgresql when using pgaccess or pgadmin on the same
client machine. Both are fine without any problem. Please give me any clue
to fine the reason.
Please help
Thanks in advance
Chart
my email is "apicharta(at)hotmail(dot)com"
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksei Valikov | 2002-09-05 12:47:29 | Statement.getGeneratedKeys() questions |
Previous Message | Floyd Shackelford | 2002-09-04 17:35:35 | Re: ResultSetMetaData.getColumnClassName() patch not in latest |