Solved

Delay SP Prepare/Execute??

Posted on 2006-07-05
7
374 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 500 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Join & Write a Comment

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now