SQL Server :: Implications Of Not Closing An Open Connection Declared Locally?

Oct 5, 2010

I was wondering about something. I'm supporting a .NET C# application which has a number of database connections declared locally as IDbConnection with MS SQL Server and NHibernate. These connections are declared locally and not explicitly closed after a specific operation is performed. Are these connections automatically closed after the local method is executed, or could these connections be floating around somewhere? We're having semaphore max out problems, and I'm trying to see if this may be the culprit. I'm doubtful, as I believe these connections would automatically close, but thought I'd throw out hte possibility.

View 1 Replies

Similar Messages:

IIS Configuration :: Site Runs Locally But Page Does Not Open When Hosted On Server

May 7, 2015

I have a site (URL...) which loads and runs fine locally on the server itself, but when I try to access this externally from outside of the server (and firewall) will not load. In Safari for example, I get the message "Safari could not open the page because the server stopped responding".I have other sites on this server that do load and operate fine so I don't belive this is a Firewall issue. One thing I did notice however is that when the error message appears, it seems like the site is trying to change the protocol from http to https.

I'm trying to debug this to find out what could be happening. I've tried looking into the IIS logs as well as the Event Viewer but I see nothing. I have even tried to turn on Failed Request Tracking but no errors are logged.

View 1 Replies

Visual Studio :: Error Unable To Add Data Connection. ExecuteScalar Requires An Open And Available Connection. The Connection's Current State Is Closed?

Sep 13, 2010

I'm using Visual Studio 2008, and my database is SQL Server 2000.

I want to add a connection to the Server Explorer in VS. The Data source is Microsoft SQL Server (SqlClient). After entering in all my information and I click Test Connection, it is successful.

But when I click OK, I get the error:

Unable to add data connection. ExecuteScalar requires an open and available connection. The connection's current state is closed.

View 3 Replies

Could Not Open A Connection To SQL Server?

Aug 31, 2010

I have problems connecting to my database server. The database server is not local, I am connected via its IP address. It works fine in my development machine. After publishing the website to my server, it can not connect to my database server. 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)Why can't my publish server connect to the database server, whereas it works fine through the development machine?

View 5 Replies

How Oledb Connection Should Be Declared

Sep 27, 2010

I m new in asp.net c#.

How to declare a oledbconnection object in asp.net c#.

Means should it be declared as a static or public?

ex:- suppose the object is OleDbConnection con;

Whether it should be static OleDbConnection con;

Or public OleDbConnection con;

View 7 Replies

ADO.NET :: Open SQL Server Connection Troubleshooting?

Sep 2, 2010

This is regarding ASP.Net (VB) 2.0 and SQL Server 2008. My project's (there is only one in my solution) has a "Start Action" set to a "Specific Page" (..FormsfrmMain.aspx). Occasionally (though not always) a large number of connections (30+) will be opened prior to the frmMain.PreInit event. These connections stay open for quite some time. I am closing all of my connections with extreme prejudice. In my "finally" clause of my try...catch I have myconnection.close. Immediately after the "End Try" I have myconnection.dispose (redundant, I know). I have accounted for all connections. I placed a breakpoint on frmMain.PreInit and then (sometimes) a large number of connections (used SSMS to run sp_who and sp_who2) will have just opened.What would open a large number of connections prior to the starting page's preinit event? I am closing (and then disposing) all of my connections. I thought that I must be missing a myconnection.close in the "finally" clause, but I have looked repeatedly and cannot find anywhere that a connection is open and then not closed. Also, I do not believe that I have even opened a connection prior to the frmMain's preinit event.

View 3 Replies

SQL Server :: Connection Is Currently Open For Database?

Oct 20, 2010

I devlopyed on asp.net application in IIS, i need to know how many current database connection is open for the database..

so how can i check how many connection are currently using for this database... if we dont want some connection how can we kill the connection

View 2 Replies

ADO.NET :: Properly Closing Connection To SQL

Jan 17, 2011

I'm trying to make sure a block of code behind properly closes a connection to SQL after it's finished. But when I add the line "cmd.Connection.Close();" Visual Studio underlines "cmd" in green and says "unreachable code detected" What does that mean and how do I correct it?


View 4 Replies

SQL Server :: Error: 40 - Could Not Open A Connection To SQL Server?

Feb 18, 2011

I am facing a strange problem .can't figure this out.my web site's all pages are running fine except home page.i got this error

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: Named Pipes Provider,error: 40 - Could not open a connection to SQL Server)

View 5 Replies

DataSource Controls :: Error 40 - Could Not Open A Connection To SQL Server

Jan 8, 2010

I have an application with a few dbml files to connect to several sql servers in order to import data from one to another using Linq to SQL.

There are 2 connection strings with integrated security and in one I provide user ID and password.

It all works great in the development workstation. I've then wrapped the dll project and deployed the asp.net application to a test server. Then, when I tried to run the application to import the data, I got a connection exception:

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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I figured out after some debugging the problem is with the DataContext whose connection string is the one I provide user ID and password. Now, the funny part is that the same connection string works if I create a udl file and test it. And again the same connection string works with my development workstation.

View 4 Replies

Access :: Closing Datasource Connection?

Jul 20, 2010

I am using a AccessDatasource for getting values from a accessdatabase for a Dropdown list. After i load the page and close it, a .ldb file is created. After wards i am not able to open the database manually. How to close the connection. I have given Network service Modify access [URL] to share permission, still no go.

View 3 Replies

ADO.NET :: Closing Sql Connection Properly And Handle Errors?

Mar 31, 2011

This morning I found myself dealing with A SQL POOLING ERROR Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. I did fix this with resetting my pooling and setting a pooling max =100 Anyway now Im starting to rethink how I open connections, dealing with errors and proper closing of connections Would you say this code below is a good way of opening, closing connections (even when errors occurred)

Dim Connection As SqlConnection
Dim myConn As String = (ConfigurationManager.ConnectionStrings("MyConnString").ConnectionString)
Connection = New SqlConnection(myConn)
Dim DBCommand As SqlCommand
Dim dt As New DataTable()
Dim myDataSet As New DataSet
DBCommand = New SqlCommand("GetAllCategories_", Connection)
DBCommand.CommandType = CommandType.StoredProcedure
DBCommand.Parameters.Add("@HomePageID", SqlDbType.Int).Value = HiddenChosenVirtualMainID.Value
Dim mySqlAdapter As New SqlDataAdapter(DBCommand)
SecondLevelChildDatalist.DataSource = dt
Catch ex As Exception
'Error goes here
'close the connction
End Try

View 5 Replies

Xmltextwriter Open And Closing

Mar 11, 2010

I am using the xmltextwriter and having issues with opening tags not showing if the field is blank here is the start of my code

Dim strFilePath As String = Server.MapPath("../test.xml")
Dim utf8 As Encoding = New UTF8Encoding(False)
Dim objWriter As XmlTextWriter = New XmlTextWriter(strFilePath, New UTF8Encoding(False))
' start writing the XML document
myreader = cmd.ExecuteReader
While myreader.Read
output the first "product" element
objWriter.WriteStartElement("product", Nothing)
objWriter.WriteElementString("Id", myreader("rvid").ToString)
objWriter.WriteElementString("Class", myreader("RVClass").ToString)
objWriter.WriteElementString("Manu", myreader("rvmanu").ToString)
objWriter.WriteElementString("Model", myreader("rvmake") & " " & myreader("rvmodel"))
objWriter.WriteElementString("Year", myreader("rvyear").ToString)
objWriter.WriteElementString("Price", myreader("rvcashprice").ToString)
objWriter.WriteElementString("NU", myreader("rvnu").ToString)
objWriter.WriteElementString("SCapacity", myreader("rvcapacity").ToString)
objWriter.WriteElementString("Fuel", myreader("rvfuel").ToString)
objWriter.WriteElementString("Length", myreader("rvlenft").ToString)
objWriter.WriteElementString("Air", myreader("rvair").ToString)
objWriter.WriteElementString("Awnings", myreader("rvawnings").ToString)

Thats not all of it.. but what happens is if it is blank value Then i get this, as you see fuel has no opening tags, and the company i am supplying to needs these.

<Fuel />

What can i do to make this work how i want? I though the .tostring woudl fix it but it didnt.

View 4 Replies

ADO.NET :: Closing Connection To Table After Executing SQL To Delete A Record?

Aug 4, 2010

I have written a routine to delete a record from a table. I want to include a statement to 'close' the connection to the table but I do not know the syntex of the statement that will do this. My code is as follows:


View 2 Replies

Databases :: Write Logs Without Opening And Closing The Oracle DB Connection?

Oct 28, 2010

I am developing logging application with asp.net & vb.net & OracleAt present I'm using this mechanism to write logs

Method1 Connect (
Conn.open ()


View 7 Replies

Closing-routine / Close Connection Command After Getting Data From The Database?

Oct 4, 2010

I am using a adapted version ofhttp://www.mikesdotnetting.com/Article/45/Programmatically-accessing-data-from-DataSource-controlsDon't we need something like a closing-routine / close connection command after getting data from the database?If yes: What is the correct closing command?

View 2 Replies

Forms Data Controls :: SQL Error While Establishing Connection: 40 - Could Not Open A Connection

Jun 5, 2010

I previously used a datasource and a connection string to connect to my database on sql server and all orked fine. The connection string was saved in my web.config file and is: ....

View 1 Replies

DataSource Controls :: SqlDataSource Connections Not Closing Maxing Out Connection Pool?

Jul 28, 2010

i have a web application that use a MySql DataBase. In a page, i have used the sqlDatasource control. The problem is that the conection with the database doesn't closed and i have a lot of open conections until show me the error that says me that the conection pool is full.


View 9 Replies

DataSource Controls :: Where To Catch "Could Not Open A Connection To SQL Server" Error?

Mar 25, 2011

I have developed Dynamic Data application for DB administration. I'd like to show thrown exception message (when connection to db is closed) in UI friendly manner. I cant figure out where to catch this exception.

Tried EntityDataSource events in List PageTemplate - no success.

View 1 Replies

ADO.NET :: Connection Error "ExecuteNonQuery Requires An Open And Available Connection" After Deploying To IIS

Feb 17, 2011

I deployed my MVC app to IIS 7.0 and I keep getting the following error; ExecuteNonQuery requires an open and available Connection. The connection's current state is closed I dont get this with the app locally on my machine. Where could this error be occurring??

View 2 Replies

SQL Server :: Connection To Sql Server / Error "A Network-related Or Instance-specific Error Occurred While Establishing A Connection To SQL Server

Nov 23, 2010

I just installed sql server 2008 R2 on my computer. I am trying to connect to sql server throught my C# code and everytime I run the C# program,

I get this error "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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) "

The connection string that I used in my web.config file is


I am not sure what am I doing wrong, but I followed this article below step by step and still I am getting the same error


My instance name is MSSQLSERVER and the server that I am using is on my local machine and it has my computer name in it.

View 10 Replies

Why Does Ajax Work Locally But Not On Server

Oct 4, 2010

i've created an ajax test call that works locally, but when i upload to my hosts(2 of them) i get nothing. My sample page is: Linkage to test page.

my code is as follows:


View 8 Replies

Visual Studio :: Cannot Connect To Development Server After Closing The Server And Restarting The Project

Sep 29, 2010

I'm getting "Cannot connect to ASP.NET development server" almost every time I stop the ASP.NET server before restarting the project in debug mode. It can take between 15 seconds and 2 minutes to get the error message, and Visual Studio is frozen.

Sometimes I get three in a row, and I have to wait 2 minutes each time, or go into Task Manager and kill to process. Then I have to start Visual Studio 2010 again, which is at least three times slower than Visual Studio 2008 to open.

It's *extremely* annoying. I know I don't have to close the server if the code has changed, but sometimes I simply want to restart my website in debug mode (there is a cache on most web service calls, so this clears the cache). A workaround is to add "foo" code to a class and restart the project.

I'm running Visual Studio 2010 Professional on Windows Server 2008. I'm running the Visual Studio Power Tools too, with the latest update.

View 1 Replies

Configuration :: Menu Works Locally But Not On Server?

Oct 8, 2010

I have a menu that uses a sitemap. The menu works locally, but not on the server. Below is my code for the menu, data source, and the sitemap. why I can run it locally and use the menu, but I cannot use the menu on the server?


View 9 Replies

Web Forms :: VS 2005 - MS Outlook Works Locally But Not From Server?

Apr 16, 2010

I have a button on a page that when clicked should bring up the users email system (MS Outlook).When I run my application locally on my test machine, I click the button and my email comes up.However, once I moved the application to the web server, when I click the button, nothing happens.Can you tell me what is wrong? Below is the function I am using:


View 4 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved