Friday, March 9, 2012
Error connecting to SQLExpress 2005 locally
I'm a newbie here and was wondering anyone could help me with this.
I have a simple ASP.NET 2 web application running perfectly fine with
IIS and SQLServerExpress installed locally on my WinXP as a testing
server (I created the app in Visual Studio.NET 2005).
When deploying this app on the production server (running Win2000
Server, IIS and SQLServerExpress 2005), I'm getting the following
message when calling an aspx data-bound page from a browser:
An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: SQL Network Interfaces, error: 26 - Error
Locating Server/Instance Specified)
On the production server, I have the SQLServerExpress installed locally
on C: drive and the database is located on D: drive (on the same
directory as the app).
Connection string used in the webconfig file:
connectionString=" Server=SERVERNAME\SQLEXPRESS;AttachDbFil
ename=D:\Inetpub\A
pp_Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
Does anyone know how to solve this issue? Any help would be greatly
appreciated.
Thanks,
HarryHi
Have you checked if you are allowing remote connections on your SQL Express
installation, by default these will be switched off.
Check the Remote Connections setting the the SQL Server 2005 Surface Aread
Configuration tool.
John
"hko" wrote:
> Hello,
> I'm a newbie here and was wondering anyone could help me with this.
> I have a simple ASP.NET 2 web application running perfectly fine with
> IIS and SQLServerExpress installed locally on my WinXP as a testing
> server (I created the app in Visual Studio.NET 2005).
> When deploying this app on the production server (running Win2000
> Server, IIS and SQLServerExpress 2005), I'm getting the following
> message when calling an aspx data-bound page from a browser:
> An error has occurred while establishing a connection to the server.
> When connecting to SQL Server 2005, this failure may be caused by the
> fact that under the default settings SQL Server does not allow remote
> connections. (provider: SQL Network Interfaces, error: 26 - Error
> Locating Server/Instance Specified)
> On the production server, I have the SQLServerExpress installed locally
> on C: drive and the database is located on D: drive (on the same
> directory as the app).
> Connection string used in the webconfig file:
> connectionString=" Server=SERVERNAME\SQLEXPRESS;AttachDbFil
ename=D:\Inetpub
\App_Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> Does anyone know how to solve this issue? Any help would be greatly
> appreciated.
> Thanks,
> Harry|||Hi John,
I did allow remote connections eventhough my database is on the same machine
as my web app, but no luck so far.
I used windows authentication for the database, and login to the machine
using admin account.
Another thing that I noticed is that when I go to SQL Server Configuration
Manager, under SQL Server 2005 Network Configuration, it says Protocols for
MSSQLSERVER, whereas on my dev machine it says SQLEXPRESS. When upgrading
from MSDE to SQLExpress i just chose the default instance name, but somehow
it's saying MSSQLSERVER.
I checked the databaseconnection through SQL Management Studio Express and
it works fine. Only when viewing the data-bound page on a browser that I get
the error message.
Do you think I should try to uninstall SQLServer Express and reinstall?
hko
"John Bell" wrote:
> Hi
> Have you checked if you are allowing remote connections on your SQL Expres
s
> installation, by default these will be switched off.
> Check the Remote Connections setting the the SQL Server 2005 Surface Aread
> Configuration tool.
> John
> "hko" wrote:
>|||Hi
If this is the default instance then change your connection string to only
be the servername.
If you want to change the installation from being the default instance you
will need to re-install.
John
"hko" wrote:
> Hi John,
> I did allow remote connections eventhough my database is on the same machi
ne
> as my web app, but no luck so far.
> I used windows authentication for the database, and login to the machine
> using admin account.
> Another thing that I noticed is that when I go to SQL Server Configuration
> Manager, under SQL Server 2005 Network Configuration, it says Protocols fo
r
> MSSQLSERVER, whereas on my dev machine it says SQLEXPRESS. When upgrading
> from MSDE to SQLExpress i just chose the default instance name, but someho
w
> it's saying MSSQLSERVER.
> I checked the databaseconnection through SQL Management Studio Express and
> it works fine. Only when viewing the data-bound page on a browser that I g
et
> the error message.
> Do you think I should try to uninstall SQLServer Express and reinstall?
> hko
> "John Bell" wrote:
>|||I only have one instance and that is the default instance, and this is my
connection string:
connectionString=" Server=HOMER\SQLEXPRESS;AttachDbFilename
=D:\Inetpub\App_Da
ta\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
Still something isn't right. Do you think I should probably re-install and
do fresh installation of SQL Express instead of upgrading (like what I did)?
"John Bell" wrote:
> Hi
> If this is the default instance then change your connection string to only
> be the servername.
> If you want to change the installation from being the default instance you
> will need to re-install.
> John
>
> "hko" wrote:
>|||Hi
Try the connection string:
connectionString=" Server=HOMER;AttachDbFilename=D:\Inetpub
\App_Data\registra
tion. mdf;Database=registration;Trusted_Connec
tion=yes;"
providerName="System.Data.SqlClient"
If you want a names instance then you would have to re-install and say that
you want a named instance and not the default instance.
John
"hko" wrote:
> I only have one instance and that is the default instance, and this is my
> connection string:
> connectionString=" Server=HOMER\SQLEXPRESS;AttachDbFilename
=D:\Inetpub\App_
Data\registration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> Still something isn't right. Do you think I should probably re-install and
> do fresh installation of SQL Express instead of upgrading (like what I did
)?
> "John Bell" wrote:
>|||Still not working. I tried different combination of connection strings but
kept getting the same error message.
I just want to use the default instance since there's only one database on
the machine.
I suspect there's a glitch during the upgrade process which causes SQL
server to locate the default instance. I was able to connect ok using
Management Studio Express.
This is the most frustrating thing ever to deal with...
"John Bell" wrote:
> Hi
> Try the connection string:
> connectionString=" Server=HOMER;AttachDbFilename=D:\Inetpub
\App_Data\regist
ration. mdf;Database=registration;Trusted_Connec
tion=yes;"
> providerName="System.Data.SqlClient"
> If you want a names instance then you would have to re-install and say tha
t
> you want a named instance and not the default instance.
> John
> "hko" wrote:
>|||Hi
A couple of suggestions:
Try using osql to try and connect, use both the server name and the IP
address and different user combinations.
Check that there is no blocking of the ports being used by a firewall (Try
telneting to the port!)
John
"hko" wrote:
> Still not working. I tried different combination of connection strings but
> kept getting the same error message.
> I just want to use the default instance since there's only one database on
> the machine.
> I suspect there's a glitch during the upgrade process which causes SQL
> server to locate the default instance. I was able to connect ok using
> Management Studio Express.
> This is the most frustrating thing ever to deal with...
> "John Bell" wrote:
>
Wednesday, March 7, 2012
Error connecting to server
Hi all,
I am trying to connect to the server and i got this error:
TITLE: Connect to Server
Cannot connect to HST\SQLEXPRESS.
ADDITIONAL INFORMATION:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
BUT when i tried to connect to the server using the name instance (local) or my computer name directly it works.
I have to use this format in the name instance while i am connecting to the server :
computerName/SQLEXPRESS
what is the problem and how can i fix it?
thanks in advance!
hi,
Reta wrote:
TITLE: Connect to Server
Cannot connect to HST\SQLEXPRESS.
BUT when i tried to connect to the server using the name instance (local) or my computer name directly it works.
if you mean, by that, that you can connect to ComputerName or (Local) and not to ComputerName\InstanceName or (Local)\InstanceName, that means you installed a default instance and not a named instance.. is that correct?
regards
|||what does that mean?
yes, i installed a default instance....
but i did the same installation with another pc which is work fine using local/SQLEXPRESS
Anyway, if i reinstall it with a name instance, will this fix the problem?
and what about the instance name, what should it be?
Thanks
|||hi,
that means you are trying to connect to an istance that does not exists, the "named instance" ComputerName\SQLExpress.. so just connect to the default instance and use it..
you do not have to uninstall it and reinstall as a default instance to "fix", as there's nothing to fix.. just use the default instance as it is on that machine..
regards
|||Thanks Andrea... I know that there is nothing to fix
But.. what why i want to use a name instance is that i wrote an SQL program that use a name instance " computerName\SQLEXPREES " in the connection string.. and the program works fine in all pc's that use it except one.. which has the error mentioned here
|||hi,
on that "failing" pc, you have to modify the connection string to point to the default instance..
as connection string usually are not hard coded, but built on local settings collected from settings files, you usually do not have to modify the application nor to install a new named instance..
regards
Sunday, February 26, 2012
Error Code if Row is locked
Hallo,
if a row is locked in SQLExpress and an other user want to update this row,
SQLExpress waits until timeout. And than I get the errormessage "timeout".
What I need is an immediately errormessage "row is locked" !
So that the user dont need to wait if the row is locked
and I need the correct errormessage so that I can check
if there is a databaseproblem or only the row locked
because an other user is editing the same rows.
Thx Wolfgang
(please excuse my english)
hi,
SQL Server does not provide this feature as this should be managed on the client side of the application and not server side on SQL Server...
you can thus set an appropriate timeout on the ado/ado.net command you are using, and then take the required decision once the command result in an exception..
but you have to fine tune your timeout, depending on SQL Server load, bandwidth, network trafic, ..
regards
|||Thank you for your help!
I need a small timeout if the Updatecommand "meets" locked rows.
I do not want to reduce the timeout for the SqlCommand itself.
The solution i have found is to use the keyword NOWAIT in the SQL-Statement.
UPDATE table WITH (NOWAIT) SET ......
I think this works okay, but I have not found something to set timeout for locks to 1 sec
and timeout for SQLCommand to 15 sec.
Thany you for your help.
Wolfgang