jdbc 连接 Postgresql 8.4

2009年07月30日 JAVA 暂无评论

以前用JAVA在做数据库连接的时候还没试过用Postgresql  由于JDBC简便性,使得连接各种数据库也方便,只需设置几个参数。

用JDBC操作要先下载驱动包

To determine JDK/JVM compatibility this following list matches up versions of the JVM with the JDBC specification implemented.

  • JDK 1.1 - JDBC 1. Note that with the 8.0 release JDBC 1 support has been removed, so look to update your JDK when you update your server.
  • JDK 1.2, 1.3 - JDBC 2.
  • JDK 1.3 + J2EE - JDBC 2 EE. This contains additional support for javax.sql classes.
  • JDK 1.4, 1.5 - JDBC 3. This contains support for SSL and javax.sql, but does not require J2EE as it has been added to the J2SE release.
  • JDK 1.6 - JDBC4. Support for JDBC4 methods is limited. The driver builds, but the majority of new methods are stubbed out.

如果项目采用JDK1.5 那就要下载JDBC3的驱动

下载地址如下

http://jdbc.postgresql.org/download.html

 

JDBC连接参数如下

String dbDriver = "org.postgresql.Driver";

String url = "jdbc:postgresql://localhost:5432/dxcom";

String userName="postgres";

String password="123456";

 

我下的版本是   Postgresql版本 8.4   postgresql-8.4.0-1-windows.exe

下载地址:http://www.postgresql.org/download/

我们从官方可以看到  Postgresql支持各种平台

Downloads

PostgreSQL Core Distribution

The core of the PostgreSQL object-relational database management system is available in several source and binary formats. The full package includes:

  • The core server with full documentation (html, man)
  • Several command line tools (e.g. psql, pg_ctl, pg_dump, pg_restore)
  • C library (libpq) and embedded C processor (ecpg)
  • Several server-side procedural languages (e.g. plpgsql, pltcl, plperl)
  • Several popular add-on packages (e.g. metaphone, pgcrypto and other useful enhancements)

In addition, some 'one click' installers include additional packages such as pgAdmin and PostGIS.

Binary packages

Pre-built binary packages are available for a number of different operating systems:

给我留言