Enterprise Java for Linux HOWTO
Note: To use JDBC, PostgreSQL needs to have been started with the -i parameter indicating support for
TCP/IP connections rather than solely UNIX domain sockets. Confirm that postmaster> was started with the
-i paramter.
Create a test database by typing:
su - postgres
createdb javatest
You should see no error messages.
Create a test table with one test row. First, log in to the interactive PostgreSQL tool and connect to the
javatest database you just created by typing (as the postgres user):
psql javatest
You should see confirmation that you are connected to the database: javatest.
Then, create the test table by typing (within psql):
create table test (col1 varchar(255));
You should see the "CREATE" confirmation message.
Next, insert one row by typing (within psql):
insert into test (col1) values ( Hello, from PostgreSQL! );
You should see the "INSERT" confirmation message.
Finally, confirm that the row is there by typing (within psql):
select col1 from test;
You should see the row you just created.
You can exit psql by typing "\ q".
For more assistance on working with PostgreSQL, I suggest you look into the Database-SQL-RDBMS
HOW-TO document for Linux (PostgreSQL Object Relational Database System) at
http://metalab.unc.edu/mdw/HOWTO/PostgreSQL-HOWTO.html
.
You will need to add the appropriate JAR to your CLASSPATH. The PostgreSQL JARs come in the
postgresql-jdbc
package.
export CLASSPATH=$CLASSPATH:/usr/lib/pgsql/jdbc6.5-1.2.jar
You may need to substitute the path depending you where PostgreSQL is installed on your system.
6.4 Oracle
22
footer
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved