SQL Connection Issues

Hello mates,

I am extremely puzzled at what is going on with our SQL Server.

We set up an ODBC data source to connect on our SQL2000 server to point to another SQL2000 server in a remote location. This has worked now for the last 3 years until the SQL Server that the ODBC was pointing to was upgrated from SQL2000 to SQL2005.

Suddenly, the connection is broken.

I went to the ODBC data source and tested the connection and it says, "Connection was successful".

However, when I tested my code, I still get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

What could be wrong here!

Just to be sure I have covered all bases, here is the line on my code that is throwing this error:

Conn.open session("riff01")

riff01 is the dsn name.

Any help would be greatly appreciated.
LVL 29
Who is Participating?
BadotzConnect With a Mentor Commented:
>>nothing changed except IP Address

Despite their "best efforts", this is a lie. Otherwise you would not have a problem.

When I worked in the IT department of a Large Firm, we had a haiku:

We hate computers,
We hate computer users.
Can you feel the love?

This always lifted my spirits just by reading it ;-)
This has helped me with connection strings in the past:

 1. In Notepad, or any other text editor, create a file named Temp.udl  

 2. Leave the file empty and save it to the Desktop

 3. Double-click the Temp.udl file

 4. The Data Link Properties dialog box appears

 5. In the Data Link Properties dialog box, click Provider. Select the appropriate provider from the list

 6. Click Connection and select the corresponding name of the server and the database
    Type the User Name and the Password
 7. Click Test Connection to test the connection

 8. Click OK

 9. Right-click Temp.udl and click 'Open With'
    If Notepad shows up as an option, click it, otherwise click 'Choose Program' and navigate
    through the list to notepad and select it

10. Copy the connection string to your application

sammySeltzerAuthor Commented:
Thanks for your prompt response.

I have used that before too but in this case, I am using dsn name.

can I still use the udl to create dsn name?

I can't seem to have a GO on that.
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

sammySeltzerAuthor Commented:
I take that back. I was able to test the udl using dsn name and it said connection succeeded.

I might add as well that when I ran a query in query analyzer trying to connect to the db on the remote server, it worked just fine.

So, the issue appears to be something else that I can't seem to figure out.
I received the dreaded "80004005" error on a connection string. By placing "ODBC;" at the front of the connection string, the error went away and everything was OK. You might give that a shot (since the lights are still out and we're firing at will ;-)
sammySeltzerAuthor Commented:
Just to be sure, you said I should put it like the example below?

ODBC Conn.open session("riff01")  no?
No, in my case it was

conn_string = "ODBC;DSN=MY_DSN;DBQ=C:\DE\FGHIJK\LMNOP\QRS;NullStrings=0;SERVER=NotTheServer"
sammySeltzerAuthor Commented:
Hi Badotz,

Unless I am doing something wrong, this is what I have:

         Conn.Open = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=myusername;PWD=mypassword; Initial Catalog=POlintral;Data Source=PRITRAL"

and it keeps telling me that the server (data source) not found, to add sp_addlinkedserver. This is already added. Infact when I tried doing it again, it told me that it is already added.

Yet, when I test it with the udl, it says, "connection succeeded".

I am very, very confused right now and everyone is screeming at me.


Maybe you can help me include the Network zone into this posting. It is beginning to look more like a network issue.
Try this:

Conn.Open = "ODBC;Provider=SQLOLEDB.1;Persist Security Info=False;User ID=myusername;PWD=mypassword; Initial Catalog=POlintral;Data Source=PRITRAL"
sammySeltzerAuthor Commented:
It says data source name not found. I know the data source name is correct.
Then something somewhere else is wrong (obviously, DUH Badotz).

Did you check with the manufacturer to verify their driver that worked in SQL 2000 server also works in SQL2005 server?
sammySeltzerAuthor Commented:
Did you check with the manufacturer to verify their driver that worked in SQL 2000 server also works in SQL2005 server?
hmmm, good question!

The manufacturer will be Microsoft?

They own the server and the sql server db (both 2000 and 2005).

The app was developed by us in house and we used odbc to create the dsn.

I am even more confused now, LOL
Sorry, I'm famous for stating the obvious ;-)

But as with any app, incompatabilities abound. It is possible that some naming convention changed between versions?

Wish I could be of more help...
sammySeltzerAuthor Commented:
You have been extremely, extremely helpful and I am truly grateful.

When I laughed out loud, it was more out of frustrations.

Please don't take it the wrong. I am truly grateful for your patience and continued assistance.
No worries!
sammySeltzerAuthor Commented:
My biggest worry is that a week or so ago, our networks team relocated the server and changed the IP Address. However, the servername remained the same.

The problem may have started then but we didn't catch it till yesterday.

Now, all they keep telling me is that nothing changed except IP Address but obviously something else changed.

As I stated earlier, If I copy a code and run in in the server from SQL Analyzer, it returns the result fine.

If however, I run from the browser with my asp code, I run into the issues we have been trying to resolve and I have been struggling with this issue since yesterday.

Thanks again for all your help.
sammySeltzerAuthor Commented:
Thanks many times.

I can't ask from you anymore than you have given me.

Thanks again
sammySeltzerAuthor Commented:
I will close this and try the network zone. they may know a few tricks to share.
Thanks. Good luck!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.