SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Other Forums
 MS Access
 ODBC--Connection to "databaseName" failed
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rum23
Yak Posting Veteran

77 Posts

Posted - 10/19/2008 :  17:31:38  Show Profile  Reply with Quote
I get the error "ODBC--Connection to 'databasename" failed". Error number is 3151. This error is in ACCESS 2007 and the tables are linked to SQL Server 2005 database tables. This error occurs randomly but it appears quite frequently. Basically, this happens if a series of queries are executed in MS access. Usually, the first query executes fine and while executing the 2nd one, it bombs. Its sporadic. Sometimes, the 1st and the 2nd queries execute just fine but bombs on the 3rd one. I did google on this and tried couple of resolutions but none of them worked. I have setup a odbc datasource for the database in SQL Server 2005. What could be causing this error? MS ACCESS 2007 and SQL Server 2005 are on one machine (locally on a developement machine). Please let me know if you need more details.

Your help is appreciated! Thanks!

rum23
Yak Posting Veteran

77 Posts

Posted - 10/19/2008 :  18:11:40  Show Profile  Reply with Quote

Anybody??? Please help
Go to Top of Page

AndrewMurphy
Flowing Fount of Yak Knowledge

Ireland
2915 Posts

Posted - 10/21/2008 :  06:05:57  Show Profile  Reply with Quote
I'd suspect a coding problem....maybe your variable holding for database connection string is being cleared/initialised/nullified. Can you embed some tracing statements into your code?
Go to Top of Page

rum23
Yak Posting Veteran

77 Posts

Posted - 10/21/2008 :  15:38:14  Show Profile  Reply with Quote

I have looked at this over and over again and I am reaching a dead end. Bascially I get this error when doing an OpenRecordset() method. In this one function, I do a series (about 10 or so) of OpenRecordset() calls to retrieve data from different tables. And sometimes, the method call fails, when doing a OpenRecordset() the 2nd time and sometimes it fails 4th time and sometimes it fails the 1st time. Its very inconsistent as to when the error bombs.

My db is set as follows

Set db = Currentdb
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)

The exact error message is "ODBC--connection to 'SQL ServerWINXP06' failed.". WINXP06 is my machine name. I have search the entire code to see if there are any loose ends, but found none.

Please help.
Go to Top of Page

smithersgs
Starting Member

17 Posts

Posted - 02/05/2009 :  15:03:01  Show Profile  Reply with Quote
I know it might be too late, but for someone out there who experieces the same issue.
In my case my Access database has some linked tables to SQL Server. One of them lost its connection somehow. I deleted it and relinked.
You can check if any linked table lost its connection by opening it.
Go to Top of Page

osupratt
Posting Yak Master

220 Posts

Posted - 02/11/2009 :  10:19:26  Show Profile  Reply with Quote
So when you say linked tables; when you go to the tables area can you double click on the tables in question and does the data show or does it give you an ODBC error?

Go to Top of Page

punkari
Starting Member

1 Posts

Posted - 08/14/2009 :  07:28:19  Show Profile  Reply with Quote
You might need to login to the linked table before using it. See http://support.microsoft.com/kb/245587.
Go to Top of Page

LeeG
Starting Member

1 Posts

Posted - 08/19/2010 :  17:53:51  Show Profile  Reply with Quote
Hey smithersgs, did you ever get this problem solved. I have the same problem.
Go to Top of Page

simone334
Starting Member

1 Posts

Posted - 03/01/2011 :  10:12:49  Show Profile  Reply with Quote
I have the same problem, Access query to linked sql2000 tables fails at fourth time that I launch it, I tryed to disable all possible timeout, firewall and antivir but nothing. thanks
Go to Top of Page

TSky
Starting Member

Japan
1 Posts

Posted - 04/25/2012 :  23:02:22  Show Profile  Reply with Quote
I got the same error whose number is 3151. In my case, when modifying former version of access file (*.mdb) with Access 2007, this error occurs randomly and could not create linktable via ODBC. After connection was established by hand, my code seems to go well for a while. When I tried same code in a new Access accdb file, no error occured in ten times trial.

I have abandoned to use the linktable and now am trying to copy data via ADO.

Thanks,
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000