Unix Technical Forum

Re: Problem calling SP remotly

This is a discussion on Re: Problem calling SP remotly within the SQL Server forums, part of the Microsoft SQL Server category; --> trans53 (UseLinkToEmail@dbForumz.com) writes: > I have very interesting problem: > > Our java application(websphere server) calling stored procedure where ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 09:03 AM
Erland Sommarskog
 
Posts: n/a
Default Re: Problem calling SP remotly

trans53 (UseLinkToEmail@dbForumz.com) writes:
> I have very interesting problem:
>
> Our java application(websphere server) calling stored procedure where
> we can pass the paramater or not.When we pass the parameter we can see
> the result very fast,but when we pass NULL to the stored procedure
> nothing returns and we have to kill connection.I noticed in Profiler
> that when i kill connection immediatelly after we have RPC:Completed
> for the that stored procedure.
>
> The same stored procedure runs with no problem in Query Analizer and
> returns data in from 0 to 10 sec even if we pass parameter or not.
>
> what can be the problem in this situation? Thanks


My guess is that the procedure includes something like:

IF @param IS NULL
SELECT @param = getdate()

SQL Server builds the query plan using the input value of the parameter
as a guess. When you change the parameter, you lead SQL Server astray.
Try copying the input parameter to a local variable, and then use
that in the query instead. Since SQL Server does not know about the
value of local parameters, it will use a standard assumption.

The reason in works in QA but not Java, is that they have different
query plan. This is because in QA, ARITHABORT is ON by default, which
it's not likely to be from Java.

If this attempt to guesswork did not address the issue, then you need
to supply some more information. For instance, the procedure code...

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 09:04 AM
trans53
 
Posts: n/a
Default Re: Re: Problem calling SP remotly

"Erland Sommarskog2" wrote:
> trans53 (UseLinkToEmail@dbForumz.com) writes:
> > I have very interesting problem:
> >
> > Our java application(websphere server) calling stored

> procedure where
> > we can pass the paramater or not.When we pass the parameter

> we can see
> > the result very fast,but when we pass NULL to the stored

> procedure
> > nothing returns and we have to kill connection.I noticed in

> Profiler
> > that when i kill connection immediatelly after we have

> RPC:Completed
> > for the that stored procedure.
> >
> > The same stored procedure runs with no problem in Query

> Analizer and
> > returns data in from 0 to 10 sec even if we pass parameter

> or not.
> >
> > what can be the problem in this situation? Thanks

>
> My guess is that the procedure includes something like:
>
> IF @param IS NULL
> SELECT @param = getdate()
>
> SQL Server builds the query plan using the input value of the
> parameter
> as a guess. When you change the parameter, you lead SQL Server
> astray.
> Try copying the input parameter to a local variable, and then
> use
> that in the query instead. Since SQL Server does not know
> about the
> value of local parameters, it will use a standard assumption.
>
> The reason in works in QA but not Java, is that they have
> different
> query plan. This is because in QA, ARITHABORT is ON by
> default, which
> it's not likely to be from Java.
>
> If this attempt to guesswork did not address the issue, then
> you need
> to supply some more information. For instance, the procedure
> code...
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server SP3 at
> http://www.microsoft.com/sql/techinf...2000/books.asp


Erland,Thanks a lot for reply.

We modified the SP and will implement on monday.If we still have a
problem on monday i wil post a code for the SP.

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/General-Disc...ict232911.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=809314
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:10 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com