QueryProvider.executeStatement fails...


2004-05-06 06:56:24 PM
jbuilder3
Why does the QueryProvider.executeStatement call not complete all it's insertions (typically I get about 80ish + I never get the finished message in the log) but the stmt.executeUpdate does?
Anyone got any ideas, is it a bug, have i missed something or am I being really dim?
Cheers
John
//-----------------
package com.dtint.jdbctest;
import java.sql.*;
import java.util.*;
import com.borland.dx.dataset.*;
import com.borland.dx.sql.dataset.*;
import com.sybase.jdbcx.*;
public class JDBCTest
{
public static String server = "";
public static String port = "";
public static String db = "";
public static String user = "";
public static String password = "";
public static void main(String args[])
{
if (args != null && args.length == 5)
{
server = args[0];
port = args[1];
db = args[2];
user = args[3];
password = args[4];
new JDBCTest().run();
}
}
public void run()
{
try
{
SybDriver driver = new com.sybase.jdbc2.jdbc.SybDriver();
DriverManager.registerDriver(driver);
DriverManager.setLogStream(System.out);
}
catch (Exception e)
{
System.err.println(e.getMessage());
}
try
{
System.out.println("Starting JDBCTest");
Properties p = new Properties();
p.put("PACKETSIZE", "2048");
p.put("applicationname", "JDBCTest");
String url = "jdbc:sybase:Tds:" + server + ":" + port + "/" + db;
ConnectionDescriptor dbConnection = new ConnectionDescriptor(url,user,password, false, "com.sybase.jdbc2.jdbc.SybDriver", p);
Database database = new Database();
database.setConnection(dbConnection);
ParameterRow procParams = new ParameterRow();
procParams.setColumns(new Column[]{new Column("theId", "", Variant.INT)});
procParams.setInt("theId", 1066);
int r = QueryProvider.executeStatement(database, "exec inserttest :theId", procParams);
System.out.println("Finished bad query:" + r);
CallableStatement stmt = database.getJdbcConnection().prepareCall("{call inserttest(?)}");
stmt.setInt(1, 42);
r = stmt.executeUpdate();
System.out.println("Finished good query:" + r);
}
catch (Exception ex)
{
System.err.println("SQLException: " + ex.getMessage());
}
}
}
/*
Sybase Stuff...
create table insertlog (whenrun datetime null, theid int null, whatdoing varchar(50) null, who varchar(50))
go
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'insertTest')
BEGIN
DROP PROCEDURE insertTest
PRINT '<<< DROPPED PROCEDURE insertTest>>>'
END
go
create proc insertTest(@theId int) as
BEGIN
insert insertlog (whenrun, theId, whatdoing, who) values (getdate(), @theId, "started", suser_name())
declare @i int
select @i = 0
while @i < 100
begin
insert insertlog (whenrun, theId, whatdoing, who) values (getdate(), @theId, "logging " + convert(varchar, @i), suser_name())
select @i = @i + 1
end
insert insertlog (whenrun, theId, whatdoing, who) values (getdate(), @theId, "finished", suser_name())
END
go
Grant Execute ON insertTest TO AdGroup
Grant Execute ON insertTest TO manager
go
*/