Closing A Connection Created From A SQLDataSource

Jun 20, 2006

I'm new to ASP.NET and I've searched before posting.

I have a simple form containing a FormView control. The FormView uses a SQLDataSource. This works fine and in 30 seconds I have a working form without writing any code.

A form built this way causes problems with connection pooling because I am not closing the connection. What is the best method for me to remedy this?

Every resource I've found explains that I have to explicitly close the connection. How do I do that in this case? Dispose the SQLDataSource in the FormView DataBound event? Rewrite the form so I can control opening and closing of the connection?

Thanks in advance.

View 1 Replies


ADVERTISEMENT

Closing SQL Connection

Sep 24, 2007

hello to alli am finding my self in confusing problem.
everyay log file of my application increase by 10 GB.every time i found more than 100 connections open in SDQL Server 2005 under my database.
i an using SQLHELPER Class by microsoft.i ma not putting my code in try-catch block. example
of one of my frequently used function is as follows:
        protected Int64 GetMemberID()        {            String SqlSelect = "SELECT * FROM MemberMaster WHERE MemberUserName= '" +
Session["UserName"].ToString() + "'";            SqlDataReader dr1 =
SqlHelper.ExecuteReader(ConfigurationManager.ConnectionStrings["CowcallConnectionString2"].T
oString(), CommandType.Text, SqlSelect);            while (dr1.Read())            {                CurrentMemberID = Int64.Parse(dr1["MemberID"].ToString().Trim());            }            return CurrentMemberID;        }
well i doubt i am opening connection and do not closing it. moreover i do not know how to close connection in above code when i am using sql helper class.please give me yours suggestion regarding my code even if it is not solving above two problems.

View 1 Replies View Related

Closing A SQL Connection

Nov 1, 2007

I have a VB (sorry!) app using SQL Express DB. It was all created using the wizard so I didn't have to manually deal with opening connections etc.

Now, I need to be able to email the .mdf file from within the application, but I can't do this because the file is in use.

I have tried closing all forms with DB connections and then doing it but it takes around 6 minutes before the file becomes "free" and attachable to the email.

Can anyone suggest a way of releasing the file so that I can email it?

Many thanks,

Rich

View 6 Replies View Related

Closing Connection Problem

Jun 26, 2007

I have setup my loop to loop through textboxes and fill the according textboxes with data it retrives, if seems to work fine, but there is a problem with opening and closing the connection below is my codeint i = 0;for (i = 1; i <= 3; i++)
{
//This gets the stock ID from the textbox.string stock_ID = ((TextBox)Panel1.FindControl("txtID" + i.ToString())).Text;
//This is the sql statement.string sql = "SELECT [n_or_sh], [title], [cost_price], [selling_price] FROM tbl_stock WHERE stock_ID = " + stock_ID;
 
//This creates a sql command which executes the sql statement.SqlCommand sqlCmd = new SqlCommand(sql, myConn);
 
myConn.Open();
//This is a reader for the results to go in.SqlDataReader dr = sqlCmd.ExecuteReader();
//This reads the first result from the sqlReader
dr.Read();
//This sets the title label text to the value of the description column.TextBox currentBox1 = (TextBox)Panel1.FindControl("txtDesc" + i);
string strtxtDesc = currentBox1.Text;
strtxtDesc = dr["title"].ToString();
} // end of loop
myConn.Close();
} // end of button click
 i have tried putting the myConn.Close() in different places but it dosnt seem to work!
any advice or tips ?
RegardsJez

View 1 Replies View Related

Opening And Closing The DB Connection

Mar 16, 2008

Hi most of my code follows the following format in a lot of my pages, my question is; Am i approaching it the right way in terms of performance, sql injection attacks and anything someone more knowledgeable than myself can think off, please feel free to criticise the code. Thank youprotected void Page_Load(object sender, EventArgs e)
{string strID = Request.QueryString["id"];
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);SqlCommand command = new SqlCommand("stream_EventsByID", conn);
command.CommandType = CommandType.StoredProcedure;command.Parameters.Add("@eventID", SqlDbType.Int).Value = Request.QueryString["id"];
conn.Open();
SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
eventList.DataSource = reader;
eventList.DataBind();
conn.Close();
}
}

View 7 Replies View Related

Opening And Closing A Connection In A Loop, Should I Or Shouldn't I?

Oct 31, 2006

i have a loop that can run say 30k times.  in there i am using the try / catch / finally blocks to handle ADO.NET Transactions (thanks CADDRE!)Should i open and close the SQL Connection for each record? or open it and close it outside of the loop only once ?thanks in advance, mcm  

View 3 Replies View Related

Accessing Data From A Programmatically Created SqlDataSource

Nov 3, 2007

Hi
I think I've programmatically created a SqlDataSource - which is what I want to do; but I can't seem to access details from the source - row 1, column 1, for example????
If Not Page.IsPostBack Then
'Start by determining the connection string valueDim connString As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
'Create a SqlConnection instanceUsing connString
'Specify the SQL query
Const sql As String = "SELECT eventID FROM viewEvents WHERE eventID=17"
'Create a SqlCommand instanceDim myCommand As New Data.SqlClient.SqlCommand(sql, connString)
'Get back a DataSetDim myDataSet As New Data.DataSet
'Create a SqlDataAdapter instanceDim myAdapter As New Data.SqlClient.SqlDataAdapter(myCommand)
myAdapter.Fill(myDataSet)Label1.Text = myAdapter.Tables.Rows(0).Item("eventID").ToString() -??????????????
'Close the connection
connString.Close()
End Using
End IfThanks for any helpRichard
 

View 1 Replies View Related

SqlDataReader Reader Connection Closing Before Dt.Load(reader)

Jun 26, 2007

As you see in the images the connection is closing. During the read it counts 5 columns which is correct. When I step through the code it closes the connection when it hits dt.Load(reader) and nothing is loaded into the datatable.
 
------------------------------------------------------------AS I STEP THROUGH -----------------------------------------------------------------------------------------------------------------------

 
Please help,
 
Thanks,
Tom

View 1 Replies View Related

The New Connection Manager Could Not Be Created.

Jul 29, 2005

I had to reinstall the June CTP and now when I right click in the connection manager area and try to create a new OLEDB connection I get this message:

View 9 Replies View Related

Aspnetdb Connection Could Not Establish But Database Correctly Created.

Sep 2, 2007

I installed netframework 2.0 Visual Web developer and MSSQL 2005 express edition with SQL Server management express.I have got this configuration: 2*256 mb ram Intel Pentium 3.2Ghz Windows XP HUN SP2 latest version.server name: localhostSQLEXPRESSAuthentication: Windows AuthenticationI run aspnet_regsql.exe and the setup wizard created aspnetdb see here, Microsoft sql server management studio can see the database:But! When I run to the asp.net web application administration tool in Provider Configuration and chooseAspNetSqlProvider only 1then I click Select a single provider for all site management data link -> then testThe Tool write this:Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site
Administration tool, use the aspnet_regsql command-line utility to
create and configure the database, and then return to this tool to set
the provider. 

View 5 Replies View Related

SSIS Error On Connection Manager - IUI Service Could Not Be Created.

Oct 26, 2007

I have installed the SQL Standard Client install on my laptop which has windows xpp using the following batch file.

Start /wait setup.exe /qn ADDLOCAL=SQL_DTS,Client_Components,Connectivity,SQL_Tools90,SDK,SQL_WarehouseDevWorkbench,SQLXML,Tools_Legacy,SQL_Documentation,SQL_BooksOnline

I am yet to connect to any datasource on my SSIS package. But when I right click on the connection Managers box in my SSIS project and select €œNew OLE DB Connection€? (or any other connection type), I get an Error as below. Please Help to resolve this error.

The new connection manager could not be created.
Additional information:
The service System.Windows.Forms.Design.IUIService could not be located.
(Microsoft.DataTransforamtionServices.Design).

View 4 Replies View Related

Can't Recreate The Destination Connection For Packages Created By Import And Export Wizard

Nov 15, 2007



Hi,

I have a table need to export to excel. 3 columns are 4000k. I can create the ssis package by using import and export wizard and it works fine. But when I try to edit the destination connection for excel, like using another excel file. In the edit window, the Name of the Excel Sheet box is empty, I click new button. It always fail. (with the 3 columns created as varchar (4000) or nvarchar(4000).

I am wondering how import and export wizard can create this table which I can't create it manually?

Thanks

View 6 Replies View Related

Integration Services :: Delete Text File Created Through Flat Line Connection?

Jul 6, 2015

created a very basic flow in SSIS: extracted table data through ole db connection, added multicast and as end result i created a flat file destination (with .txt file) and a ole db destination.

My question is; how can i delete the .txt file before executing the flow again? Want to avoid that the .txt file has duplicated rows after a second execution of the flow. Is it possible to use scd component or is this way to complicated? A for each loop?

i need a similar solution for the data that will be transported through the ole db destination task....

View 2 Replies View Related

Does SqlDataSource Hold The Connection ?

Mar 9, 2006

If we bind a GridView to a SQLDataSource, is it not a connected usage, which locks up one connection thread ?

View 2 Replies View Related

Problem Creating A Sqldatasource Connection

Sep 19, 2006

I am able to connect but when I try to use the advanced sql generation options the two check boxes are non enabled (generate insert, update, and delete statementsuse optimistic concurrencywhat is happening the user id has permissions to update/delete/select from the selected table

View 1 Replies View Related

Catching SqlDataSource Connection Exceptions?

Feb 14, 2008

Got a weekly problem when our ISeries DB goes down for maintenence i get ODBC connection errors when the SqlDataSource tries to connect.  Is there a method I can use to catch the exception?  If so, what event from SqlDataSource can i use, and what approach should I take?Thanks in advance! 

View 2 Replies View Related

Connection Pooling Not Working With SqlDataSource

Jun 14, 2008

My total test page is shown below.  I monitor the connections by SP_WHO2.  Without the second call, connection pooling seems to be working, ie I refresh my browser repeately but the number of connections as seen from SP_WHO2 does not increase.
However, if I have the second call, every time I refresh the page at the browser, the number of connections increases by one.  This is obviously not acceptable in a real world application.
I tried both Integrated Authentication (with no impersonation) and using a hardcoded service account.  Both have the exact same results.  In fact this test is not about multi-user yet, it is the same single user just refreshing the same page.
May I know what have I done wrong?  All the documentation from Microsoft says close the connection after using it.  In the case of SqlDataSource how do I close the connection?
Thanks 
 <%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "Select ID from Master";
System.Data.SqlClient.SqlDataReader reader =
(System.Data.SqlClient.SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
if (reader.HasRows && reader.Read())
Label1.Text = reader["ID"].ToString();
SqlDataSource1.Dispose();

//second call: read from another table
SqlDataSource1.SelectCommand = "Select Name from Students";
reader = (System.Data.SqlClient.SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
if (reader.HasRows && reader.Read())
Label1.Text += reader["Name"].ToString();

reader.Close();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
DataSourceMode="DataReader"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
 

View 2 Replies View Related

SQLDataSource Connection String From WebConfig

Feb 21, 2006

I have a connection string in the connection string section of my web.config, when I add a SqlDataSource to my page and click the ConnectionString property, My connection string does not appear in the drop down list, the only option I have is New Connection String... Are you supposed to be able to select a connection string from your web.config or am I supposed to do this on page_load?
TIA,Jason

View 2 Replies View Related

Get New Database Created Then Running Script To Created Tables / Relationships

Jun 29, 2015

trying to get a new database created then running a script to created the tables, relationships, indexes and insert default data. All this I'm making happen during the installation of my Windows application. I'm installing SQL 2012 Express as a prerequisite of my application and then opening a connection to that installed SQL Server using Windows Authentication. 

E.g.: Data Source=ComputerNameSQLEXPRESS;Initial Catalog=master;Integrated Security=SSPI; Then I run a query from my code to create the database eg: "CREATE DATABASE [MyDatabaseName]".

From this point I run a script using a Batch file containing "SQLCMD....... Myscriptname.sql". In my script I have my tables being created using "Use [MyDatabaseName]   Go   CREATE TABLE [dbo].[MyTableName] .....". So question is, should I have [dbo]. as part of my Create Table T-SQL commands? Can I remove "[dbo]."? Who would be the owner of the database? If I can remove the [dbo]., should I also remove dbo. from any query string from within my code?

View 3 Replies View Related

Getting The List Of Connection Strings To Display In The SqlDataSource Wizard

May 15, 2007

I've added an SqlDataSource control to my web page and selected "Configure Data Source" on it.  This brings up a "Choose Your Data Connection" wizard, and it asks you to select from a dropdown list of presumably pre-existing connection strings in my web.config file.  However none of my connection strings will display in that dropdown list.  The only thing i can do is hit the "Create New Connection" button and this adds yet another connection string to my web.config file. I've already ran through the wizard once, created a new connection string, but when i run through the wizard again, even the new connection string - the one created by the last wizard will not appear in the dropdown list. Any suggestions? Jason 

View 3 Replies View Related

How To Use ProviderName, User ID, Password, And Connection Saved In Web.config And SqlDataSource

Jun 1, 2008

Just downloaded and installed the VS 2008 Express and created/tested some websites.   I have done several aspx websites using VS 2005 during the last 2 years.  Still I don't quite understand the details of coding the database connection and DataBing.  For example, what does 'providerName',and Integrated Security really mean?Why in the Web.config file these are providerName="System.Data.SqlClient" and Integrated Security=True?  Why in Default.aspxthere are both ntegrated Security=True;and USER ID=WEB; Password=webwebweb1".  I know these may deal with the authentication mode of my SQL Serverdatabase.For the VS 2008 Express and SQL Server 2005 Express, I installed in my XP home PC, I used the file system websites,  If I upgrade to XP Pro and install IIS web server, and use SQL Server 2005, what might be different? Jeffrey Web.config <connectionStrings>        <add name="NorthwindConnectionString" connectionString="Data Source=D5MRY6G1SQLExpress;Initial Catalog=Northwind;Integrated Security=True"            providerName="System.Data.SqlClient" />    </connectionStrings>Default.aspx <asp:SqlDataSource ID="SqlDataSource1" runat="server"         ConnectionString="Data Source=D5MRY6G1SQLExpress;Initial Catalog=Northwind;Integrated Security=True; USER ID=WEB; Password=webwebweb1"         ProviderName="<%$ ConnectionStrings:NorthwindConnectionString.ProviderName %>"MasterDetail.aspx <asp:SqlDataSource ID="SqlDataSource2" runat="server"         ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"               

View 1 Replies View Related

I Created A Website On My Localhost With Three .mdf Files Using SQL Express But Now I Get An Error When I Try To Host It On My Web Server Without SQL Express. Need Some Help On How To Change My Connection

Feb 15, 2008

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)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: 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)Source Error:
here is my web.config file:<?xml version="1.0"?><!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
WindowsMicrosoft.NetFrameworkv2.xConfig
--><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings><add key="EmailFrom" value="webmaster@reaganpower.com"/>
<add key="EmailSubject" value="File Ready for Download!"/><add key="SmtpServer" value=""/>
<add key="MailUser" value=""/><add key="MailPassword" value=""/>
<add key="MailPort" value="25"/><add key="EmailFormatSelected" value="Text"/>
<add key="PageTitle" value="Send It Now!"/><add key="ShareLocalFolderPath" value="H:MIS DepartmentIntranetSendItNowFileStorage"/>
<add key="httpDownloadPath" value="http://misfs/SendItNow/ContentFiles/"/>
<!--
<add key="CurrentTheme" value="CleanBlue" />-->
<add key="CurrentTheme" value="CleanOrange"/></appSettings>
<connectionStrings>
<add name="ConnectionString" connectionString="Data Source=(local)SqlExpress;AttachDbFilename=|DataDirectory|FileShareDB.mdf;Integrated Security=True;User Instance=True"providerName="System.Data.SqlClient"/>
</connectionStrings><system.web><!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.-->
 <identity impersonate="false"/>
<roleManager enabled="true"/><compilation debug="true" strict="false" explicit="true">
<assemblies><add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
<pages><namespaces>
<clear/><add namespace="System"/>
<add namespace="System.Collections"/><add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/><add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/><add namespace="System.Web"/>
<add namespace="System.Web.Caching"/><add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/><add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/><add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/><add namespace="System.Web.UI.HtmlControls"/>
</namespaces></pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user. -->
<authentication mode="Forms"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>-->
</system.web>
</configuration>

View 2 Replies View Related

Closing ADO Objects

Apr 4, 2007

I know it's "best practice" to dispose ado.net objects, but does it make a big difference if just the connection is closed? In other words, is the code below good enough or should the DataAdapter & Command be explicitly closed?using (SqlConneciton  cn = new SqlConnection(connstr)){ SqlDataAdapter da = new SqlDataAdapter(sql,cn);DataSet ds = new DataSet();da.Fill(ds); SqlCommand cmd = new SqlCommand(someOtherSql,cn);cmd.ExecuteNonQuery();  } 

View 2 Replies View Related

Closing All Connections

Nov 15, 2004

How do I set up a job so that I close all open database connections? I think we have a leak in our code which causes our DB to go down (max connections used) roughly once every month, so we just restart the SQL server. Until we can find the exact problem I'd like to do this.

For simplicities sake let's say my database name is just "test."

Thank you.

View 4 Replies View Related

Connections Not Closing

Feb 23, 1999

I have an app that people frequently disconnect without a logout and the connection remains open in SQL Server. Does anyone know of a script or program that will go through and kill inactive connections?

View 1 Replies View Related

Closing The Sessions In SQL CE

Feb 27, 2008

Hi Friends,

We need a small suggestion regarding releasing the resources utilized before closing the session we established with the SQL CE database. To the best of our knowledge we are releasing the resources properly but still some how some resources get locked and we were not able to open a new session after closing the existing session.

Are there any functions or methods available to identify the existing resources, rowsets and other components who have connection with the existing session, kindly help us in this regard since we struck up mainly with this issue.
We work with EVC++ 3.0 and SQL CE 2.0

Thanks in advance.

Regards,
Sasi.

View 2 Replies View Related

Closing Dts.Connections

Mar 7, 2008



Hello:

I have the following script wrtten in VB that opens a connection to an Analysis Services db in a script task within my control flow:


Dim oConnectionSR As ConnectionManager

oConnectionSR = Dts.Connections("OLAPServer.Sales")


This script is used by a script task within each of three child packages that are called by a parent package. Each call is made to a different OLAP cube. The first package makes the connection and runs fine. When the second package runs, it still sees the connection value from the first package and fails.

What is the best way to close the connection once it is no longer needed? I have tried the dispose() method, and that did not work.

Thanks for your help!

Tim




View 4 Replies View Related

Problem In Closing Connections

Feb 27, 2008

Hi Guys I am facing a problemI am getting 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 reachedI have checked
my whole code and no Connection leakage is there... but still
Connections are sleeping... I have increse my pool size to 500 and now
i have chaos of 500 sleeping connections... How ever
I have found that even after Opening Enterprize manager i can not kill
Process... How ever my administrator can kill the process from his
enterprize manager... Is there some problem with my credentials or do i need to find  out the leakage  in my code...How ever I have checked twice or thrice  but  my code is Ok and i have  Closed connection properly every where... I am using SQL Server 2000 and ASP.Net 1.1

View 5 Replies View Related

Closing A SqlDataReader After Calling From A DAL....?

Dec 12, 2005

I have a DAL that I'm trying to implement - the issue is that I want to call a reader from the DAL, but I'm not sure how to close it. I got best practices from MSDN (located here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqldatareaderclasstopic.asp ) regarding the SqlDataReader, but can't seem to figure out how to close when using DAL.
Here is sample code in C#:
NOTE: Everything WORKS just fine, however in the DAL for GetRoutes, I can't seem to figure out how to close the reader (see comments in function):
mydatapage.aspx...//Populating some Drop Down List:private void ddlRoutes_SelectedIndexChanged(object sender, System.EventArgs e) {   SqlDataReader dr = DAL.GetRoutes(ddlRoutes.SelectedValue.ToString());   while (dr.Read())   {   .   .   .   }}
DataAccessLayer.cs...public static SqlDataReader GetRoutes(string sIdx){ cnn = new SqlConnection(ConnectionString);        cnn.Open(); SqlCommand cmd = new SqlCommand(); SqlParameter par = new SqlParameter(); cmd.Connection=cnn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_GetRoutes";
 return cmd.ExecuteReader();
        //Everything works above, however I would think that something        //like this SHOULD work, but doesn't:        //        // SqlDataReader dr;        // dr = cmd.ExecuteReader()        // return dr;        // cnn.close();   }
 

View 2 Replies View Related

Opening And Closing DB In Different Sub Routiens

Apr 20, 2006

If Someone could please show me some example VB code where i can open the my Sqlconnection in the Page_Load subroutien... and then close that SqlConnection in the Page_Unload routine. I want to be able to execute Sql command without having to re-open and re-close the connection.

Thanks,
Greg

View 4 Replies View Related

SQL 2012 :: Closing A Security Hole

Jul 9, 2015

I have a purchased product that has a DB with several thousand tables in dbo. I can't change anything with the default dbo schema other than security. I have a table called dbo.ACCOUNT. It has information from multiple sites on it. I have a reporting team that need only access the information for SITE 1 on the ACCOUNT table and anything in the other 1000+ tables in the dbo schema.

I created a role (Analytics) and granted select access to dbo. I created a schema (Analytics) and assigned it the role. I created a view in the new schema called Analytics.ACCOUNT with a WHERE SITE = 1 clause on it. If they use the view, they see only the things they should. My problem is they can still do a select * from dbo.ACCOUNT and see everything they shouldn't see. How can I close that hole? I am not seeing a solution. If there is no way to fix this with roles/schemas/views, what else can I do?

Some of my pain points. I have this issue with about 30 tables. Creating custom table(s) to isolate data for each site will cost me another 2T of storage. Loading those custom tables every day would be cumbersome. Keeping the DDL in sync with the source table would be cumbersome. With the way I have it set up now, if I deny access to the source tables the view breaks because it needs access to the source tables to dynamically build the view. Here is the code I ran to create everything.

USE[DB]
--create test user login
CREATE LOGIN [Analytics_ETL] WITH PASSWORD=N'XXXXXXXXXXX'
GO
--create user in test database
CREATE USER [Analytics_ETL] FOR LOGIN [Analytics_ETL] WITH DEFAULT_SCHEMA=[Analytics]

[code]....

View 2 Replies View Related

Closing A Child Package After It Runs

Sep 18, 2007

Hello,

I have a package which runs several child packages. All works well and everything runs, but when it runs each of the children packages, it opens it, runs it and then it stays open. When the whole thing is done, there are about 25 or so open packages. Should they close after they run? Is there a setting I need to do this?

The point I am in SSIS is that I have gotten a decent feel for creating packages, but everything is still in debug mode. I need to take the next step to learn how to have this stuff run automatically or from a procedure outside the SSIS interface. Does that make any sense? If so, where can I learn about that.

Thanks for the help.

-Gumbatman

View 3 Replies View Related

SQL Server 2000 Not Closing Connections Help!!

Jan 31, 2008



I am experiencing a strange problem on a new installation of SQL Server 2000, installed on Windows 2003 server. SQL server has been service packed to SP3a

The users connect to the SQL database via an MS Access project front end, when they log out of the front end the SQL server still show them as connected in Management > Current activity > process info. I can kill the processes left behind but i am confused as to why this is happening.

The database was recently moved from an SQL installation on a Windows 2000 server to this new Windows 2003 server, the problem didnt occur on the old server and no upgrades have been applied to the database or the front end since the move, which makes me think something is not right about the install.

Any advice would be gratefully received

Thanks
Nick

View 1 Replies View Related







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