Skip to Content.
Sympa Menu

freetds - syntax for jdbc callable statement with MSSQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Jonathan.Patton AT channelmaxinc.com
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: syntax for jdbc callable statement with MSSQL
  • Date: Fri, 30 Mar 2001 15:53:14 -0500


Hi,

I have been trying to use the jdbc callable statement with MSSQL and have not
gotten it to work.

I have the following stored procedure in sql server:

CREATE PROCEDURE estore_view_item_sizes

@item_id varchar(50)

AS

SELECT
*

FROM store_products_sizes INNER JOIN
store_products_sizes_lookup ON
store_products_sizes.item_size_id =
store_products_sizes_lookup.item_size_id

WHERE
store_products_sizes.item_id = @item_id;

and I am using the following code:

CallableStatement cs =
connection.prepareCall("estore_view_item_sizes ?");
cs.setString(1, item_id);
resultSet = cs.executeQuery();

where item_id is a String passed into my method. When the code runs I get:


----------------------------------------------------
java.lang.NullPointerException

at com.internetcds.jdbc.tds.Tds.executeProcedure(Tds.java:2594)

at
com.internetcds.jdbc.tds.PreparedStatement_base.executeCall(PreparedStatement_base.java:199)

at
com.internetcds.jdbc.tds.CallableStatement_base.execute(CallableStatement_base.java:394)

at
com.internetcds.jdbc.tds.PreparedStatement_base.executeQuery(PreparedStatement_base.java:320)

at DataConnect.createTableDataSPStringParameter(DataConnect.java:208)

Line 208 is resultSet = cs.executeQuery();

If I don't use the tds driver and try to use the jdbc:odbc driver I get:

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1:
Incorrect syntax near
'estore_view_item_sizes'.







Archive powered by MHonArc 2.6.24.

Top of Page