Friday, March 9, 2012
monitoring connections and pooling
I have a problem with an aspnet app taking >30 seconds to
open a connection to a sql server.
Which tools could I use to monitor what connections are
open/available in the pool?
Are there any references/articles recommended using these?
Thanks
AdamIf you use OLE DB, I don't think there are any MS tools to
monitor the session pooling. If you use ODBC, you can enable
the counters for Perf Mon by following the steps in this
article:
How to Enable ODBC Connection Pooling Performance Counters
http://support.microsoft.com?id=216950
-Sue
On Wed, 13 Aug 2003 20:55:01 -0700, "adam" <adam@.twv.org>
wrote:
>Hi
>I have a problem with an aspnet app taking >30 seconds to
>open a connection to a sql server.
>Which tools could I use to monitor what connections are
>open/available in the pool?
>Are there any references/articles recommended using these?
>Thanks
>Adam|||Unfortunately I am using OLEDB from a C# web app
>--Original Message--
>If you use OLE DB, I don't think there are any MS tools
to
>monitor the session pooling. If you use ODBC, you can
enable
>the counters for Perf Mon by following the steps in this
>article:
>How to Enable ODBC Connection Pooling Performance
Counters
>http://support.microsoft.com?id=216950
>-Sue
>On Wed, 13 Aug 2003 20:55:01 -0700, "adam" <adam@.twv.org>
>wrote:
>>Hi
>>I have a problem with an aspnet app taking >30 seconds
to
>>open a connection to a sql server.
>>Which tools could I use to monitor what connections are
>>open/available in the pool?
>>Are there any references/articles recommended using
these?
>>Thanks
>>Adam
>.
>|||The problem seems to be that if a connection is request
within 2-3 minutes of the previous one, it is returned
instantly (presumably from the pool). But if it has been
more than this time, it takes 30 seconds to get one. I am
assured that the SqlServer cluster is not overloaded and
none of the other apps accessing it are having problems.
When run the same timing code on my development laptop it
obtains a connection (from a sqlserver on the same box)
in 0ms. When the same laptop tries to get one from the
production SqlServer, it takes about 32s, which leads me
to think it is a problem with the production server.
At the moment I have had to hack it so that the web app
makes a small request to the webserver every 2 mins, just
to keep a connection in the pool, so at least there is
always one connection available quickly, but this is
clearly not ideal.
How can I further elucidate the nature of this problem,
and why the server is taking so long to return a
connection.
Adam
>Hi
>I have a problem with an aspnet app taking >30 seconds
to
>open a connection to a sql server.
>
>Adam
>.
>
Wednesday, March 7, 2012
Monitor SQL Agent job in ASP.Net
I have a web page which calls a SQL Agent job to initiate an SSIS package. Is there any way i can monitor the job and detect once it has completed successfully? At present all i can seem to get is the return status of whether the job has started or not.
Any help would be most appreciated,
Many thanks in advance.
Grant
You could query the sysjobhistory table. When steps complete, rows get written to this table. You could probably access this via SMO as well, I haven't checked. There is an instance_id which will allow you to track your specific instance, assuming you get that as a token when starting. It may depend on how you are doing this, T-SQL or SMO, I haven't looked vbery far into this, but start with sysjobhistory.
Monday, February 20, 2012
Money in SQL and ASP.NET
Hi,
I'm having some trouble with my asp.net page and my sql database. What I'm trying to do is allow the user to upload an number to the database, the number is a money amount like 2.00 (£2.00) or 20.00(£20.00). I've tried using money and smallmoney datatypes but the numbers usually end up looking like this in the database...
I enter 2.00 and in the database it looks like 2.00000, and even if I enter the information directly into the database I get the same results. I'm not going to be using big numbers with lots of decimal places like this 1000,000,0000. Can anyone help me? All I want is to know what to set the value to on my aspx page and what setting to set the field to in my database, I'd just like two pound to appear as 2.00. any help would be great.
I'm using Microsoft Visual Web Developer 2005 Express Edition and Microsoft SQL Server 2005 if that helps.
Thanks.
Hi,
The money or smallmoney datatypes are the right ones to use in your case. By design, they have four decimal at the end and you can find relevent infromation related to these two from Books Online. As to your question, you use either of these types in your database to hold your data and when it is time to show your data on your asp.net page, you can format them into what you need. For example, {0,c2} will give you two decimals as you want. In GridView:
<asp:BoundField HeaderText="Price/Unit" DataField="UnitPrice" DataFormatString="{0:c2}"HtmlEncode="false"> </asp:BoundField>
Or
<asp:TemplateFieldHeaderText="UnitPrice"><ItemTemplate><asp:LabelID="Label2"runat="server"Text='<%# Eval("UnitPrice","{0:c2}") %>'></asp:Label></ItemTemplate></asp:TemplateField>|||Hi,
You don't say what type of controls you're trying to display this in. However, one simple way (that I think you can apply to any text box or label control) is this:
TextBox1.Text = (512.23).ToString("c")
If you need to set the page to a different currency than your own, one way is to set the UICulture of the page directive:
<%@. Page Language="VB" AutoEventWireup="false" UICulture="en-GB" CodeFile="Default4.aspx.vb" Inherits="Default4" %>
You can also set this in the web.config file (under globalization)
How the numbers are stored in SQL aren't relevant to how they'll be displayed - as you've discovered!
Hope this helps.
Paul