I am new here so please excuse me if I have posted anything wrong or in any wrong place. I am getting below error when trying to retrieve data using LINQ from data file like mdf, accdb, mdb but if I am using ADO .Net I can retrieve data with any problem.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I checked my SQL Browser service and its up and running to make sure if there is no problem of firewall and other issue I also made use of PortQry and it also turn out to be ok.
Please anyone have solution for the same.
This is about connection between your application with SQL Server. Make sure all name, profile, authority has been set properly. You can localize the problem for example you can turn off your firewall, set the servername on your application, and others.
You may also contact your database administrator. You may also look at SQL Server manager and try to enable some of parameter on it, for example enable one by one all protocols, and do not forget to restart your server any time you change these parameters.
This is about connection between your application with SQL Server. Make sure all name, profile, authority has been set properly. You can localize the problem for example you can turn off your firewall, set the servername on your application, and others.
You may also contact your database administrator. You may also look at SQL Server manager and try to enable some of parameter on it, for example enable one by one all protocols, and do not forget to restart your server any time you change these parameters.
Hope this can help
Well I am newbiee as I am learning LINQ so I am trying it on my own pc and its giving me this error. I am getting this error while I am using .accdb or .mdb file as datasource.
And I am getting error saying
"The database 'D:\DATA\NIKHIL.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database 'D:\DATA\NIKHIL.MDF'. CREATE DATABASE is aborted. An attempt to attach
an auto-named database for file D:\Data\Nikhil.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
when I use .mdf(detaching the database in sql and then saving in other location) as my datasource
You can't detach an .mdf and use it as a datasource. It has to attached to the database engine.
ReAttach the database to the engine and recreate your linqtosql entity object.
If I keep it attach it gives me this error
Unable to open the physical file "D:\DATA\Nikhil.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". An attempt to attach an auto-named database for file D:\DATA\Nikhil.mdf failed. A database
with the same name exists, or specified file cannot be opened, or it is located on UNC share.
And if I try to access the it in the orginal sql server folder it gives me access denied error.
And I have tried access .mdf detaching it from sql server on other system and it was running without any issue.
That's because you detached it incorrectly. If you copy/paste the .mdf out of the directory without first detaching it, the sys tables are not updated correctly so when you try to reattach the database, the sys tables think it's still there.
That's because you detached it incorrectly. If you copy/paste the .mdf out of the directory without first detaching it, the sys tables are not updated correctly so when you try to reattach the database, the sys tables think it's still there.
No mate it doesnt allow you to copy also if the databse is attach
I am using Win 7 atleast it doesnt allow me in this dunno about win xp.
Also I didnt directly copy it I first detach and then copied it.
Also the error states that "cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported" I tried looking for solution for the same and some where it was mention in such situation once the db
is detach you can't attach it back as the server doesnt support it but nothing like this happens I can attach and detach the database without any problem. Also after attaching I can query the db and it work perfectly fine
nikhil_shirg...
None
0 Points
7 Posts
SQL connection Error 26 while using LINQ
Apr 20, 2012 03:02 PM|LINK
Hello Mates,
I am new here so please excuse me if I have posted anything wrong or in any wrong place. I am getting below error when trying to retrieve data using LINQ from data file like mdf, accdb, mdb but if I am using ADO .Net I can retrieve data with any problem. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) I checked my SQL Browser service and its up and running to make sure if there is no problem of firewall and other issue I also made use of PortQry and it also turn out to be ok. Please anyone have solution for the same.
adamturner34
Contributor
3890 Points
971 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 04:00 PM|LINK
How are you connecting to the database?
jsiahaan
Contributor
2304 Points
588 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 04:06 PM|LINK
Hi,
This is about connection between your application with SQL Server. Make sure all name, profile, authority has been set properly. You can localize the problem for example you can turn off your firewall, set the servername on your application, and others. You may also contact your database administrator. You may also look at SQL Server manager and try to enable some of parameter on it, for example enable one by one all protocols, and do not forget to restart your server any time you change these parameters.
Hope this can help
Indonesian Humanitarian Foundation
nikhil_shirg...
None
0 Points
7 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 05:25 PM|LINK
Well I am newbiee as I am learning LINQ so I am trying it on my own pc and its giving me this error. I am getting this error while I am using .accdb or .mdb file as datasource.
And I am getting error saying
"The database 'D:\DATA\NIKHIL.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. Could not open new database 'D:\DATA\NIKHIL.MDF'. CREATE DATABASE is aborted. An attempt to attach an auto-named database for file D:\Data\Nikhil.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share."
when I use .mdf(detaching the database in sql and then saving in other location) as my datasource
Using Visual Studio 2010 and SQL Server 2008 R2
adamturner34
Contributor
3890 Points
971 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 05:29 PM|LINK
Well,
You can't detach an .mdf and use it as a datasource. It has to attached to the database engine.
ReAttach the database to the engine and recreate your linqtosql entity object.
nikhil_shirg...
None
0 Points
7 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 05:47 PM|LINK
If I keep it attach it gives me this error
Unable to open the physical file "D:\DATA\Nikhil.mdf". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)". An attempt to attach an auto-named database for file D:\DATA\Nikhil.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
And if I try to access the it in the orginal sql server folder it gives me access denied error.
And I have tried access .mdf detaching it from sql server on other system and it was running without any issue.
adamturner34
Contributor
3890 Points
971 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 06:04 PM|LINK
That's because you detached it incorrectly. If you copy/paste the .mdf out of the directory without first detaching it, the sys tables are not updated correctly so when you try to reattach the database, the sys tables think it's still there.
nikhil_shirg...
None
0 Points
7 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 06:44 PM|LINK
No mate it doesnt allow you to copy also if the databse is attach
I am using Win 7 atleast it doesnt allow me in this dunno about win xp.
Also I didnt directly copy it I first detach and then copied it.
Also the error states that "cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported" I tried looking for solution for the same and some where it was mention in such situation once the db is detach you can't attach it back as the server doesnt support it but nothing like this happens I can attach and detach the database without any problem. Also after attaching I can query the db and it work perfectly fine
jsiahaan
Contributor
2304 Points
588 Posts
Re: SQL connection Error 26 while using LINQ
Apr 20, 2012 10:19 PM|LINK
I think your problem is about version, You are trying to restore from a version 661 database to version 655.
In this case, you may try to backup your database into flat file or EXCEL, and then restore from it back from flat file or EXCEL
Hope can help
Indonesian Humanitarian Foundation