PreparedStatement addBatch()

From: AgentM <agentm(at)cmu(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PreparedStatement addBatch()
Date: 2002-04-16 17:32:33
Message-ID: a0510150fb8e210829557@[128.2.161.124]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I'm trying to use the addBatch method on PreparedStatement using
pgsql 7.2 and the equivalent driver. I'd like to use the
PreparedStatement addBatch method as described at
http://java.sun.com/products/jdk/1.2/docs/guide/jdbc/spec2/jdbc2.0.frame6.html
However, when I try to use it as such, I get
Exception in thread "main" java.lang.AbstractMethodError:
org.postgresql.jdbc1.PreparedStatement.addBatch()V
at X(X.java:294)
at Wrapper.main(Wrapper.java:24)
where X.java 294 is the
ps.addBatch();
call where ps is a PreparedStatement that has has been properly
initialized and variables entered. Following is some sample code
demonstrating the problem:

import java.sql.*;

public class pstest
{
public static void main(String[] args) throws
ClassNotFoundException, SQLException {
Class.forName("org.postgresql.Driver");
System.out.println("Driver loaded.");
Connection db =
DriverManager.getConnection("jdbc:postgresql:Dud","postgres","pass");
PreparedStatement ps=db.prepareStatement("INSERT INTO test
VALUES (?);");
//ps.clearBatch();
for(int i=0;i<37;i++)
{
ps.setInt(1,i);
ps.addBatch();
}
ps.executeBatch();
ps.close();
db.close();
}
}
The program dies on the ps.clearBatch() line if uncommented so I am
assuming that this JDBC functionality has simply not been written. Am
I doing something wrong or is this a bug? Thanks.
--
><><><><><><><><><><><><
AgentM
agentm(at)cmu(dot)edu

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-04-16 17:56:14 Re: PreparedStatement addBatch()
Previous Message Panu Outinen 2002-04-16 13:47:12 Re: Fixes for JDBC's getColumns() in Postgresql 7.2 &