YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

PI OLEDB and Java Options · View
ebelaski
#1 Posted : Tuesday, August 03, 2010 3:33:11 PM
Rank: Newbie
Groups: Member

Joined: 8/3/2010
Posts: 1
Location: Denver
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.

Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
y276827893
#2 Posted : Thursday, August 19, 2010 10:51:18 AM
Rank: Newbie
Groups: Member

Joined: 8/19/2010
Posts: 4
Location: china
Can you paste the whole procedure code?The problem may be not here.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.