VB & SQL Server

Posted on 1998-09-19
Last Modified: 2012-05-04
Hi folks,

   I'm trying to use ODBC to connect to my SQL Server but I'm getting error messages from the ODBC driver.

   I have 6 PCs in the development environment.  Out of these, 2 can run without any problems.  The other 4 have problems connecting to the server.

   1.  Cannot connect to server.  These PCs initially couldn't and we resorted to upgrading the SQL Server ODBC driver to version 3.5++ and it worked after that but yesterday we couldn't connect again.  I doubt its the driver because the two PCs that are working fine are using older versions of the driver (version 2.65++).  The error message for this situation is:

     Connection failed:
     SQL Server Error: 5
     [Microsoft][ODBC SQL Server Driver][dbnmpntw]ConnectionOpen (CreateFile())
     Connection failed:
     SQL Server Error: 2
     [Microsoft][ODBC SQL Server Driver][dbnmpntw]Access Denied.

    2. Specified SQL Server Not Found.  This PC was not upgraded at all (The ODBC Driver)  It is identical with one of the PCs that's running fine in terms of ODBC setup.  The SQL Server ODBC driver version is identical to the two PCs that's running fine.

    However, when we run the application, the SQL Server Login window will appear requesting for User and Password although it has been included as parameters in the OpenConnection statement.  (I assume it's because it assumes that our password is incorrect, although it is correct).  When I re-enter the items requested, I will get the following message:

     Connection failed:
     SQL Server Error: 53
     [Microsoft][ODBC SQL Server Driver][DBNMPNTW]ConnectionOpen (CreateFile())
     Connection failed:
     SQL Server Error: 6
     [Microsoft][ODBC SQL Server Driver][DBNMPNTW]Specified SQL server not found

     All the PCs have the same configuration in terms of ODBC so I can't figure out why I'm getting different result on different terminals.  

     I've tried everything I can think of and I still can't come up with anything.  Any suggestions would be deeply appreciated.  Please help me.

     Thanks in advance.

Question by:palim
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 1435624
1.  One thing i had with SQL server was with other program running on the PC, on some it work well and on other it didn't work.  

Ex.: Anti-virus software on some PC we cold not connect to sql or it was very long to get the connection.  try to take out everything from memory make a clean boot to see if that's not part of the problem.

2.  What kind of security are you using on SQL.  verify that every body has acces to the SQL.

3.  Try to install the client software on the PC to see if you can see the SQL server with those tools, it might be only the network protocol your using.

try those and let me know the result

Expert Comment

ID: 1435625
Hello Palim,

You should still get the latest ODBC/MDAC drivers from MSDN.  They have them for each OS (95/98, NTw, NTs.)  Use version MDACv2.0 as the asynchronous queries don't leak memory any more!

[ ]

After running the setups, email me back at and we'll step thru the diagnostics required for the connection.  I agree with dabellei that you should check the permissions under SQL Server for the login used.  Also try running matching queries from iSQL/w as the ODBC connection will be exercised as opposed to in Enterprise Manager.  You will see great differences/improvements in the dialogs for the ODBC Administrator32.  Here we will test everything and KNOW what the issue(s) is/are.


Author Comment

ID: 1435626
Hi dabellei,

     Firstly, thanks for your suggestion.  I've tried removing the anti virus but it's still giving me the same problem.  With regard to the security, the user that I'm using to access SQL does exist.  Initially, I even used the sa ID to access the database through ODBC from the client but it still doesn't work.

   I've actually assigned the table to the user as well and it's still the same.  As for connection type, I'm using the SQL Server authentication type.  For the User Name & Password, I'm using one that already exists in the SQL Server with the rights assigned to the particular DB.  

  The particular user does not have access to master, tempdb and the other system databases...  I tried giving the user access to these tables but it doesn't help.

  I've also tried installing the SQL Client software and it still gives me the same problem.

  Any other possibilities??

                Puay Aun
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now


Expert Comment

ID: 1435627
Are you using a trial version of SqlServer? If you are, probably you have a maximum number of licences using at same time.

Author Comment

ID: 1435628
Nope!  It's a licensed version and I actually tried increasing the license but it still hit the problem!

Expert Comment

ID: 1435629
I developed an application on VB 5 and while deploying it found the same problem you are facing. I did the following to get over it.

Installed the ODBC from VB diskettes on the machines. It solved the problems on most m/c however two m/c still were giving the problem. To rectify the problem I went to there Network Neighbourhood and checked if the user could actually see the server physically. one could and one could not. However both did not have permission to work on the server. I got in touch with the network guys got them to change the permission. Everybody is fine now.

To find out if they can see the server share a directory on the SQL Server m/c and check if the user can access it.

Hope this help.

Author Comment

ID: 1435630
Hi Manish77,

    Yeah they can see the machine.  So I don't think it was the access problem.

    Anyway, from what a few people were telling me about the protocol, I decided to take a look.  I decided to run the setup to see if there was anything I could change and found the protocol setting where you decide which ones you want to include but almost all of them were included except Banyan Vines, AppleTalk and Multi Protocol.

   Anyway, I didn't change it but after that one of the PCs that was working could not connect any more.  I took a look at it, took a shot and changed the default protocol to TCP/IP from Named Pipes and it's now working.  All the other PCs are also working now and they're running TCP/IP.  

   The thing is, I didn't change a thing on the server and one of the PCs that weren't working yesterday with TCP/IP is working now.

   Anyway, thanks for all your help and suggestions the past few days.

Accepted Solution

yerffoeg earned 50 total points
ID: 1435631
Have you tried changing the network library in SQL Client Configuration?
We have found that different network libraries perform better on different machines, don't know why.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question