Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLEXEC and Shared Connection Problems
Message
 
 
To
11/11/2004 13:57:51
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP SP1
Database:
MS SQL Server
Miscellaneous
Thread ID:
00960314
Message ID:
00960718
Views:
13
Hi Aleksey ,

Thanks for the reply and the explanation that the 'AllowSimultaneousFetch' property will allow 2 remote views using a shared connection to download rows simultaneously.

This is a nice feature and will cut down on those pesky 'connection is busy' messages.

Could you just explain one more thing to me ?

If I have two remote views using a named shared connection within a dbc and I set the 'AllowSimultaneousFetch' property to True. I can see that when these two views are requerying that they both download simultaneouisly and don't raise 'connection busy' type errors.

Here's the problem : -

If I have a piece of SQL Pass Through and I want it to use the same shared connection as previously set up in my DBC then I should be able to use the SQLCONNECT function to get a statement handle.

Here's my connection statement in the DBC.
CREATE CONNECTION "MyDataBaseConn" CONNSTRING 'driver=SQL SERVER;server=(local);uid=USER1;pwd=PASSWORD1;database=MyDataBase'
Then I should be able to get a shared statement handle to this connection by doing the following :
lnStatementHandle = SQLCONNECT(MyDataBaseConn','USER1','PASSWORD1',.T.)
but if I try to do this I always get connection is busy messages even if I do this whilst no data is being requeryed etc.

Am I misunderstanding how the SQLCONNECT function works in this case?

Here's my test program that shows the problem :-

Many Thanks for the help, Bernard.
CLEAR
CLOSE DATABASES ALL
DELETE DATABASE REMOTE
CREATE DATABASE REMOTE
CREATE CONNECTION "MyDataBaseConn" CONNSTRING 'driver=SQL SERVER;server=(local);uid=USER1;pwd=PASSWORD1;database=MyDataBase'

CREATE SQL VIEW Test REMOTE CONNECTION MyDataBaseConn SHARE AS SELECT * FROM SOMELARGETABLE

DBSETPROP('Test','view', 'AllowSimultaneousFetch',.T.)
DBSETPROP('Test','view', 'fetchasneeded', .F.)
DBSETPROP('Test','view', 'fetchsize', 100)
DBSETPROP('Test', 'View','ShareConnection', .T.)

******** Open The First View *********
USE test NODATA

* Problem Arises Here, I always get a "connection is busy message"
* Even though I'm checking to see if the connection is free via a SQLGETPROP('ConnectBusy') Call

IF NOT SQLGETPROP(CURSORGETPROP('ConnectHandle','Test'), "ConnectBusy")
   lnSQLPassThroughHandle = SQLCONNECT('MyDataBaseConn','USER1','PASSWORD1',.T.)
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform