PreparedStatement addBatch()?

From: AgentM <agentm(at)cmu(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: PreparedStatement addBatch()?
Date: 2002-04-16 05:35:27
Message-ID: a05101506b8e161758e49@[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 right, doing something wrong, or is this a bug? Please CC me in
your reply- I'm not subscribed. Thanks.
--
><><><><><><><><><><><><
AgentM
agentm(at)cmu(dot)edu

Browse pgsql-jdbc by date

  From Date Subject
Next Message Laszlo Hornyak 2002-04-16 09:30:26 PL/JAVA
Previous Message Dave Cramer 2002-04-15 18:09:30 Re: getColumnName() Problems