Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSN versus DSN-Less 2

Status
Not open for further replies.

sheykc

Programmer
Sep 28, 2001
79
0
0
US
Does anybody know the pros and cons of using a DSN versus a DSN-less connection, when working with ADO in Visual Basic?
 
A DSN-less connection is considered to be the preferred method because it is a faster and more efficient way to access the data source. If you use a DSN you must go through the additional ODBC layer in order to access the data store. If you use OLEDB then you are eliminating this layer. Since the connection absorbs a lot of resources, go with the faster method.

'For SQL Server
Dim objConn as ADODB.Connection
Form_Load()
Set objConn = New ADODB.Connection
objConn.Open "Provider = SQLOLEDB; Integrated Security = SSPI; Persist Security Info = False; Initial Catalog = databasename; Data Source = SQLServername"

'For Access
objConn.Open = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = databasefullpath"
 
Do you know if
Code:
SQLOLEDB
will work with Sybase?

Shey
 
SQLOLEDB is specific to SQL Server. I'm sure there is an OLEDB provider for Sybase. To find out if you have a Sybase OLEDB, open a VB project and then Add a Data Environment from the Project Menu. Then right-click the connection and then select properties. All of the OLEDB providers will be listed.
 
Thanks for your help.

I have one more question though. I went to VB, added the Data Environment, etc---and I don't see an OLEDB for Sybase. However, I noticed the OLEDB for ODBC drivers. Is this the same thing as creating an ODBC connection? Will I still be going through the ODBC layer?

Shey
 
I am using "SQL Anywhere Studio 8"(Sybase) and the ODBC driver I used is "Adaptive Server Anywhere 8" and if you are using the connectionstring the provider would be "ASAProv".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top