pgsql数据库jdbc驱动

1)http://jdbc.postgresql.org/

2)

CREATE TABLE tl_test

(

id character varying NOT NULL,

"name" character varying,

CONSTRAINT tl_test_pkey PRIMARY KEY (id)

)

WITH (

OIDS=FALSE

);

ALTER TABLE tl_test OWNER TO "admin";

3)

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.ResultSet;

import java.sql.Statement;

public class Test {

public static void main(String[] args) {

try {

Class.forName("org.postgresql.Driver").newInstance();

Connection con = DriverManager.getConnection("jdbc:postgresql://127.0.0.1:5432/test", "admin", "admin");

Statement st = con.createStatement();

ResultSet rs = st.executeQuery("select * from tl_test limit 2 offset 1");

while (rs.next()) {

System.out.println(rs.getString(2));

}

st.close();

con.close();

} catch (Exception e) {

e.printStackTrace();

}

}

}

4)pgsql用户手册中文翻译

http://www.phpx.com/man/Pgsql/index.html

5)pgsql导出导入数据

备份:pg_dump dbname > outfile

恢复:psql dbname < infile

原创文章,转载请注明: 转载自海波无痕

本文链接地址: pgsql数据库jdbc驱动

文章的脚注信息由WordPress的wp-posturl插件自动生成

此条目发表在javaee分类目录,贴了, , , 标签。将固定链接加入收藏夹。