Open main menu

CDOT Wiki β

Changes

PostgreSQL Adapter Project - Resources

1,923 bytes removed, 11:37, 24 November 2010
JDBC
:For the purposes of the examples from now on, this chapter will use the URL: jdbc:postgresql://localhost/booktown, meaning you are connecting to host localhost and database booktown. With that in mind, try to make a connection, using all you have learned so far. Example 12-2 shows a simple Java program that opens a JDBC connection to the booktown database. If you run the example yourself, be sure to replace the username and password with values that will work on your system.
 
:One issue is that JDBC does not do any client-side SQL parsing or syntax checking. SQL statements are passed off transparently to the database, whether or not they are valid. Therefore, if the SQL is valid on one vendor's database, but invalid on another vendor's database the implementation won't know until the actual connection is made and the SQL is sent across. Sun is attempting to deal with this problem, and there may be some provisions made to correct this, either in later versions of JDBC or in a different standard. Another issue is that each vendor has additional helper classes specific to that vendor. For instance, PostgreSQL has extensions for geometric data types. Other vendors won't support these extensions; they are specific to PostgreSQL. If you use such vendor-specific classes, your program will not work with another JDBC database, despite using the JDBC "standard."[http://www.commandprompt.com/ppbook/c20820]
: One advantage of the PostgreSQL JDBC driver is that it is a "Type 4" driver. This means that it is written in Pure Java, so it can be taken anywhere, and used anywhere as long as the platform it is used on has TCP/IP capabilities, because the driver only connects via TCP/IP.[http://www.commandprompt.com/ppbook/c20820]
:JDBC Driver 4 for PostgreSQL 9.This is the current version of the driver. Unless you have unusual requirements (running old applications or JVMs), this is the driver you should be using. It supports Postgresql 7.2 or newer and requires a 1.4 or newer JVM. It contains support for SSL and the javax.sql package. It comes in two flavors, JDBC3 and JDBC4. If you are using the 1.6 JVM, then you should use the JDBC4 version.
::JDBC3 Postgresql Driver, Version 9.0-801
::JDBC4 Postgresql Driver, Version 9.0-801 [http://jdbc.postgresql.org/download.html]
: Some info @ [http://wiki.postgresql.org/images/a/ac/Pg_8.1_J2EE_v1.0.pdf wiki.postgresql.org]
==PostgreSQL Specifications==
1
edit