FoxDataObjects

Object-Relational Mapping Tool for Visual FoxPro®

 ODBC_ConnectionHandler   Property

 

 

Contains the underlying Visual FoxPro ODBC connection handler used by the Session object.

 Session.ODBC_ConnectionHandler [=nHandler]

 

Property Values

 

Numeric

Remarks

  When the Session object connects to an ODBC datasource, it may expose the underlying ODBC connection handler in this property according to the DataSource.ODBC_ConnectionExposed property.

When the ODBC_ConnectionExposed property for the datasource object used to connect to the database is set to .T. , then, after connection, the ODBC handler number is exposed on the Session.ODBC_ConnectionHandler property. When the ODBC_ConnectionExposed property is set to .F. , the Session.ODBC_ConnectionHandler property always returns 0 (zero).

This property is useful if you need the ODBC handler for custom database access in your business objects and do not want to use the Session.GetData or  Session.SendData methods. The use of this property is discouraged for security reasons and because it may limit your code to work only with ODBC based datasources.

When the DataSource.ODBC_ConnectionHandlerSuppliedByClient is True (.T.), then Session.Connect skips the whole SQLSTRINGCONNECT process and uses the connection handler previously stored on this property.

 

Example

SET PROCEDURE TO fdo ADDITIVE

 

oServer=CREATEOBJECT("fdoServer")

oServer.ConnectedSessionsOnly=.F.

 

oDataSource=oServer.NewDataSource("MsSQLServer")

oDataSource.ODBC_ConnectionExposed=.T.

 

oSession=oServer.NewSession("MyMappingSchema.FDO")

 

IF oSession.Connect(oDataSource)

   ? "ODBC Handler",oSession.ODBC_ConnectionHandler

   oSession.Disconnect

ENDIF

 

This sample creates a DataSource object for Ms SQL Server, connects using default properties values  and shows the underlying ODBC connection handler number.
 

Example

SET PROCEDURE TO fdo ADDITIVE

 

oServer=CREATEOBJECT("fdoServer")

oServer.ConnectedSessionsOnly=.F.

 

oSession=oServer.NewSession("MyMappingSchema.FDO")

 

oDataSource=oServer.NewDataSource("MsSQLServer")

oDataSource.ODBC_ConnectionHandlerSuppliedByClient=.T.

 

oSession.ODBC_ConnectionHandler=nConn

IF oSession.Connect(oDataSource)

   ? "ODBC Handler",oSession.ODBC_ConnectionHandler

   oSession.Disconnect

ENDIF

 

This sample creates a DataSource object for Ms SQL Server, connects using an existing ODBC connection handler stored on nConn.
 

See Also

Server.NewSession method | Session.Connect method | fdoDataSource class

Applies to: Session object

Send feedback on this topic to RunAhead Technologies

For Technical support and product issues please contact us at support@foxdataobjects.com or visit http://www.foxdataobjects.com

Copyright (c) 2000-2005 RunAhead Technologies