Connecting a Postgres Database from a Java application
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Connecting a Postgres Database from a Java application
How can I connect a Postgres Database from a Java application? Someone could help me describing a step-by-step set of instructions about how to do it? In my machine is installed Postgres 7.2.3 and JSDK 1.4.1
Distribution: WinXP SP2 and SP3, W2K Server, Ubuntu
Posts: 313
Rep:
Hello.
1. set up the postgresql.conf file to allow tcpip connections
2. set up the pg_hba.conf file to allow your network to connect
3. restart postgres with the "-i" option to allow intranet connection
4. follow instrctions the java obdc chapter at http://www.postgresql.org/docs/7.3/i...tive/jdbc.html
I would highly recommend NOT using ODBC in java, ever, ever, ever. It destroys the platform neutrality of JDBC, and this is, after all, a Linux forum. Just put the postgres JDBC driver on the classpath, and use standard JDBC calls.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.