'{ CALL put_umc_domain_attr (?, ?, ?)}' Can't be parsed In CallableStatement

From: "fengyun" <fengyun(at)ceno(dot)cn>
To: <pgsql-jdbc(at)postgresql(dot)org>
Subject: '{ CALL put_umc_domain_attr (?, ?, ?)}' Can't be parsed In CallableStatement
Date: 2006-10-03 09:49:12
Message-ID: 003401c6e6d1$2ea44a30$6506a8c0@xtshao
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

HI ,

a.. JDBC driver build number : 407-503
a.. Server version : 8.1.4
a.. Exact error message and stacktrace
Caused by: org.postgresql.util.PSQLException: 不正确的函数或过程在偏移处2溢出。
at org.postgresql.jdbc2.AbstractJdbc2Statement.modifyJdbcCall(AbstractJdbc2Statement.java:2314)
at org.postgresql.jdbc2.AbstractJdbc2Statement.<init>(AbstractJdbc2Statement.java:136)
at org.postgresql.jdbc3.AbstractJdbc3Statement.<init>(AbstractJdbc3Statement.java:40)
at org.postgresql.jdbc3.Jdbc3Statement.<init>(Jdbc3Statement.java:30)
at org.postgresql.jdbc3.Jdbc3PreparedStatement.<init>(Jdbc3PreparedStatement.java:23)
at org.postgresql.jdbc3.Jdbc3CallableStatement.<init>(Jdbc3CallableStatement.java:20)
at org.postgresql.jdbc3.Jdbc3Connection.prepareCall(Jdbc3Connection.java:44)
at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareCall(AbstractJdbc3Connection.java:308)

a.. What you were doing, ideally in code form

The sql is '{ CALL put_umc_domain_attr (?, ?, ?)}'. Where I change the sql to '{ call put_umc_domain_attr (?, ?, ?)}', it will be okay.

Here is my code:
int id = getId(entityId);
CallableStatement cstmt = null;
Connection conn = getConnection();
try {
cstmt = conn.prepareCall(sqls[SQL_PUT_ATTRIBUTE]);
Iterator names = parameters.getNames();
while (names.hasNext()) {
String name = (String) names.next();
String value = parameters.getString(name);
cstmt.setInt(1, id);
cstmt.setString(2, name);
cstmt.setString(3, value);

cstmt.addBatch();
}

cstmt.executeBatch();
}
catch (SQLException e) {
throw new AttributeException("set_attribute", e.getMessage(), e);
}
finally {
Jeton.close(cstmt);
Jeton.close(conn);
}

I found the codes in class AbstractJdbc2Statement method modifyJdbcCall :

case 2: // After {, looking for ? or =, skipping whitespace
if (ch == '?')
{
outParmBeforeFunc = isFunction = true; // { ? = call ... } -- function with one out parameter
++i;
++state;
}
else if (ch == 'c') // I think here may be change to " ch == 'c' || ch == 'C'"
{ // { call ... } -- proc with no out parameters
state += 3; // Don't increase 'i'
}
else if (Character.isWhitespace(ch))
{
++i;
}
else
{
// "{ foo ...", doesn't make sense, complain.
syntaxError = true;
}
break;

Fengyun

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joost Kraaijeveld 2006-10-03 14:35:21 Using PostgreSQL as JBossMQ database anyone?
Previous Message Jan de Visser 2006-10-02 13:53:17 Re: XA end then join fix for WebLogic