Showing posts with label application. Show all posts
Showing posts with label application. Show all posts

Monday, March 19, 2012

Maintaining Security

I am a beginer in SQL Server. I have developed a simple accounting application in VB and SQL. Now I have successfully completed my application. Now I want to deploy it to my client. So I installed SQl Server and required VB components in the clients computer. I also created 'sa' login and secret password only know by me. I thought my data in that clients computer was full safe but later on i found that we can also connect to the sql server using the NT administrative account and easily change the data of the database. So now I am worried that if someone enters and access the clients computer with administrator's password then he/she can change my data resulting the corruption of the data. So is there any way that I can prevent the access the database to the client with the NT administrative account or any way 2 track the way the data changed?

I am probably missing something from your application description; please correct me if any of my assumptions is wrong. I will list a few assumptions based on my understanding and try to answer your question and you some recommendations based on them:

* There is one SQL Server 2005 machine that can be remotely access by multiple clients running your application.

* You have a hardcoded SA password embedded in your application

I want to start by pointing out that by default members of the Windows Administrators group on the machine running SQL Server will have access to via this membership. You can remove such privilege to prevent an accidental access by removing the BUILTIN\Administrators login from SQL Server: DROP LOGIN [BUILTIN\Administrators]

It is important to remark that this will prevent the Windows administrators from connecting to SQL Server 2005 when the server is running normally, but any local administrator will be able to connect to SQL Server 2005 by starting the server in single-user-mode, this is allowed for system maintenance and to prevent accidental lockouts from the system. It is also important to note that it is pretty much impossible to stop an adversary that already has full access to the SQL Server 2005 machine as system administrator.

The next thing to note, and that hopefully is something I misunderstood is the hardcoded SA password in your application. I strongly recommend against such practice as an adversary can easily recover the plaintext password from your client and compromise the data. Even more, the account you are using in this case is SA; I strongly recommend using the “least privilege principle” and define roles for your application, based on the most common tasks. Probably you have administrative tasks (create users, tables, etc.), read-write tasks (update, inserts, etc.) and read-only tasks (search and read data, but not write). I would recommend creating different principals for such tasks and grant only the required privileges for each principal type, restricting access to the most privileged accounts (such as SA) only to users that require such high privileges.

Additionally I want to remind you of a new feature in SQL Server 2005 that may affect your design in case you use hardcoded passwords: password policy. SQL Server 2005 running on Windows 2003 can take advantage of the Windows password policies and use them in SQL logins (including SA); these password policies allows a domain/machine administrator to define password complexity, life-time, lockout policies, etc. in a centralized way. When running on Windows 2003, SQL Server will use this new feature by default, but you can explicitly turn it off for any given SQL account. It is highly recommended to take advantage of this feature especially for SA, but if you have hardcoded passwords (or passwords that are difficult to update in your app) you will probably have to disable the password policy for the accounts you use in your app.

Detect unexpected value changes is a little tricky. One possibility here may be to use a certificate to sign the data and store the signature along with the data; this way your application can verify that the signature is valid before consuming the data.

I hope this information will be useful, let us know if you have further questions or/and feedback.

-Raul Garcia

SDE/T

SQL Server Engine

|||Thanks. As I am only concern abt the protection of my data I wanna suggestion on "how do I safe gaurd my data" so only the login used by me or my program can change/add/remove the data from my database not other users from any other program. And I also wanna know that whether can I track the activities of third user who changes the data in my database.|||

You might want to take a look at a thread that is related to your question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=371562&SiteID=1.

You can only achieve what you are asking if you have full control over the machine where your program is installed. Otherwise, you could write your program, so you could detect if someone changed the data, but you would not be able to prevent such changes. In other words, there is no way to prevent corruption of your data by a third party.

Thanks
Laurentiu

maintainance

I have a SQL server database application,
I just wnated to know that may I maintain the system while user use the
sysetm?
Should I maintain the system while all user off line?
Any information is great appreciated,Hi
It depends on what you are doing, but usually if you can schedule
maintenance when the system is quiet/down it will have less impact. Using
SQL Agent you can schedule your maintainance tasks for quiet times
John
"Souris" <Souris@.discussions.microsoft.com> wrote in message
news:9D26D4FF-1404-4E34-B19D-6DF86A34865D@.microsoft.com...
>I have a SQL server database application,
> I just wnated to know that may I maintain the system while user use the
> sysetm?
> Should I maintain the system while all user off line?
> Any information is great appreciated,
>|||As John said, it depends on the action you want to perform. If you have a
24/7 database you sure have no time slot to do a cold backup ;-). But as
John said, i wouldt places IO-based Activity (rebuilding of indexes) in the
primary processing time. If you have any questions for the details of your
actions you want to perform, do not hesitate to ask.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--
"Souris" <Souris@.discussions.microsoft.com> schrieb im Newsbeitrag
news:9D26D4FF-1404-4E34-B19D-6DF86A34865D@.microsoft.com...
>I have a SQL server database application,
> I just wnated to know that may I maintain the system while user use the
> sysetm?
> Should I maintain the system while all user off line?
> Any information is great appreciated,
>

Monday, March 12, 2012

Maintain a consistent DB connection through Application lifecycle

Hey everyone,

I'm new to .NET and I've recently inheirited a rather large and busy asp.net website. I was asked to add a testimonials section on each page that will randomly pull a testimonial out of the db. This is fine, however, I'm getting random errors about the DB connection either being closed or connecting. Here is the code for the testimonials class:

1public SqlDataReader GetTestimonials(ref SqlDataReader reader,int iCatID,string sLanguageType)
2 {
3 SqlCommand cmd =new SqlCommand("sp_DVX_Testimonials_Fetch", Connection);
4 cmd.CommandType = CommandType.StoredProcedure;
56 cmd.Parameters.Add(new SqlParameter("@.Cat_ID", iCatID));
7 cmd.Parameters.Add(new SqlParameter("@.LanguageType", sLanguageType));
89 reader = cmd.ExecuteReader();
1011return reader;
12 }

I know this isn't the best way to do this (especially for each page[this site averages about 1000 hits a day]), so I was wondering was--is there a way to maintain a single DB connection that's set up in the Application_Start that will maintain the connection so I don't have to worry about this error. If not, does anyone and any ideas as to what would help?

Thanks in advance!

Well, I don't think you need to do this, as ADO.Net connections are pooled. Usually the best practice would be: open connection -> retrive data -> close it immediately. The underlying managed data provider will help you to decide if "a connection" "really" closes physically..

msdn:

ASqlConnection object represents a unique session to a SQL Server data source

And where dose 'Connection' variable come from in your code? A member of the Page? As SqlConnection is not thread safe, there might be situations when one thread opens it and is ready to read, while another thread just closed it, so error occurs~

|||

The Connection variable is initialized in the constructor of whatever class is using it. Currently, every class initializes its own DB connection. Would this have be bad? :-P

Thanks for the info!

|||

Yes, this would have been bad.

It would be better to have your data access layer maintain the connections. Also, I would tell the datareader to close the connection automatically when the datareader closes, and create/open your connection object from within your DAL.

Although 1000 hits per day is an extremely low traffic site, you really should get in the habit of opening your connection when it's needed, do whatever you need to, then close it as quickly as possible.

|||

Would you happen to know of any resources that show how to maintain connections within the DAL? I'm coming to .Net from a php background and I'm still getting the hang of the structure of everything.

Thanks!

Saturday, February 25, 2012

mail attachment problem

I have an application that does an inventory comparason every night and
emails the descrepancies to the business owners every morning. I am in the
process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
found a problem with the email attachment. The mail that is sent is
generated using SQLMail, with @.attach_results set to true and the @.separator
= ','. When the mail arrives from the 2000 server, and the attachment is
opened, Excel gives an error message that says "This file is not in a
recognizable format." If I detach the file, open it in Notepad, copy and
paste the contents into a new file, change the extention to csv, everything
works. This has been working in 6.5 for 3 years.
Any help will be appreciated.
PaulProbably due to file is in Unicode. Search KB for @.ansi_attachments, and you'll find an article that describes
it all.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
> I have an application that does an inventory comparason every night and
> emails the descrepancies to the business owners every morning. I am in the
> process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
> found a problem with the email attachment. The mail that is sent is
> generated using SQLMail, with @.attach_results set to true and the @.separator
> = ','. When the mail arrives from the 2000 server, and the attachment is
> opened, Excel gives an error message that says "This file is not in a
> recognizable format." If I detach the file, open it in Notepad, copy and
> paste the contents into a new file, change the extention to csv, everything
> works. This has been working in 6.5 for 3 years.
> Any help will be appreciated.
> Paul|||Tibor,
Thanks. That took care of it. I can't believe that I missed that in the KB.
Paul
"Tibor Karaszi" wrote:
> Probably due to file is in Unicode. Search KB for @.ansi_attachments, and you'll find an article that describes
> it all.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
> news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
> > I have an application that does an inventory comparason every night and
> > emails the descrepancies to the business owners every morning. I am in the
> > process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
> > found a problem with the email attachment. The mail that is sent is
> > generated using SQLMail, with @.attach_results set to true and the @.separator
> > = ','. When the mail arrives from the 2000 server, and the attachment is
> > opened, Excel gives an error message that says "This file is not in a
> > recognizable format." If I detach the file, open it in Notepad, copy and
> > paste the contents into a new file, change the extention to csv, everything
> > works. This has been working in 6.5 for 3 years.
> >
> > Any help will be appreciated.
> >
> > Paul
>
>

mail attachment problem

I have an application that does an inventory comparason every night and
emails the descrepancies to the business owners every morning. I am in the
process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
found a problem with the email attachment. The mail that is sent is
generated using SQLMail, with @.attach_results set to true and the @.separator
= ','. When the mail arrives from the 2000 server, and the attachment is
opened, Excel gives an error message that says "This file is not in a
recognizable format." If I detach the file, open it in Notepad, copy and
paste the contents into a new file, change the extention to csv, everything
works. This has been working in 6.5 for 3 years.
Any help will be appreciated.
Paul
Probably due to file is in Unicode. Search KB for @.ansi_attachments, and you'll find an article that describes
it all.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
> I have an application that does an inventory comparason every night and
> emails the descrepancies to the business owners every morning. I am in the
> process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
> found a problem with the email attachment. The mail that is sent is
> generated using SQLMail, with @.attach_results set to true and the @.separator
> = ','. When the mail arrives from the 2000 server, and the attachment is
> opened, Excel gives an error message that says "This file is not in a
> recognizable format." If I detach the file, open it in Notepad, copy and
> paste the contents into a new file, change the extention to csv, everything
> works. This has been working in 6.5 for 3 years.
> Any help will be appreciated.
> Paul
|||Tibor,
Thanks. That took care of it. I can't believe that I missed that in the KB.
Paul
"Tibor Karaszi" wrote:

> Probably due to file is in Unicode. Search KB for @.ansi_attachments, and you'll find an article that describes
> it all.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
> news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
>
>

mail attachment problem

I have an application that does an inventory comparason every night and
emails the descrepancies to the business owners every morning. I am in the
process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
found a problem with the email attachment. The mail that is sent is
generated using SQLMail, with @.attach_results set to true and the @.separator
= ','. When the mail arrives from the 2000 server, and the attachment is
opened, Excel gives an error message that says "This file is not in a
recognizable format." If I detach the file, open it in Notepad, copy and
paste the contents into a new file, change the extention to csv, everything
works. This has been working in 6.5 for 3 years.
Any help will be appreciated.
PaulProbably due to file is in Unicode. Search KB for @.ansi_attachments, and you
'll find an article that describes
it all.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
> I have an application that does an inventory comparason every night and
> emails the descrepancies to the business owners every morning. I am in th
e
> process of upgradeing from SQLServer 6.5 to 2000, and in my testing have
> found a problem with the email attachment. The mail that is sent is
> generated using SQLMail, with @.attach_results set to true and the @.separat
or
> = ','. When the mail arrives from the 2000 server, and the attachment is
> opened, Excel gives an error message that says "This file is not in a
> recognizable format." If I detach the file, open it in Notepad, copy and
> paste the contents into a new file, change the extention to csv, everythin
g
> works. This has been working in 6.5 for 3 years.
> Any help will be appreciated.
> Paul|||Tibor,
Thanks. That took care of it. I can't believe that I missed that in the KB
.
Paul
"Tibor Karaszi" wrote:

> Probably due to file is in Unicode. Search KB for @.ansi_attachments, and y
ou'll find an article that describes
> it all.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Paul Godward" <Paul Godward@.discussions.microsoft.com> wrote in message
> news:531A3234-AD22-4BD8-ABFC-98944473D3FB@.microsoft.com...
>
>

Machine account access

Hi everyone,
I'm trying to access SQL Server from an application that is a service
running under the "Local System" account in a computer which is not the same
as the one running SQL Server. The service must run under this account, and
still should have access to an SQL Server database.
I've given permissions to the computer account in SQL Server, as both
computers are in Active Directory, but the service still does not connect
(due to permissions).
Is it possible to have this scenary running? Any idea on how to make it work
?
Thanks in advance,
Lleonard.Local system does not have access to network resources.
-Sue
On Wed, 27 Jul 2005 09:17:06 -0700, "lleonard"
<lleonard@.discussions.microsoft.com> wrote:

>Hi everyone,
>I'm trying to access SQL Server from an application that is a service
>running under the "Local System" account in a computer which is not the sam
e
>as the one running SQL Server. The service must run under this account, and
>still should have access to an SQL Server database.
>I've given permissions to the computer account in SQL Server, as both
>computers are in Active Directory, but the service still does not connect
>(due to permissions).
>Is it possible to have this scenary running? Any idea on how to make it wor
k?
>Thanks in advance,
>Lleonard.

Mac/Safari - SQL Server Report, Collapse on left side

Hello,

We are using SQL Server Reporting services in our web application. When we view the report on IE/FF it works normally.
But when we view it on Safari on MAC/Windows the report is collapse towards left. It is not taking the width as provided.
When we view the PDF it shows the normal report.

How can this issue be solved ?

Thanks,
Deepesh Verma

Hi,

In Reporting Services, you use a Web browser to view reports and run Report Manager. Not all report functionality is supported by all browsers. The following table describes report functionality restrictions for the supported browsers.

Browser type

DescriptionMicrosoft Internet Explorer 6.0 or 7.0 for Windows, with all service packs applied and scripting enabled.Internet Explorer is recommended if you want to use all the available report functionality. Although you can use other browsers to view a report, Internet Explorer for Windows is the only browser that is guaranteed to support the complete set of features for working with reports.Netscape 7.2, Mozilla 1.7, Firefox 1.0.3, Safari 1.3, and Safari 2.0The following features are not supported in third-party browsers:· Document map· Searching within the report· Zoom· Fixed table headersThe following additional features are not available when viewing reports in Safari:· The Calendar control that is used to select dates on a parameterized report that runs on a report server has been disabled for Safari. Users must type the dates that they want to use.· Image source files that are retrieved from remote computers do not display correctly in Safari.· The client-side print control used for printing HTML reports.

If you are accessing a report server from a Macintosh computer, we recommend that you use Safari. Reporting Services does not support Internet Explorer 5.0 for the Mac.

For details, see
http://msdn2.microsoft.com/en-us/library/ms156511.aspx


Thanks.

|||

Hello,

Thanks.

But any how we want it to work on Sarafi and we did it by putting a transparent image with the width we want to display.

And it worked for us.

Thanks,
Deepesh Verma

MAC support for new Report Designer (Report Builder)

Is the new Report Designer (Report Builder) interface still a Windows click-once application? Or is there any possibility this will work with MACs (if it's not a click-once application)?

We have a lot of potential customers (education) that are looking for MAC support for ad-hoc access.

Yes, Report Builder is still a Windows application. We do not have a HTML or Silverlight version of Report Builder but these are under consideration for a post-2008 release.

MAC support for new Report Designer (Report Builder)

Is the new Report Designer (Report Builder) interface still a Windows click-once application? Or is there any possibility this will work with MACs (if it's not a click-once application)?

We have a lot of potential customers (education) that are looking for MAC support for ad-hoc access.

Yes, Report Builder is still a Windows application. We do not have a HTML or Silverlight version of Report Builder but these are under consideration for a post-2008 release.

Monday, February 20, 2012

LowLlevel Error

We see the below error from time to time as a popup message on the
desktop. The same error appears in the system event log as Source:
Application Popup Event ID: 26. We haven't been able to identify any
specific event which causes it to happen.
Start Error ----
Application popup: Microsoft Visual C++ Runtime Library : Buffer overrun
detected!
Program: C:\PROGRA~1\MICROS~1\MSSQL\binn\sqlservr.exe
A buffer overrun has been detected which has corrupted the program's
internal state. The program cannot safely continue execution and must
now be terminated.
End Error ----
After the message appears, the running sqlservr.exe process is frozen
and clients can no longer access the database. Ending task from the
task manager doesn't even work and we have to reboot the server to get a
functioning SQL server service.
Anyone have ideas? I couldn't find much help with google. We are
running SQL Server 2000 with SP3.
~Jason
--No one has seen this error before? :(
~Jason
--