全部博文(186)
分类:
2012-11-13 15:15:26
原文地址:PostgreSQL简介 作者:txgc_wm
JDBC is an API for the Java programming language that defines how a
client may access a database. It provides methods for querying and updating
data in a database. JDBC is oriented towards relational databases.
From a technical point of view, the API is as a set of classes in the java.sql package.
To use JDBC with a particular database, we need a JDBC driver for that database.
PostgreSQL is a powerful, open source object-relational database system.
It is a multi-user, multi-threaded database management system.
It runs on multiple platforms including Linux, FreeBSD, Solaris,
Microsoft Windows and Mac OS X.
PostgreSQL is developed by the PostgreSQL Global Development Group.
We need to install postgresql package. We need to install the JDK, Java Development Kit, for compiling and running Java programs. Finally, we need the PostgreSQL Java driver. If we are using Netbeans IDE, than we have already the driver at hand. Inside the Projects tab, right click on the Libraries node and select Add Library option. From the list of options, select PostgreSQL JDBC Driver. Note that the driver may be older. Older driver may cause problems on newer PostgreSQL versions. In such a case, we can add the newest driver from by choosing add JAR/Folder and selecting a driver from the filesystem.
If we want to compile the examples from the command line, go
to the site
and download the latest PostgreSQL Java Driver.
Assuming, that we have put the driver jar file into the lib directory and using package zetcode, we compile and run the first example this way.