Skip to Content.
Sympa Menu

freetds - prepared statement

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Nik Petroff" <nikolai.petroff AT qsipayments.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: prepared statement
  • Date: Mon, 22 Jan 2001 23:36:08 -0500


How come this works:

String sql = "exec TEST_select";
PreparedStatement st = cn.prepareStatement(sql);
st.executeQuery();

but this doesn't:

String sql = "exec TEST_insert(?)";
PreparedStatement st = cn.prepareStatement(sql);
st.setString(1, value);
st.executeUpdate();
?

error:
java.sql.SQLException: Line 1: Incorrect syntax near '@P1'.
at
com.internetcds.jdbc.tds.SqlMessage.toSQLException(SqlMessage.java:85)
at com.internetcds.jdbc.tds.Tds.submitProcedure(Tds.java:2437)
at
com.internetcds.jdbc.tds.PreparedStatement_base.submitProcedure(PreparedStatement_base.java:308)

at
com.internetcds.jdbc.tds.PreparedStatement_base.execute(PreparedStatement_base.java:173)

at
com.internetcds.jdbc.tds.PreparedStatement_base.executeUpdate(PreparedStatement_base.java:346)


My stored procedure TEST_insert works fine on its own and I don't know
what '@P1' is.

Nik



  • prepared statement, Nik Petroff, 01/22/2001

Archive powered by MHonArc 2.6.24.

Top of Page