| ||||||||||||||||||
| ||||||||||||||||||
| ||||||||||||||||||
Using JDBC with PostgreSQLA very simple JDBC application for PostgreSQL can be found in the directory /opt/dbcourse/examples/jdbc/. Please see the file README.txt for instructions. If you want to experiment with the code, you should make a copy in your home directory ("cp -r /opt/dbcourse/examples/jdbc/ ~/"). Another JDBC application example would be ra (link). Its code is not documented well, but it contains some more advanced examples such as obtaining database metadata, and specifies connection properties using a properties file. The code resides in the directory /opt/dbcourse/software/ra-2.1b/. The example applications here illustrate how to make direct JDBC connections to a database. The JDBC driver and the connection URL might be database-specific, and the application must provide user name and password for remote connections. Hence, this connection method is not ideal in situations where you want to make your application independent from the particular database you are connecting to. A solution is to use a JNDI data source, which hides all database- and connection-specific details. An example of using data sources can be found in our notes on the Tomcat web application server (link). Here is quick link to the JDBC API documentation online. For information specific to the PostgreSQL JDBC driver, visit this link. General help on PostgreSQL can be found in our course's PostgreSQL notes (link). |
||||||||||||||||||
Last updated Wed Sep 11 10:18:08 EDT 2013 |