To
Http://wwwmaster.postgresql.org/download/mirrors-ftp? File?binary=2fv8.1.4%2fwin32%2f%sql-8.1.4-1.zip
Select a country with fast download speeds to download the PostgreSQL database
To
Http://jdbc.postgresql.org/download.html download JDBC driver
Install PostgreSQL and create tables
-- Table: testtable
-- Drop table testtable;
Create Table testtable
(
Id bigserial not null,
Name varchar (30 ),
Constraint testtable_pkey primary key (ID)
)
Without oids;
Alter table testtable owner to ipvs;
Create sequence testtable_id_seq
Increment 1
Minvalue 1
Max value 9223372036854775807
Start 3
Cache 1;
Alter table testtable_id_seq owner to ipvs;
Connection test...
Package com. test;
Import org. PostgreSQL .*;
Import java. SQL .*;
Public class testdb {
Public testdb (){
}
Public static void main (string ARGs [])
{
System. Out. Print ("this is a test ");
Try
{
Class. forname ("org. PostgreSQL. Driver"). newinstance ();
String url = "JDBC: PostgreSQL: // localhost: 5432/Postgres ";
Connection con = drivermanager. getconnection (URL, "s", "1234 ");
Statement ST = con. createstatement ();
String SQL = "select * From testtable ";
Resultset rs = st.exe cutequery (SQL );
While (Rs. Next ())
{
System. Out. Print (Rs. getint (1 ));
System. Out. println (Rs. getstring (2 ));
}
Rs. Close ();
St. Close ();
Con. Close ();
}
Catch (exception ee)
{
System. Out. Print (EE. getmessage ());
}
}
}