I am writing a Java application that calls a stored procedure in SQL Server 2008. The stored procedure queries the PI database for a value and populates a table in SQL Server. I have installed PI OLEDB on the SQL Server machine. When I run the stored procedure directly from SQL Server Management Studio it runs fine (gets the PI value and populates a table). When I attempt to call the stored procedure from a Java application I get this error:
"Cannot start a transaction for OLE DB provider "%ls" for linked server "%ls""
Is it necessary to use the PI JDBC driver even if I am not returning row sets back to the Java Application?
Here is the code used in the stored proc to get the PI value:
SET @sql = N' SELECT @pival = (SELECT [value] FROM OPENQUERY (piserver,''SELECT TOP 1 value FROM piarchive..picomp2 WHERE tag = ''''SINUSOID'''' AND time >= ''''2010-07-30 10:33:28'''' ORDER BY time DESC''))'
SELECT @params = N'@pival numeric(18,4) OUTPUT'
EXEC sp_executesql @sql, @params, @pival = @pivalue OUTPUT
Thanks for your help.