Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Delay SP Prepare/Execute??

Posted on 2006-07-05
7
Medium Priority
?
383 Views
Last Modified: 2008-02-01
in reference to an original q...
http://www.experts-exchange.com/Web/WebDevSoftware/ColdFusion/Q_21869846.html

I believe i've tracked the issue down to a problem JDBC has with dynamic sql. if the driver runs into invalid sql as the stmt is being prepared (which it will) it throws an error.

My Q... (not even sure how to word this)

is there a way to delay/defer the sp to avoid the driver error. In my searching I've seen DB2 has a deferPrepare stmt which seems (?) to address this issue. Is there anything similar to this in T-sql?

any other ideas?
0
Comment
Question by:SidFishes
  • 4
  • 2
7 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17044868
SidFishes,
> s there a way to delay/defer the sp to avoid the driver error.

WAITFOR TIME '22:00'

0
 
LVL 27

Accepted Solution

by:
ptjcb earned 2000 total points
ID: 17045240
is there a way to delay/defer the sp to avoid the driver error.

No.

When SQL creates the stored procedure it validates the syntax. When the sql is executed then it creates a query plan and checks if everything is in place (tables are created, etc). TSQL does not have anything like deferPrepare in DB2 (DEFERPREPARE    Indicates whether preparation of dynamic SQL statements was deferred. Possible values are:   YES      Dynamic SQL statement preparation was deferred.  NO   Dynamic SQL statements were prepared immediately. ).
0
 
LVL 27

Expert Comment

by:ptjcb
ID: 17045245
if the driver runs into invalid sql as the stmt is being prepared (which it will) it throws an error.

Is there a way to catch the error? You may have to catch it at the jdbc level.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 27

Expert Comment

by:ptjcb
ID: 17045268
0
 
LVL 36

Author Comment

by:SidFishes
ID: 17045283
thx but that isn't exactly what I'm looking for... all that does is delay the error

what i need(?) is a way to create the entire sql stmt like

"the prepare request to the server is chained to the execute request and is sent in the same packet on the first request. This setting results in increased performance when executing prepared statements." (that's the DB2 explanation of deferPrepare)

my interest isn't in the "performance benefit" but the fact that done this way, the driver doesn't choke while the sql is being prepared before the actual execute.

hmmm... could I perhaps pass the sql string creation to a udf and then run the sql on the returned string??...might be an idea.

 
0
 
LVL 36

Author Comment

by:SidFishes
ID: 17045311
"thx but that isn't exactly what I'm looking for... all that does is delay the error " was for WAITFOR ...

ptjcb - that's what i was afraid of... any thoughts on whether the udf idea has a chance?
0
 
LVL 27

Expert Comment

by:ptjcb
ID: 17045449
A udf has its own limitations and you would run into scope issues that would frustrate more than help.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question