¿ ADO String Connection SQL Server ?

Post Reply
User avatar
albeiroval
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

¿ ADO String Connection SQL Server ?

Post by albeiroval »

Good day to all,

I'm using ADO to work with SQL Server 2008.

I'm trying to connect to SQL Server 2008 from a computer to the SQL Server 2008 server without success.

I work in local mode the following Connection string (it connect):

Provider = SQLNCLI10, Server = myServerAddress; Database = MyDatabase; Trusted_Connection = yes;

But in remote mode does not work (testing from another computer)

The connection to the SQL server as I have the windows authentication (default).

What string should I use for remote connection?

What should I configure SQL Server 2008 to Remote Connection I?

Sorry my english,

From already thank you very much,

Best regards.

Albeiro,
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: ¿ ADO String Connection SQL Server ?

Post by Enrico Maria Giordano »

Albeiro,

I'm using the connection string below but I'm not sure it will work with your MSSQL version. Just try it:

Code: Select all | Expand

Provider=SQLOLEDB;Data Source=<ipaddress>;Initial Catalog=<databasename>;User Id=<userid>;Password=<password>


EMG
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ¿ ADO String Connection SQL Server ?

Post by Rick Lipkin »

Albeiro

As Enrico mentions .. SqlOleDb still works even with Sql Server 2012 and SqlOleDb is native to all Windows OS... No real need at this point in time to install and use the SQLNCLI10 provider unless there is some function SqlOleDb does not provide.

I will mention, if you are having trouble connecting with 'remote' you will need to check your Sql Server settings to make sure 'remote' connections are turned on.

Rick Lipkin
User avatar
albeiroval
Posts: 383
Joined: Tue Oct 16, 2007 5:51 pm
Location: Barquisimeto - Venezuela

Re: ¿ ADO String Connection SQL Server ?

Post by albeiroval »

Enrico, Rick,

It seems to work well with:

Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

This SQL Express 20008,

Thanks,

Albeiro.
Saludos,
Regards,

Albeiro Valencia
www.avcsistemas.com
User avatar
Rick Lipkin
Posts: 2668
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ¿ ADO String Connection SQL Server ?

Post by Rick Lipkin »

Albeiro

Just remember .. if you distribute your application .. you will need to provide a setup routine to make sure each computer that runs your program has the SQLNCLI10 ole provider installed.

Rick Lipkin
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: ¿ ADO String Connection SQL Server ?

Post by nageswaragunupudi »

As Mr Rick said, SQLOLEDB is installed by default on all windows PCs and works well with all recent versions of SqlServer (including 2012).

If we want to connect through the native client SQLNCLI10, then we need to install this ourselves on all client PCs. For most work this is not necessary and SQLOLEDB is enough, unless we need to take advantage of all the latest features and new datatypes of the later versions.

Using Driver={SQL Server Native Client 10.0} connects through ODBC and does not allow us to take full potential of ADO. Always use Provider= .....
Regards

G. N. Rao.
Hyderabad, India
byron.hopp
Posts: 388
Joined: Sun Nov 06, 2005 3:55 pm
Location: Southern California, USA
Contact:

Re: ¿ ADO String Connection SQL Server ?

Post by byron.hopp »

You all my know this but:

Create a file on the hard drive with an extension of .udl

From the command prompt:
Type "copy con MyConStr.udl"
Press F6 to create the empty file
Type "Start MyConnStr.udl"
The UDL data wizard appears.
Answer the questions and press the test button to make sure it works, the connection string will be placed in the file.
Open the file with Notepad and pirate it into your code.

Hope this helps...

Byron ...
Thanks,
Byron Hopp
Matrix Computer Services
Post Reply