Sunday, March 25, 2012

connection problem

Hi

I want to connect a VB6 application to a sql express 2005 database. My database is on a server with windows 2003 server and my application is running on a windows XP machine. I try to use ado and almost all connection string i saw on internet, the best i got is the error:

connection failed

SQLState '01000'

SQL Server error: 53

SQL Server does not exist or access denied.

even if i use the same server name and authentification as in the microsoft sql server management studio express.

This is my code:

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection

cn.Properties("Prompt") = adPromptAlways
cn.Open "Driver={SQL Server};Server=server\sqlexpress;DataBase=master;"

thanks

Ben

Hi,

did you try to specify explictly the authentication mode ?

Trusted connection:

"Driver={SQL Server};Server=Aron1;Database=pubs;Trusted_Connection=yes;"

(From www.connectionstrings.com)

Otherwise you could also try to use the ADO connectionstring rather than the ODBC one.

Make sure that you configured remote connections for the Server to connect to.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

|||

thanks for your answer.

I try to run the same code on my server (that host the db)... and it work . So, my problem is with the remote part. My server and client machine are both on a lan, without a domain controler. I can manage my server throught my client computer using remote desktop so it's not a lan problem.

i try both Trusted_Connection and not .

I use that configuration in connection string : Server = [server_name]\sqlexpress

>Make sure that you configured remote connections for the Server to connect to.

I enabled all protocols in sql server 2005 Network configuration, something else to do ?

Thanks

|||

SQL Express has remote connections turned off by default; it sounds like you need to enable them. Check out the BLOG posting on this topic at http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx

Regards,

Mike Wachal - SQL Express team

|||

For those of you who want the complete solution :

Using Ado in VB6

The code :

Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Properties("Prompt") = adPromptAlways
cn.Open "Driver={SQL Server};Server=server\sqlexpress,2301;DataBase=master;uid=dbuser;password=pass;databasename=master;"

'2301 is the port number (TCP port, explain later)

Setting on server :

go to:

http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx?notification_id=1414271&message_id=1414271

and i do step 1, 2 OPTION A

You need to create (or use one that is already create) a user that has enought privilege on the table and database you want to use. Use SQL server management studio.

Now you can use that solution in your VB client program to acess remotely your database server.

Thanks a lot Mike and Jens ! and all SQL Express Team

|||for all fellow javascript, j#, c#, c++ programmers out there: remember vb "server\sqlexpress" = "server\\sqlexpress" in our languages!

No comments:

Post a Comment