java postgresql 数据类型_JAVA存取PostgreSQL二进制类型bytea

  • Post author:
  • Post category:java


经过测试:JAVA存取PostgreSQL的bytea类型均存在内存的限制问题(存取的数据过大会出现out of memory内存溢出的问题),在EnterpriseDB对此做了优化。

取PostgreSQL中的bytea,并存储到硬盘上.

/**

* @author Liu Yuanyuan

*/

private void getBytea

{

Connection conn = null;

Statement stmt = null;

ResultSet rs = null;

try

{

String driver = “org.postgresql.Driver”;

String url = “jdbc:postgresql://” + “127.0.0.1” + “:” + “5866” + “/” + “db1”;

Class.forName(driver);

System.out.println(“find class”);

conn = DriverManager.getConnection(url, “lyy”, “lyy”);

System.out.println(“connected”);

stmt = conn.createStatement();

String sql = “select obj from lyy.rawtable2 where id = 1”



版权声明:本文为weixin_36432875原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。