sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
DN's Avatar

Question about connection java and Postgresql in Linux


Question posted by: DN (Guest) on November 11th, 2005 11:56 PM
I am trying to use Redhat Linux 9, J2sdk 1.4.2 and Postgresql 7.3.2 to
do my setting. But, I cannot access the database to set/get data
through the java program. Please help give me some suggestions.
Here is what my setting and problems:
http://hk.geocities.com/daisy_nhy/java_postgresql2.html

Thanks
3 Answers Posted
Paul Thomas's Avatar
Guest - n/a Posts
#2: Re: Question about connection java and Postgresql in Linux


On 20/09/2003 15:23 DN wrote:[color=blue]
> I am trying to use Redhat Linux 9, J2sdk 1.4.2 and Postgresql 7.3.2 to
> do my setting. But, I cannot access the database to set/get data
> through the java program. Please help give me some suggestions.
> Here is what my setting and problems:
> http://hk.geocities.com/daisy_nhy/java_postgresql2.html
>
> Thanks[/color]


The postgreSQL .jar file must go in common/lib _not_ share/lib. Two other
things:

1) have you enabled tcpip on the postmaster by seting

tcpip_socket = true

in /var/lib/pgsql/data/postgresql.conf

2) have you edited /var/lib/pgsql/data/pg_hba.conf to un-comment the line

# host all all 127.0.0.1 255.255.255.255 trust

because if you haven't done both of these, you won't be able to connect
from Java.

And before anybody jumps in, I'll just point out that the "host" line is
far too permissive to be used in production but if you're just starting
out experimenting with PostgreSQL and Java, it's one less thing to have to
worry about for now.

HTH

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


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

DN's Avatar
Guest - n/a Posts
#3: Re: Question about connection java and Postgresql in Linux

Thank you for answering my question

I have moved postgresql.jar to common/lib.

Also, my setting are:
tcpip_socket = true
in /var/lib/pgsql/data/postgresql.conf

host all all 127.0.0.1 255.255.255.255 crypt
in /var/lib/pgsql/data/pg_hba.conf

but, it also cannot work well.


By the way, do I need to set
./configure with-java

if yes, how can I set it?
Paul Thomas's Avatar
Guest - n/a Posts
#4: Re: Question about connection java and Postgresql in Linux


On 21/09/2003 09:30 DN wrote:[color=blue]
> Thank you for answering my question
>
> I have moved postgresql.jar to common/lib.
>
> Also, my setting are:
> tcpip_socket = true
> in /var/lib/pgsql/data/postgresql.conf
>
> host all all 127.0.0.1 255.255.255.255 crypt
> in /var/lib/pgsql/data/pg_hba.conf
>
> but, it also cannot work well.
>
>
> By the way, do I need to set
> ./configure with-java
>
> if yes, how can I set it?[/color]

../configure is used to build PostgreSQL from source. It doesn't affect any
of the run-time settings.

HTH

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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

 
Not the answer you were looking for? Post your question . . .
196,841 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,841 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors