How To Connect to PostgreSQL with a JDBC driver

FacebooktwittertumblrFacebooktwittertumblr
Postgres JDBC Java
Postgres JDBC Java

This is example will show you how to connect to PostgreSQL database via a JDBC driver.

First, download the PostgreSQL JDBC driver.

To run this code, your need to put "postgresql-{version}-bin.jar" in classpath.

JDBCPostgreSQLExample.java

To run this code, you have to put JDBCPostgreSQLExample.java in the same folder as the PostgreSQL JDBC driver. For example, you can put it in "c:\test," and then execute:

C:\test>java -cp c:\test\postgresql-8.3-603.jdbc4.jar;c:\test JDBCPostgreSQLExample.java

You should then see something like this:

FacebooktwittertumblrFacebooktwittertumblr

FacebooktwittertumblrFacebooktwittertumblr
Самоучители--узнать детальнее--