Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Thursday, March 29, 2012

Database image not displaying

Hi,
In my report I want to dispaly a different image based on the parameter user
enters. For ex., the user enters a company name , then the image for that
company should be displayed.
Now in my database, the images are not stored using the complete path or a
complete URL, but are stored as Logo1.gif , Logo2.gif etc in the field IMAGE.
I have a virtual directory which contains these images.
Now when i create a databse image, an pull from the field IMAGE, the image
is not displayed. how to solve this problem? Is it necessary to install SP1
for this purpose too?
--
pmudYou are actually not using "Database" images here. You are using "External"
images from some webserver. It is just that the image path is dynamically
constructed from a dataset field, right?
In this case, you will need SP1 (or SP2) installed. You would need to set
the image type to "External" and the image value expression to something
like
="http://myserver/vroot/" & Fields!RelativeImagePath.Value
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"pmud" <pmud@.discussions.microsoft.com> wrote in message
news:6B54439E-15CE-4769-A88A-5A58CCD287E4@.microsoft.com...
> Hi,
> In my report I want to dispaly a different image based on the parameter
> user
> enters. For ex., the user enters a company name , then the image for that
> company should be displayed.
> Now in my database, the images are not stored using the complete path or a
> complete URL, but are stored as Logo1.gif , Logo2.gif etc in the field
> IMAGE.
> I have a virtual directory which contains these images.
> Now when i create a databse image, an pull from the field IMAGE, the
> image
> is not displayed. how to solve this problem? Is it necessary to install
> SP1
> for this purpose too?
> --
> pmud|||HI Robert,
I understand now. I will install SP1 & try to do the external images.
Thanks..
--
pmud
"Robert Bruckner [MSFT]" wrote:
> You are actually not using "Database" images here. You are using "External"
> images from some webserver. It is just that the image path is dynamically
> constructed from a dataset field, right?
> In this case, you will need SP1 (or SP2) installed. You would need to set
> the image type to "External" and the image value expression to something
> like
> ="http://myserver/vroot/" & Fields!RelativeImagePath.Value
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "pmud" <pmud@.discussions.microsoft.com> wrote in message
> news:6B54439E-15CE-4769-A88A-5A58CCD287E4@.microsoft.com...
> > Hi,
> >
> > In my report I want to dispaly a different image based on the parameter
> > user
> > enters. For ex., the user enters a company name , then the image for that
> > company should be displayed.
> >
> > Now in my database, the images are not stored using the complete path or a
> > complete URL, but are stored as Logo1.gif , Logo2.gif etc in the field
> > IMAGE.
> > I have a virtual directory which contains these images.
> >
> > Now when i create a databse image, an pull from the field IMAGE, the
> > image
> > is not displayed. how to solve this problem? Is it necessary to install
> > SP1
> > for this purpose too?
> > --
> > pmud
>
>|||Hi Robert,
I installed SP1 and put the image as an external image. All my images are
stored in C:/Inetpub/wwwroot/IMAGES . this folder has 2 subfolders which have
different images. What value should I use for generating the dynamic image
URL? My server name is WEBSERVER and the image field is =Fields!LOGO.Value.
Thanks
--
pmud
"pmud" wrote:
> HI Robert,
> I understand now. I will install SP1 & try to do the external images.
> Thanks..
> --
> pmud
>
> "Robert Bruckner [MSFT]" wrote:
> > You are actually not using "Database" images here. You are using "External"
> > images from some webserver. It is just that the image path is dynamically
> > constructed from a dataset field, right?
> >
> > In this case, you will need SP1 (or SP2) installed. You would need to set
> > the image type to "External" and the image value expression to something
> > like
> > ="http://myserver/vroot/" & Fields!RelativeImagePath.Value
> >
> >
> > -- Robert
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >
> > "pmud" <pmud@.discussions.microsoft.com> wrote in message
> > news:6B54439E-15CE-4769-A88A-5A58CCD287E4@.microsoft.com...
> > > Hi,
> > >
> > > In my report I want to dispaly a different image based on the parameter
> > > user
> > > enters. For ex., the user enters a company name , then the image for that
> > > company should be displayed.
> > >
> > > Now in my database, the images are not stored using the complete path or a
> > > complete URL, but are stored as Logo1.gif , Logo2.gif etc in the field
> > > IMAGE.
> > > I have a virtual directory which contains these images.
> > >
> > > Now when i create a databse image, an pull from the field IMAGE, the
> > > image
> > > is not displayed. how to solve this problem? Is it necessary to install
> > > SP1
> > > for this purpose too?
> > > --
> > > pmud
> >
> >
> >|||Assuming you have a virtual root defined in IIS called "Images", the URL
should be similar to this:
http://WebServer/Images/Subfolder/ImageName.gif
Make sure you can access the images through IE, and then just build the same
URL using an expression for the image reportitem value. For instance
="http://WebServer/Images/Subfolder/" & Fields!LOGO.Value
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"pmud" <pmud@.discussions.microsoft.com> wrote in message
news:CA2277F0-DCEF-479D-BA70-6B9527B50B21@.microsoft.com...
> Hi Robert,
> I installed SP1 and put the image as an external image. All my images are
> stored in C:/Inetpub/wwwroot/IMAGES . this folder has 2 subfolders which
> have
> different images. What value should I use for generating the dynamic image
> URL? My server name is WEBSERVER and the image field is
> =Fields!LOGO.Value.
> Thanks
> --
> pmud
>
> "pmud" wrote:
>> HI Robert,
>> I understand now. I will install SP1 & try to do the external images.
>> Thanks..
>> --
>> pmud
>>
>> "Robert Bruckner [MSFT]" wrote:
>> > You are actually not using "Database" images here. You are using
>> > "External"
>> > images from some webserver. It is just that the image path is
>> > dynamically
>> > constructed from a dataset field, right?
>> >
>> > In this case, you will need SP1 (or SP2) installed. You would need to
>> > set
>> > the image type to "External" and the image value expression to
>> > something
>> > like
>> > ="http://myserver/vroot/" & Fields!RelativeImagePath.Value
>> >
>> >
>> > -- Robert
>> > This posting is provided "AS IS" with no warranties, and confers no
>> > rights.
>> >
>> >
>> > "pmud" <pmud@.discussions.microsoft.com> wrote in message
>> > news:6B54439E-15CE-4769-A88A-5A58CCD287E4@.microsoft.com...
>> > > Hi,
>> > >
>> > > In my report I want to dispaly a different image based on the
>> > > parameter
>> > > user
>> > > enters. For ex., the user enters a company name , then the image for
>> > > that
>> > > company should be displayed.
>> > >
>> > > Now in my database, the images are not stored using the complete path
>> > > or a
>> > > complete URL, but are stored as Logo1.gif , Logo2.gif etc in the
>> > > field
>> > > IMAGE.
>> > > I have a virtual directory which contains these images.
>> > >
>> > > Now when i create a databse image, an pull from the field IMAGE, the
>> > > image
>> > > is not displayed. how to solve this problem? Is it necessary to
>> > > install
>> > > SP1
>> > > for this purpose too?
>> > > --
>> > > pmud
>> >
>> >
>> >

Monday, March 19, 2012

Database Encryption - Employee performance review

Hi,
I am writing an .NET 2.0 app that has different users logging in who
have different access levels in the app. One of the user roles is "HR".
When the user logs in with these credentials, they have a whole heap of
buttons/links/pages related to HR stuff that normal team members don't.
One of the sensitive information that needs to be displayed and more
importantly, stored in the database is the employee performance reviews
(HR access only).
I am wondering how I would go about storing/maintaining this
information as even the DBA's are not supposed to have access to this
information, but should still be able to administer it and/or retrieve
the encryption keys if the HR personnel forget their passwords etc.
The simplest way I can think of is to issue all the HR people with one
password, encrypt the data in the DB layer (in code) and then store it
in a table in the database. This way, anyone with access to the
Database won't necessarily have access to the data. The problem with
this one is that all the HR personnel share one password, which doesn't
seem like a nice (secure) solution.
The other option was to store the encryption key in the database and
encrypt the key itself with the password provided by the individual
user (HR person), which will be stored against that user's record. This
way, whenever a data request is made, the database sends the encrypted
performance review data and the password encrypted key to the user. The
user will then decrypt the key using their password, and then decrypt
the data using the key. This way, if the user ever forgets their
password, all the DBA (and/or App with owner acess) has to do is
reencrypt the key with a new user password and store it against the
user's record. The problem with this is storing the key in the database
and yet restricting access to the DBA. They should not have raw access
to the key (which essentially means they can see the data in the
database), but still should have enough access that if a user forgets
their password, the DBA can reset the password without losing all the
existing data.
I was thinking of storing the key on a key server somewhere with
different access rights etc. but that means the system starts to get
complex.
How would you guys go about building such a system? Does MS Sql Server
2005 provide any mechanisms for such functionality? Plus, as a design
issue, is it better to let the database handle the encryption, key
management, roles/privileges or is it better to do it in the
application itself? One of the advantages I can think of for doing it
in the application is that it gives a bit of database independence, i
can change the underlying database easily without having to rewrite a
whole heap of functionality. The other reason is that this way, i won't
have unencrypted data or keys on wire.
Looking forward to some expert opinions and discussions regarding this
problem.
Thanks in advance.Hello? Anyone? Surely this is not such a hard problem, or particularly
unusual. I would guess there are many times when you would want to
encrypt the data in a database, so as to make it inaccessible to the
DBA's, but still give them some administrative privileges. One of the
constraints is that the user with access to the data doesn't
necessarily "own" the data, so that if they forget the password (i.e
lose the encryption key), all the data is not lost.
On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
> Hi,
> I am writing an .NET 2.0 app that has different users logging in who
> have different access levels in the app. One of the user roles is "HR".
> When the user logs in with these credentials, they have a whole heap of
> buttons/links/pages related to HR stuff that normal team members don't.
> One of the sensitive information that needs to be displayed and more
> importantly, stored in the database is the employee performance reviews
> (HR access only).
> I am wondering how I would go about storing/maintaining this
> information as even the DBA's are not supposed to have access to this
> information, but should still be able to administer it and/or retrieve
> the encryption keys if the HR personnel forget their passwords etc.
> The simplest way I can think of is to issue all the HR people with one
> password, encrypt the data in the DB layer (in code) and then store it
> in a table in the database. This way, anyone with access to the
> Database won't necessarily have access to the data. The problem with
> this one is that all the HR personnel share one password, which doesn't
> seem like a nice (secure) solution.
> The other option was to store the encryption key in the database and
> encrypt the key itself with the password provided by the individual
> user (HR person), which will be stored against that user's record. This
> way, whenever a data request is made, the database sends the encrypted
> performance review data and the password encrypted key to the user. The
> user will then decrypt the key using their password, and then decrypt
> the data using the key. This way, if the user ever forgets their
> password, all the DBA (and/or App with owner acess) has to do is
> reencrypt the key with a new user password and store it against the
> user's record. The problem with this is storing the key in the database
> and yet restricting access to the DBA. They should not have raw access
> to the key (which essentially means they can see the data in the
> database), but still should have enough access that if a user forgets
> their password, the DBA can reset the password without losing all the
> existing data.
> I was thinking of storing the key on a key server somewhere with
> different access rights etc. but that means the system starts to get
> complex.
> How would you guys go about building such a system? Does MS Sql Server
> 2005 provide any mechanisms for such functionality? Plus, as a design
> issue, is it better to let the database handle the encryption, key
> management, roles/privileges or is it better to do it in the
> application itself? One of the advantages I can think of for doing it
> in the application is that it gives a bit of database independence, i
> can change the underlying database easily without having to rewrite a
> whole heap of functionality. The other reason is that this way, i won't
> have unencrypted data or keys on wire.
> Looking forward to some expert opinions and discussions regarding this
> problem.
> Thanks in advance.|||The key (ahem) here is this:
>> Whoever has access to the decryption key has access to the data. <<
Plain and simple. If the DBAs can read the decryption key, they can
read the data. So the statement "but should still be able to administer
it and/or retrieve the encryption keys if the HR personnel forget their
passwords etc." is what I call a "non-starter". By definition, the DBAs
have access to the data.
You're right on one point though. If all people share access to the
same password or decryption key, you have an insecure solution. Think
of it this way -- the bigger the "secret" is, and the more people who
have access to that secret, the less secure the system.
Encrypting the key doesn't work either because you have to encrypt the
key with another key. Where are you going to put that key? Are the
DBAs going to have access to it too?
Here's my take on it:
Carefully analyze what is and what is not a secret in the system. Only
encrypt the real secrets. Limit the access to the database to the
smallest set of people possible. If you don't want the DBAs to have
access to the encryption key, that by definition means you have to store
the key outside the database. I recommend that you use .NET's
encryption routines to encrypt your secrets *outside* of the database,
and simply store the data in the system once it's encrypted.
So it boils down to this. SOMEBODY needs access to the keys. They need
to exist somewhere (even if it's not on your SQL Server). The
administrator of that machine will probably be able to read the key.
Deny that person read access to the database. That person needs to be
trustworthy, too. If he/she is not, they can share the key with an
untrustworthy DBA and get your data by writing a small program.
HTH
-Dave
nyathancha@.hotmail.com wrote:
> Hello? Anyone? Surely this is not such a hard problem, or particularly
> unusual. I would guess there are many times when you would want to
> encrypt the data in a database, so as to make it inaccessible to the
> DBA's, but still give them some administrative privileges. One of the
> constraints is that the user with access to the data doesn't
> necessarily "own" the data, so that if they forget the password (i.e
> lose the encryption key), all the data is not lost.
>
>
>
> On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
>> Hi,
>> I am writing an .NET 2.0 app that has different users logging in who
>> have different access levels in the app. One of the user roles is "HR".
>> When the user logs in with these credentials, they have a whole heap of
>> buttons/links/pages related to HR stuff that normal team members don't.
>> One of the sensitive information that needs to be displayed and more
>> importantly, stored in the database is the employee performance reviews
>> (HR access only).
>> I am wondering how I would go about storing/maintaining this
>> information as even the DBA's are not supposed to have access to this
>> information, but should still be able to administer it and/or retrieve
>> the encryption keys if the HR personnel forget their passwords etc.
>> The simplest way I can think of is to issue all the HR people with one
>> password, encrypt the data in the DB layer (in code) and then store it
>> in a table in the database. This way, anyone with access to the
>> Database won't necessarily have access to the data. The problem with
>> this one is that all the HR personnel share one password, which doesn't
>> seem like a nice (secure) solution.
>> The other option was to store the encryption key in the database and
>> encrypt the key itself with the password provided by the individual
>> user (HR person), which will be stored against that user's record. This
>> way, whenever a data request is made, the database sends the encrypted
>> performance review data and the password encrypted key to the user. The
>> user will then decrypt the key using their password, and then decrypt
>> the data using the key. This way, if the user ever forgets their
>> password, all the DBA (and/or App with owner acess) has to do is
>> reencrypt the key with a new user password and store it against the
>> user's record. The problem with this is storing the key in the database
>> and yet restricting access to the DBA. They should not have raw access
>> to the key (which essentially means they can see the data in the
>> database), but still should have enough access that if a user forgets
>> their password, the DBA can reset the password without losing all the
>> existing data.
>> I was thinking of storing the key on a key server somewhere with
>> different access rights etc. but that means the system starts to get
>> complex.
>> How would you guys go about building such a system? Does MS Sql Server
>> 2005 provide any mechanisms for such functionality? Plus, as a design
>> issue, is it better to let the database handle the encryption, key
>> management, roles/privileges or is it better to do it in the
>> application itself? One of the advantages I can think of for doing it
>> in the application is that it gives a bit of database independence, i
>> can change the underlying database easily without having to rewrite a
>> whole heap of functionality. The other reason is that this way, i won't
>> have unencrypted data or keys on wire.
>> Looking forward to some expert opinions and discussions regarding this
>> problem.
>> Thanks in advance.
>
-Dave Markle
http://www.markleconsulting.com/blog|||Hi Dave, Thanks for the reply.
I was thinking along the same lines as well. I couldn't think of anyway
of storing the key in the database and still restricting access to the
DBA. Which is why I mentioned in my original post the "key server
somewhere with
different access rights" . Unless sql server has some magic
features/functionality that I don't know about.
So how hard would it be to build/deploy a key server? Maybe this is
more of an ecryption/security question rather than a database question.
My idea of encrypting the key with another key was that the second
"key" would be the user's password. This way the DBA doesn't have
access to the original data encryption key even if its stored in the
database (because it can only be decrypted using the user's password),
but if the user does forget their password, the data is not lost
because it wasn't encrypted with their password(/key). The DBA can
"reset" their password by reencrypting the orginal data key with a new
user password key and storing it against the column. Which is where I
came to the key server. The fact that the DBA should be able to get the
data key encrypted with a user password, but not the raw data key
itself. I can't think of anyway of doing this without an independent
application.
Does anyone know any commercial encryption key storage and distribution
solutions/products?
I am sure at some stage the data encryption key will itself have to be
encrypted before being put on the wire. Other wise you would have the
encrypted data coming from the database, the plain encryption key
coming from the key server. Doesn't seem particularly secure.
What is the general industry solution to a situation like this, where
you want to store sensitive data in a database, but the data is
accessible (i.e belongs to) to more than one person (so that if that
one person forgets their password/key, the data itself is not lost)
On Jan 25, 1:28 pm, Dave Markle <"dma[remove_ZZ]ZZrkle"@.gmail.dot.com>
wrote:
> The key (ahem) here is this:
> >> Whoever has access to the decryption key has access to the data. <<
> Plain and simple. If the DBAs can read the decryption key, they can
> read the data. So the statement "but should still be able to administer
> it and/or retrieve the encryption keys if the HR personnel forget their
> passwords etc." is what I call a "non-starter". By definition, the DBAs
> have access to the data.
> You're right on one point though. If all people share access to the
> same password or decryption key, you have an insecure solution. Think
> of it this way -- the bigger the "secret" is, and the more people who
> have access to that secret, the less secure the system.
> Encrypting the key doesn't work either because you have to encrypt the
> key with another key. Where are you going to put that key? Are the
> DBAs going to have access to it too?
> Here's my take on it:
> Carefully analyze what is and what is not a secret in the system. Only
> encrypt the real secrets. Limit the access to the database to the
> smallest set of people possible. If you don't want the DBAs to have
> access to the encryption key, that by definition means you have to store
> the key outside the database. I recommend that you use .NET's
> encryption routines to encrypt your secrets *outside* of the database,
> and simply store the data in the system once it's encrypted.
> So it boils down to this. SOMEBODY needs access to the keys. They need
> to exist somewhere (even if it's not on your SQL Server). The
> administrator of that machine will probably be able to read the key.
> Deny that person read access to the database. That person needs to be
> trustworthy, too. If he/she is not, they can share the key with an
> untrustworthy DBA and get your data by writing a small program.
> HTH
> -Dave
>
> nyathan...@.hotmail.com wrote:
> > Hello? Anyone? Surely this is not such a hard problem, or particularly
> > unusual. I would guess there are many times when you would want to
> > encrypt the data in a database, so as to make it inaccessible to the
> > DBA's, but still give them some administrative privileges. One of the
> > constraints is that the user with access to the data doesn't
> > necessarily "own" the data, so that if they forget the password (i.e
> > lose the encryption key), all the data is not lost.
> > On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
> >> Hi,
> >> I am writing an .NET 2.0 app that has different users logging in who
> >> have different access levels in the app. One of the user roles is "HR".
> >> When the user logs in with these credentials, they have a whole heap of
> >> buttons/links/pages related to HR stuff that normal team members don't.
> >> One of the sensitive information that needs to be displayed and more
> >> importantly, stored in the database is the employee performance reviews
> >> (HR access only).
> >> I am wondering how I would go about storing/maintaining this
> >> information as even the DBA's are not supposed to have access to this
> >> information, but should still be able to administer it and/or retrieve
> >> the encryption keys if the HR personnel forget their passwords etc.
> >> The simplest way I can think of is to issue all the HR people with one
> >> password, encrypt the data in the DB layer (in code) and then store it
> >> in a table in the database. This way, anyone with access to the
> >> Database won't necessarily have access to the data. The problem with
> >> this one is that all the HR personnel share one password, which doesn't
> >> seem like a nice (secure) solution.
> >> The other option was to store the encryption key in the database and
> >> encrypt the key itself with the password provided by the individual
> >> user (HR person), which will be stored against that user's record. This
> >> way, whenever a data request is made, the database sends the encrypted
> >> performance review data and the password encrypted key to the user. The
> >> user will then decrypt the key using their password, and then decrypt
> >> the data using the key. This way, if the user ever forgets their
> >> password, all the DBA (and/or App with owner acess) has to do is
> >> reencrypt the key with a new user password and store it against the
> >> user's record. The problem with this is storing the key in the database
> >> and yet restricting access to the DBA. They should not have raw access
> >> to the key (which essentially means they can see the data in the
> >> database), but still should have enough access that if a user forgets
> >> their password, the DBA can reset the password without losing all the
> >> existing data.
> >> I was thinking of storing the key on a key server somewhere with
> >> different access rights etc. but that means the system starts to get
> >> complex.
> >> How would you guys go about building such a system? Does MS Sql Server
> >> 2005 provide any mechanisms for such functionality? Plus, as a design
> >> issue, is it better to let the database handle the encryption, key
> >> management, roles/privileges or is it better to do it in the
> >> application itself? One of the advantages I can think of for doing it
> >> in the application is that it gives a bit of database independence, i
> >> can change the underlying database easily without having to rewrite a
> >> whole heap of functionality. The other reason is that this way, i won't
> >> have unencrypted data or keys on wire.
> >> Looking forward to some expert opinions and discussions regarding this
> >> problem.
> >> Thanks in advance.--
> -Dave Markle
> http://www.markleconsulting.com/blog

Database Encryption - Employee performance review

Hi,
I am writing an .NET 2.0 app that has different users logging in who
have different access levels in the app. One of the user roles is "HR".
When the user logs in with these credentials, they have a whole heap of
buttons/links/pages related to HR stuff that normal team members don't.
One of the sensitive information that needs to be displayed and more
importantly, stored in the database is the employee performance reviews
(HR access only).
I am wondering how I would go about storing/maintaining this
information as even the DBA's are not supposed to have access to this
information, but should still be able to administer it and/or retrieve
the encryption keys if the HR personnel forget their passwords etc.
The simplest way I can think of is to issue all the HR people with one
password, encrypt the data in the DB layer (in code) and then store it
in a table in the database. This way, anyone with access to the
Database won't necessarily have access to the data. The problem with
this one is that all the HR personnel share one password, which doesn't
seem like a nice (secure) solution.
The other option was to store the encryption key in the database and
encrypt the key itself with the password provided by the individual
user (HR person), which will be stored against that user's record. This
way, whenever a data request is made, the database sends the encrypted
performance review data and the password encrypted key to the user. The
user will then decrypt the key using their password, and then decrypt
the data using the key. This way, if the user ever forgets their
password, all the DBA (and/or App with owner acess) has to do is
reencrypt the key with a new user password and store it against the
user's record. The problem with this is storing the key in the database
and yet restricting access to the DBA. They should not have raw access
to the key (which essentially means they can see the data in the
database), but still should have enough access that if a user forgets
their password, the DBA can reset the password without losing all the
existing data.
I was thinking of storing the key on a key server somewhere with
different access rights etc. but that means the system starts to get
complex.
How would you guys go about building such a system? Does MS Sql Server
2005 provide any mechanisms for such functionality? Plus, as a design
issue, is it better to let the database handle the encryption, key
management, roles/privileges or is it better to do it in the
application itself? One of the advantages I can think of for doing it
in the application is that it gives a bit of database independence, i
can change the underlying database easily without having to rewrite a
whole heap of functionality. The other reason is that this way, i won't
have unencrypted data or keys on wire.
Looking forward to some expert opinions and discussions regarding this
problem.
Thanks in advance.
Hello? Anyone? Surely this is not such a hard problem, or particularly
unusual. I would guess there are many times when you would want to
encrypt the data in a database, so as to make it inaccessible to the
DBA's, but still give them some administrative privileges. One of the
constraints is that the user with access to the data doesn't
necessarily "own" the data, so that if they forget the password (i.e
lose the encryption key), all the data is not lost.
On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
> Hi,
> I am writing an .NET 2.0 app that has different users logging in who
> have different access levels in the app. One of the user roles is "HR".
> When the user logs in with these credentials, they have a whole heap of
> buttons/links/pages related to HR stuff that normal team members don't.
> One of the sensitive information that needs to be displayed and more
> importantly, stored in the database is the employee performance reviews
> (HR access only).
> I am wondering how I would go about storing/maintaining this
> information as even the DBA's are not supposed to have access to this
> information, but should still be able to administer it and/or retrieve
> the encryption keys if the HR personnel forget their passwords etc.
> The simplest way I can think of is to issue all the HR people with one
> password, encrypt the data in the DB layer (in code) and then store it
> in a table in the database. This way, anyone with access to the
> Database won't necessarily have access to the data. The problem with
> this one is that all the HR personnel share one password, which doesn't
> seem like a nice (secure) solution.
> The other option was to store the encryption key in the database and
> encrypt the key itself with the password provided by the individual
> user (HR person), which will be stored against that user's record. This
> way, whenever a data request is made, the database sends the encrypted
> performance review data and the password encrypted key to the user. The
> user will then decrypt the key using their password, and then decrypt
> the data using the key. This way, if the user ever forgets their
> password, all the DBA (and/or App with owner acess) has to do is
> reencrypt the key with a new user password and store it against the
> user's record. The problem with this is storing the key in the database
> and yet restricting access to the DBA. They should not have raw access
> to the key (which essentially means they can see the data in the
> database), but still should have enough access that if a user forgets
> their password, the DBA can reset the password without losing all the
> existing data.
> I was thinking of storing the key on a key server somewhere with
> different access rights etc. but that means the system starts to get
> complex.
> How would you guys go about building such a system? Does MS Sql Server
> 2005 provide any mechanisms for such functionality? Plus, as a design
> issue, is it better to let the database handle the encryption, key
> management, roles/privileges or is it better to do it in the
> application itself? One of the advantages I can think of for doing it
> in the application is that it gives a bit of database independence, i
> can change the underlying database easily without having to rewrite a
> whole heap of functionality. The other reason is that this way, i won't
> have unencrypted data or keys on wire.
> Looking forward to some expert opinions and discussions regarding this
> problem.
> Thanks in advance.
|||The key (ahem) here is this:
[vbcol=seagreen]
Plain and simple. If the DBAs can read the decryption key, they can
read the data. So the statement "but should still be able to administer
it and/or retrieve the encryption keys if the HR personnel forget their
passwords etc." is what I call a "non-starter". By definition, the DBAs
have access to the data.
You're right on one point though. If all people share access to the
same password or decryption key, you have an insecure solution. Think
of it this way -- the bigger the "secret" is, and the more people who
have access to that secret, the less secure the system.
Encrypting the key doesn't work either because you have to encrypt the
key with another key. Where are you going to put that key? Are the
DBAs going to have access to it too?
Here's my take on it:
Carefully analyze what is and what is not a secret in the system. Only
encrypt the real secrets. Limit the access to the database to the
smallest set of people possible. If you don't want the DBAs to have
access to the encryption key, that by definition means you have to store
the key outside the database. I recommend that you use .NET's
encryption routines to encrypt your secrets *outside* of the database,
and simply store the data in the system once it's encrypted.
So it boils down to this. SOMEBODY needs access to the keys. They need
to exist somewhere (even if it's not on your SQL Server). The
administrator of that machine will probably be able to read the key.
Deny that person read access to the database. That person needs to be
trustworthy, too. If he/she is not, they can share the key with an
untrustworthy DBA and get your data by writing a small program.
HTH
-Dave
nyathancha@.hotmail.com wrote:
> Hello? Anyone? Surely this is not such a hard problem, or particularly
> unusual. I would guess there are many times when you would want to
> encrypt the data in a database, so as to make it inaccessible to the
> DBA's, but still give them some administrative privileges. One of the
> constraints is that the user with access to the data doesn't
> necessarily "own" the data, so that if they forget the password (i.e
> lose the encryption key), all the data is not lost.
>
>
>
> On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
>
-Dave Markle
http://www.markleconsulting.com/blog
|||Hi Dave, Thanks for the reply.
I was thinking along the same lines as well. I couldn't think of anyway
of storing the key in the database and still restricting access to the
DBA. Which is why I mentioned in my original post the "key server
somewhere with
different access rights" . Unless sql server has some magic
features/functionality that I don't know about.
So how hard would it be to build/deploy a key server? Maybe this is
more of an ecryption/security question rather than a database question.
My idea of encrypting the key with another key was that the second
"key" would be the user's password. This way the DBA doesn't have
access to the original data encryption key even if its stored in the
database (because it can only be decrypted using the user's password),
but if the user does forget their password, the data is not lost
because it wasn't encrypted with their password(/key). The DBA can
"reset" their password by reencrypting the orginal data key with a new
user password key and storing it against the column. Which is where I
came to the key server. The fact that the DBA should be able to get the
data key encrypted with a user password, but not the raw data key
itself. I can't think of anyway of doing this without an independent
application.
Does anyone know any commercial encryption key storage and distribution
solutions/products?
I am sure at some stage the data encryption key will itself have to be
encrypted before being put on the wire. Other wise you would have the
encrypted data coming from the database, the plain encryption key
coming from the key server. Doesn't seem particularly secure.
What is the general industry solution to a situation like this, where
you want to store sensitive data in a database, but the data is
accessible (i.e belongs to) to more than one person (so that if that
one person forgets their password/key, the data itself is not lost)
On Jan 25, 1:28 pm, Dave Markle <"dma[remove_ZZ]ZZrkle"@.gmail.dot.com>
wrote:
> The key (ahem) here is this:
>
> Plain and simple. If the DBAs can read the decryption key, they can
> read the data. So the statement "but should still be able to administer
> it and/or retrieve the encryption keys if the HR personnel forget their
> passwords etc." is what I call a "non-starter". By definition, the DBAs
> have access to the data.
> You're right on one point though. If all people share access to the
> same password or decryption key, you have an insecure solution. Think
> of it this way -- the bigger the "secret" is, and the more people who
> have access to that secret, the less secure the system.
> Encrypting the key doesn't work either because you have to encrypt the
> key with another key. Where are you going to put that key? Are the
> DBAs going to have access to it too?
> Here's my take on it:
> Carefully analyze what is and what is not a secret in the system. Only
> encrypt the real secrets. Limit the access to the database to the
> smallest set of people possible. If you don't want the DBAs to have
> access to the encryption key, that by definition means you have to store
> the key outside the database. I recommend that you use .NET's
> encryption routines to encrypt your secrets *outside* of the database,
> and simply store the data in the system once it's encrypted.
> So it boils down to this. SOMEBODY needs access to the keys. They need
> to exist somewhere (even if it's not on your SQL Server). The
> administrator of that machine will probably be able to read the key.
> Deny that person read access to the database. That person needs to be
> trustworthy, too. If he/she is not, they can share the key with an
> untrustworthy DBA and get your data by writing a small program.
> HTH
> -Dave
>
> nyathan...@.hotmail.com wrote:
>
>
>
>
> -Dave Markle
> http://www.markleconsulting.com/blog

Database Encryption - Employee performance review

Hi,
I am writing an .NET 2.0 app that has different users logging in who
have different access levels in the app. One of the user roles is "HR".
When the user logs in with these credentials, they have a whole heap of
buttons/links/pages related to HR stuff that normal team members don't.
One of the sensitive information that needs to be displayed and more
importantly, stored in the database is the employee performance reviews
(HR access only).
I am wondering how I would go about storing/maintaining this
information as even the DBA's are not supposed to have access to this
information, but should still be able to administer it and/or retrieve
the encryption keys if the HR personnel forget their passwords etc.
The simplest way I can think of is to issue all the HR people with one
password, encrypt the data in the DB layer (in code) and then store it
in a table in the database. This way, anyone with access to the
Database won't necessarily have access to the data. The problem with
this one is that all the HR personnel share one password, which doesn't
seem like a nice (secure) solution.
The other option was to store the encryption key in the database and
encrypt the key itself with the password provided by the individual
user (HR person), which will be stored against that user's record. This
way, whenever a data request is made, the database sends the encrypted
performance review data and the password encrypted key to the user. The
user will then decrypt the key using their password, and then decrypt
the data using the key. This way, if the user ever forgets their
password, all the DBA (and/or App with owner acess) has to do is
reencrypt the key with a new user password and store it against the
user's record. The problem with this is storing the key in the database
and yet restricting access to the DBA. They should not have raw access
to the key (which essentially means they can see the data in the
database), but still should have enough access that if a user forgets
their password, the DBA can reset the password without losing all the
existing data.
I was thinking of storing the key on a key server somewhere with
different access rights etc. but that means the system starts to get
complex.
How would you guys go about building such a system? Does MS Sql Server
2005 provide any mechanisms for such functionality? Plus, as a design
issue, is it better to let the database handle the encryption, key
management, roles/privileges or is it better to do it in the
application itself? One of the advantages I can think of for doing it
in the application is that it gives a bit of database independence, i
can change the underlying database easily without having to rewrite a
whole heap of functionality. The other reason is that this way, i won't
have unencrypted data or keys on wire.
Looking forward to some expert opinions and discussions regarding this
problem.
Thanks in advance.Hello? Anyone? Surely this is not such a hard problem, or particularly
unusual. I would guess there are many times when you would want to
encrypt the data in a database, so as to make it inaccessible to the
DBA's, but still give them some administrative privileges. One of the
constraints is that the user with access to the data doesn't
necessarily "own" the data, so that if they forget the password (i.e
lose the encryption key), all the data is not lost.
On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
> Hi,
> I am writing an .NET 2.0 app that has different users logging in who
> have different access levels in the app. One of the user roles is "HR".
> When the user logs in with these credentials, they have a whole heap of
> buttons/links/pages related to HR stuff that normal team members don't.
> One of the sensitive information that needs to be displayed and more
> importantly, stored in the database is the employee performance reviews
> (HR access only).
> I am wondering how I would go about storing/maintaining this
> information as even the DBA's are not supposed to have access to this
> information, but should still be able to administer it and/or retrieve
> the encryption keys if the HR personnel forget their passwords etc.
> The simplest way I can think of is to issue all the HR people with one
> password, encrypt the data in the DB layer (in code) and then store it
> in a table in the database. This way, anyone with access to the
> Database won't necessarily have access to the data. The problem with
> this one is that all the HR personnel share one password, which doesn't
> seem like a nice (secure) solution.
> The other option was to store the encryption key in the database and
> encrypt the key itself with the password provided by the individual
> user (HR person), which will be stored against that user's record. This
> way, whenever a data request is made, the database sends the encrypted
> performance review data and the password encrypted key to the user. The
> user will then decrypt the key using their password, and then decrypt
> the data using the key. This way, if the user ever forgets their
> password, all the DBA (and/or App with owner acess) has to do is
> reencrypt the key with a new user password and store it against the
> user's record. The problem with this is storing the key in the database
> and yet restricting access to the DBA. They should not have raw access
> to the key (which essentially means they can see the data in the
> database), but still should have enough access that if a user forgets
> their password, the DBA can reset the password without losing all the
> existing data.
> I was thinking of storing the key on a key server somewhere with
> different access rights etc. but that means the system starts to get
> complex.
> How would you guys go about building such a system? Does MS Sql Server
> 2005 provide any mechanisms for such functionality? Plus, as a design
> issue, is it better to let the database handle the encryption, key
> management, roles/privileges or is it better to do it in the
> application itself? One of the advantages I can think of for doing it
> in the application is that it gives a bit of database independence, i
> can change the underlying database easily without having to rewrite a
> whole heap of functionality. The other reason is that this way, i won't
> have unencrypted data or keys on wire.
> Looking forward to some expert opinions and discussions regarding this
> problem.
> Thanks in advance.|||The key (ahem) here is this:

Plain and simple. If the DBAs can read the decryption key, they can
read the data. So the statement "but should still be able to administer
it and/or retrieve the encryption keys if the HR personnel forget their
passwords etc." is what I call a "non-starter". By definition, the DBAs
have access to the data.
You're right on one point though. If all people share access to the
same password or decryption key, you have an insecure solution. Think
of it this way -- the bigger the "secret" is, and the more people who
have access to that secret, the less secure the system.
Encrypting the key doesn't work either because you have to encrypt the
key with another key. Where are you going to put that key? Are the
DBAs going to have access to it too?
Here's my take on it:
Carefully analyze what is and what is not a secret in the system. Only
encrypt the real secrets. Limit the access to the database to the
smallest set of people possible. If you don't want the DBAs to have
access to the encryption key, that by definition means you have to store
the key outside the database. I recommend that you use .NET's
encryption routines to encrypt your secrets *outside* of the database,
and simply store the data in the system once it's encrypted.
So it boils down to this. SOMEBODY needs access to the keys. They need
to exist somewhere (even if it's not on your SQL Server). The
administrator of that machine will probably be able to read the key.
Deny that person read access to the database. That person needs to be
trustworthy, too. If he/she is not, they can share the key with an
untrustworthy DBA and get your data by writing a small program.
HTH
-Dave
nyathancha@.hotmail.com wrote:[vbcol=seagreen]
> Hello? Anyone? Surely this is not such a hard problem, or particularly
> unusual. I would guess there are many times when you would want to
> encrypt the data in a database, so as to make it inaccessible to the
> DBA's, but still give them some administrative privileges. One of the
> constraints is that the user with access to the data doesn't
> necessarily "own" the data, so that if they forget the password (i.e
> lose the encryption key), all the data is not lost.
>
>
>
> On Jan 22, 6:37 pm, nyathan...@.hotmail.com wrote:
>
-Dave Markle
http://www.markleconsulting.com/blog|||Hi Dave, Thanks for the reply.
I was thinking along the same lines as well. I couldn't think of anyway
of storing the key in the database and still restricting access to the
DBA. Which is why I mentioned in my original post the "key server
somewhere with
different access rights" . Unless sql server has some magic
features/functionality that I don't know about.
So how hard would it be to build/deploy a key server? Maybe this is
more of an ecryption/security question rather than a database question.
My idea of encrypting the key with another key was that the second
"key" would be the user's password. This way the DBA doesn't have
access to the original data encryption key even if its stored in the
database (because it can only be decrypted using the user's password),
but if the user does forget their password, the data is not lost
because it wasn't encrypted with their password(/key). The DBA can
"reset" their password by reencrypting the orginal data key with a new
user password key and storing it against the column. Which is where I
came to the key server. The fact that the DBA should be able to get the
data key encrypted with a user password, but not the raw data key
itself. I can't think of anyway of doing this without an independent
application.
Does anyone know any commercial encryption key storage and distribution
solutions/products?
I am sure at some stage the data encryption key will itself have to be
encrypted before being put on the wire. Other wise you would have the
encrypted data coming from the database, the plain encryption key
coming from the key server. Doesn't seem particularly secure.
What is the general industry solution to a situation like this, where
you want to store sensitive data in a database, but the data is
accessible (i.e belongs to) to more than one person (so that if that
one person forgets their password/key, the data itself is not lost)
On Jan 25, 1:28 pm, Dave Markle <"dma[remove_ZZ]ZZrkle"@.gmail.dot.com>
wrote:
> The key (ahem) here is this:
>
> Plain and simple. If the DBAs can read the decryption key, they can
> read the data. So the statement "but should still be able to administer
> it and/or retrieve the encryption keys if the HR personnel forget their
> passwords etc." is what I call a "non-starter". By definition, the DBAs
> have access to the data.
> You're right on one point though. If all people share access to the
> same password or decryption key, you have an insecure solution. Think
> of it this way -- the bigger the "secret" is, and the more people who
> have access to that secret, the less secure the system.
> Encrypting the key doesn't work either because you have to encrypt the
> key with another key. Where are you going to put that key? Are the
> DBAs going to have access to it too?
> Here's my take on it:
> Carefully analyze what is and what is not a secret in the system. Only
> encrypt the real secrets. Limit the access to the database to the
> smallest set of people possible. If you don't want the DBAs to have
> access to the encryption key, that by definition means you have to store
> the key outside the database. I recommend that you use .NET's
> encryption routines to encrypt your secrets *outside* of the database,
> and simply store the data in the system once it's encrypted.
> So it boils down to this. SOMEBODY needs access to the keys. They need
> to exist somewhere (even if it's not on your SQL Server). The
> administrator of that machine will probably be able to read the key.
> Deny that person read access to the database. That person needs to be
> trustworthy, too. If he/she is not, they can share the key with an
> untrustworthy DBA and get your data by writing a small program.
> HTH
> -Dave
>
> nyathan...@.hotmail.com wrote:
>
>
>
>
>
>
>
>
> -Dave Markle
> http://www.markleconsulting.com/blog

Wednesday, March 7, 2012

Database Diagram

What is the minimum level of permission needed by a user
to create a database diagram. A user need the capability
and I don't want to give him dbo permission.You can find the stored procedure permissions needed in the
following article:
FIX: You Cannot Create Diagrams in SQL Enterprise Manager If
You Are Not a Database Owner
http://support.microsoft.com/?id=327145
-Sue
On Thu, 14 Oct 2004 13:22:02 -0700, "Obaid"
<anonymous@.discussions.microsoft.com> wrote:

>What is the minimum level of permission needed by a user
>to create a database diagram. A user need the capability
>and I don't want to give him dbo permission.|||Thanks.
Obaid.
>--Original Message--
>You can find the stored procedure permissions needed in
the
>following article:
>FIX: You Cannot Create Diagrams in SQL Enterprise Manager
If
>You Are Not a Database Owner
>http://support.microsoft.com/?id=327145
>-Sue
>On Thu, 14 Oct 2004 13:22:02 -0700, "Obaid"
><anonymous@.discussions.microsoft.com> wrote:
>
>.
>

Database Design setup

I have an application that lets users upload pictures. These pictures are
stored in different folders depending on the user ID (of the user that it
belongs to). The path can be figured out dynamically by knowing the user
ID. However, the programmer that's coding my application has decided to
save the full path into the database.
Upside that I see is, if there's a huge load of traffic I can see how it may
be good for performance, since you don't need to dynamically figure out the
path.
The downside though, is that this leads to database bloat, and I'm not sure
if that will cause the database performance to decrease. Also, whenever the
system path is updated, a script needs to go through the database and update
everything to reflect the new path.
So, if you can give me your input on this, I'd greatly appreciate it. Is
this a good, or bad way of designing a database?Sounds like you only need to store the full path once per user. It seems
sensible to put the path in a Users table in your database. Storing the full
path against every picture would be inefficient and also may be inconvenient
if you ever need to change the file location.
--
David Portas
SQL Server MVP
--|||I agree with David, Save the directory in the User row... If you figure our
the path on the fly based on the userid, your are locked into the file
location. If you simply store it in the database, you can change it very
easily.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Shabam" <blislecp@.hotmail.com> wrote in message
news:G5Gdnfwf89eRJsvcRVn-ow@.adelphia.com...
> I have an application that lets users upload pictures. These pictures are
> stored in different folders depending on the user ID (of the user that it
> belongs to). The path can be figured out dynamically by knowing the user
> ID. However, the programmer that's coding my application has decided to
> save the full path into the database.
> Upside that I see is, if there's a huge load of traffic I can see how it
may
> be good for performance, since you don't need to dynamically figure out
the
> path.
> The downside though, is that this leads to database bloat, and I'm not
sure
> if that will cause the database performance to decrease. Also, whenever
the
> system path is updated, a script needs to go through the database and
update
> everything to reflect the new path.
> So, if you can give me your input on this, I'd greatly appreciate it. Is
> this a good, or bad way of designing a database?
>
>|||"Shabam" <blislecp@.hotmail.com> wrote in message
news:G5Gdnfwf89eRJsvcRVn-ow@.adelphia.com...
> Upside that I see is, if there's a huge load of traffic I can see how it
may
> be good for performance, since you don't need to dynamically figure out
the
> path.
Two good rules of thumb: 1) Don't duplicate, and 2) Premature optimization
is the root of all evil.
Make it work right, then make it work fast (or small). It's surprising how
infrequently the second step is required.|||> Two good rules of thumb: 1) Don't duplicate, and 2) Premature optimization
> is the root of all evil.
> Make it work right, then make it work fast (or small). It's surprising how
> infrequently the second step is required.
I've heard different schools of thought though. One says that hardcoding
the path makes it quicker because #1, there's no need for an additional
query to get the path variables, and #2, there's no additional processing
needed to put it all together. And if an update were ever needed all I need
is one query to update them all.
However, it does add to the database bloat. Does that affect performance?|||> However, it does add to the database bloat. Does that affect performance?
Yes, which is why your argument doesn't make much sense.
--
David Portas
SQL Server MVP
--|||> Yes, which is why your argument doesn't make much sense.
Can you show me an article that talks about this downside?

Database Design setup

I have an application that lets users upload pictures. These pictures are
stored in different folders depending on the user ID (of the user that it
belongs to). The path can be figured out dynamically by knowing the user
ID. However, the programmer that's coding my application has decided to
save the full path into the database.
Upside that I see is, if there's a huge load of traffic I can see how it may
be good for performance, since you don't need to dynamically figure out the
path.
The downside though, is that this leads to database bloat, and I'm not sure
if that will cause the database performance to decrease. Also, whenever the
system path is updated, a script needs to go through the database and update
everything to reflect the new path.
So, if you can give me your input on this, I'd greatly appreciate it. Is
this a good, or bad way of designing a database?
Sounds like you only need to store the full path once per user. It seems
sensible to put the path in a Users table in your database. Storing the full
path against every picture would be inefficient and also may be inconvenient
if you ever need to change the file location.
David Portas
SQL Server MVP
|||I agree with David, Save the directory in the User row... If you figure our
the path on the fly based on the userid, your are locked into the file
location. If you simply store it in the database, you can change it very
easily.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Shabam" <blislecp@.hotmail.com> wrote in message
news:G5Gdnfwf89eRJsvcRVn-ow@.adelphia.com...
> I have an application that lets users upload pictures. These pictures are
> stored in different folders depending on the user ID (of the user that it
> belongs to). The path can be figured out dynamically by knowing the user
> ID. However, the programmer that's coding my application has decided to
> save the full path into the database.
> Upside that I see is, if there's a huge load of traffic I can see how it
may
> be good for performance, since you don't need to dynamically figure out
the
> path.
> The downside though, is that this leads to database bloat, and I'm not
sure
> if that will cause the database performance to decrease. Also, whenever
the
> system path is updated, a script needs to go through the database and
update
> everything to reflect the new path.
> So, if you can give me your input on this, I'd greatly appreciate it. Is
> this a good, or bad way of designing a database?
>
>
|||"Shabam" <blislecp@.hotmail.com> wrote in message
news:G5Gdnfwf89eRJsvcRVn-ow@.adelphia.com...

> Upside that I see is, if there's a huge load of traffic I can see how it
may
> be good for performance, since you don't need to dynamically figure out
the
> path.
Two good rules of thumb: 1) Don't duplicate, and 2) Premature optimization
is the root of all evil.
Make it work right, then make it work fast (or small). It's surprising how
infrequently the second step is required.
|||> Two good rules of thumb: 1) Don't duplicate, and 2) Premature optimization
> is the root of all evil.
> Make it work right, then make it work fast (or small). It's surprising how
> infrequently the second step is required.
I've heard different schools of thought though. One says that hardcoding
the path makes it quicker because #1, there's no need for an additional
query to get the path variables, and #2, there's no additional processing
needed to put it all together. And if an update were ever needed all I need
is one query to update them all.
However, it does add to the database bloat. Does that affect performance?
|||> However, it does add to the database bloat. Does that affect performance?
Yes, which is why your argument doesn't make much sense.
David Portas
SQL Server MVP
|||> Yes, which is why your argument doesn't make much sense.
Can you show me an article that talks about this downside?

Database design question. I am close ;)

Lets say I am selling parts for cars, trucks, suvs, vans, etc.

I want a user to search for a part by selecting a vehicle type, then a vehicle make, and then a vehicle model.

So

Vehicle Makes have to be related to Vehicle Types (I.E: Land Rover doesn't make a car) and vehicle models need to be related to vehicle make (I.E Toyato doesn't make a mustang Ford does).

So I am okay with those relationships individually but what is confusing me is how to ensure that a Mustang doesn't show up as a Ford Car.

Lets say I have:

vehicle_type
vehicle_type_cd
vehicle_type_desc

vehicle_make

vehicle_make_cd
vehicle_make_desc

vehicle_model
vehicle_model_cd
vehicle_model_desc
Then I might have an intersect between vehicle_type and vehicle_make because certain makes don't have certain types of vehicles. BMW doesn't have a truck, Lexus doesn't have a truck, so when a user selects truck as a make lexus nad BMW shouldn't show up in the drop down.
Vehicle_type_make
Vehicle_type_make_key
Vehicle_type_cd
Vehicle_make_cd

I might have the same relationship between make and model:

Vehicle_make_model
Vehicle_make_model_key
Vehicle_make_cd
Vehicle_model_cd

With this database design, if I were running a SQL statement to find criteria that matched "Truck" and "Ford" to populate the model dropdown I wouldn't know whether mustang was a truck or car.
What would be the best way to design this.

I hope you can help.

Thank you so much

Given the table structures you have provided, this query should return you the results you are looking for:
SELECT
*
FROM
Vehicle_Model VML
INNER JOIN
Vehicle_Make_Model VMM ON VML.Vehicle_Model_Cd = VMM.Model_Cd
INNER JOIN
Vehicle_Type_Make VTM ON VMM.Make_Cd = VTM.Vehicle_Make_Cd
INNER JOIN
Vehicle_Type VT on VTM.Vehicle_Type_Cd = VT.Vehicle_Type_Cd
INNER JOIN
Vehicle_Make VMK ON VMM.Vehicle_Make_Cd = VMK.Vehicle_Make_Cd
WHERE
VT.Vehicle_Type_Desc = 'Truck' AND
VMK.Vehicle_Make_Desc = 'Ford'

|||Woah. I wasn't thinking to clearly was I? Thanks for knocking some sense in to me.
Umm, okay what do you think about that design is it okay?|||This is the structure you've laid out:

vehicle_type
vehicle_type_cd
vehicle_type_desc

vehicle_make
vehicle_make_cd
vehicle_make_desc

vehicle_model
vehicle_model_cd
vehicle_model_desc
Vehicle_type_make
Vehicle_type_make_key
Vehicle_type_cd
Vehicle_make_cd

Vehicle_make_model
Vehicle_make_model_key
Vehicle_make_cd
Vehicle_model_cd

To me, that seems to complicated. Models are always going to betied to a Make, right? Even if there was a Ford Thunderbird and aHyundai Thunderbird, you'd want to treat them as their own separateentities. Both Thunderbirds might not necessarily be cars, soyour design falls apart. And the vehicle type is tied to thespecific model, not to the make, right? Maybe I am not looking atit closely enough, but I think you could probably simplify it like this:

vehicle_type
vehicle_type_cd
vehicle_type_desc

vehicle_make
vehicle_make_cd
vehicle_make_desc

Vehicle_make_model
Vehicle_make_model_key
Vehicle_make_cd
Vehicle_type_cd
Vehicle_model_desc



|||Perfect. I am convinced. Make writing the procs a lot easier as well. :)
|||

Another question already.

Okay lets say that I am actually selling vehicles.

So if someone is listing a truck I want to capture different things than if they are selling a car.
For example I want to capture towing capacity if they are selling a truck but not a car. On the other hand I want to capture mileage whether its a car or a truck.
How would you do the table layout for something like that?

|||Well, one way you could do it would be like this:
attributes
attribute_cd
attribute_desc

vehicle_type_attrbitutes
vehicle_type_cd
attribute_cd

The attributes table would have entries like "towing capacity" and"mileage". The vehicle_type_attributes table would have onerecord for every attribute applicable to the specified vehicle_type.
|||

But then how would I store that data in the item table:

So lets say I have a table
item_details
item_id
vehicle_type
Vehicle_make
Vehicle_model
Vehicle_year
Vehicle_mileage
Vehicle_description
Now I don't want to add the value vehicle_length becuase that is only applicable if the type of vehicle is a boat. So Where do I store that?
item_boat_details?
And then only check that if its a boat? Then I would need conditional SQL which seems silly?
Thanks

|||Well, then you could have:
attributes
attribute_id
attribute_desc

vehicle_type_attrbitutes
vehicle_type_attributes_id
vehicle_type_id
attribute_id

item_details
item_id
vehicle_type_id
vehicle_make_id
vehicle_model_id
item_attributes
item_attributes_id
item_id
attribute_id
item_attribute_value

Year, mileage, length, and description could be attributes, and theirvalues for the specific vehicle would be found in the item_attributestable.
And yeah, I know, I've been all over the place with the keys for thesetables. My personal preference (and you will find many validarguments against it), is a single surrogate key for each record, and Iuse "id" for these. Those table structures above more closelymatch how I'd structure it (well, except for the underscores, which Idislike).
|||

Okay. So I am kind of scared of dynamic attributes.

What about having a table for suv_details, and a table for car_details, and a table for truck_detaiis. Etc.

|||Sorry, I don't think that is a good idea.

Database design question with time

Im designing a database where a user enters the date and the number of
hours and minutes he worked for the day..now i can do this

Workdate small date
Hours integer
Minutes integer

But then would I have to have the front end know that when adding up
the hours and minutes for the week that 60 minutes = 1 hour or is
there some way to do this in the database?

thanks

-JimJim (jim.ferris@.motorola.com) writes:
> Im designing a database where a user enters the date and the number of
> hours and minutes he worked for the day..now i can do this
> Workdate small date
> Hours integer
> Minutes integer
>
> But then would I have to have the front end know that when adding up
> the hours and minutes for the week that 60 minutes = 1 hour or is
> there some way to do this in the database?

You could have a computed column with the forumla Minutes + 60 * Hours:

CREATE TABLE workhours (
userid userid_type NOT NULL,
workdate smalldatetime NOT NULL,
hours tinyint NOT NULL,
minutes tinyint NOT NULL,
worked_minutes AS minutes + 60 * hours,
CONSTRAINT pk_workhours(userid, workdate))

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||>> ... database where a user enters the date and the number of hours
and minutes he worked for the day..<<

Use a duration instead of trying to create your own temporal datatype
system.

CREATE TABLE Timecard
(emp_id INTEGER NOT NULL,
start_time DATETIME NOT NULL,
finish_time DATETIME, -- null means still active
PRIMARY KEY (emp_id, start_time));

You can now use BETWEEN predicates and a calendar table.|||Thanks Ill try that

-Jim

Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns9474F24297CBCYazorman@.127.0.0.1>...
> Jim (jim.ferris@.motorola.com) writes:
> > Im designing a database where a user enters the date and the number of
> > hours and minutes he worked for the day..now i can do this
> > Workdate small date
> > Hours integer
> > Minutes integer
> > But then would I have to have the front end know that when adding up
> > the hours and minutes for the week that 60 minutes = 1 hour or is
> > there some way to do this in the database?
> You could have a computed column with the forumla Minutes + 60 * Hours:
> CREATE TABLE workhours (
> userid userid_type NOT NULL,
> workdate smalldatetime NOT NULL,
> hours tinyint NOT NULL,
> minutes tinyint NOT NULL,
> worked_minutes AS minutes + 60 * hours,
> CONSTRAINT pk_workhours(userid, workdate))

Saturday, February 25, 2012

Database design question

When you have user logins and want to restrict data access for every user only to data relevant or owned by them how do you implement this?

Example:
When a user logs on, he will only have access to data that he himself have created or that have reading rights to which he qualifies.

Lets say I have ten different tables and all data from all users are stored in these tables. Do I need an extra field in every table that denotes who has access to specific rows?

What is the most sensible way to implement this scenario?

We are using ASP.NET, C#, Windows Server 2003, SQL Server 2000

Thanks!

ValeinOne way to implement this is to have all requests for reading or writing data handled through Stored Procedures. Pass in the user information, and then you can have the stored procedures do whatever is needed to determine what data is appropriate to be viewed/modified.

You then give no rights to the underlying tables, just execute rights on the stored procedure.|||Hi Douglas and thanks for answering!

I still don't see how the stored procedures would be able to tell what data a certain user should be allowed to view/update unless access information is stored with the data in the tables.

If there are two articles in a table and a user should only be able to read one of them, how can a stored procedure know what article to return to the user unless every article has access information tagged to them?

Stian Danielsen|||Of course the stored procedure does not "know" what a given user should have access to, you need to add logic to allow that to happen in the stored procedure!

You build queries that, for instance, link the articles with the user table (you do have such a table, correct?) and so the user would only get articles they wrote (for editing, for instance). You need to do something more clever for letting folks read articles beyond what they have written, but again, that can be done with tables that relate articles to groups of users, for instance.|||Thanks again for replying.

Yes, I have a user table and yes, I obviously need to do logic in the stored procedures to make it work. Still, joining the user table with the articles table would require a relation between the two. Most likely a user id column or a user group id column (or both) in the articles table and perhaps also an access specifications column (denoting read and/or write access).

This is a solution, but in my case it does seem a bit cumbersome. See, I don't only have an articles table - I have about 6 or 7 tables that need such access control. Seems to me I need the access rights columns in every one of those tables in order to link the tables up with the user table.

My question was: Is this the way to do it, or is there a better way?
I cannot think of one at the moment.

Thanks again,

Valein|||::This is a solution, but in my case it does seem a bit cumbersome.

You could also have some hardware (named crystal ball) attached to the server and see whether the SP can work with this to gfind out which user can read thwhich data.

See, there HAS to be some tables to manage this information. THis is not cumbersome - this is rquired for anythig than a crystal ball.

::See, I don't only have an articles table - I have about 6 or 7 tables that need such access
::control.

THen make a security management subsystem and integrate the tables there :-)

::My question was: Is this the way to do it, or is there a better way?
::I cannot think of one at the moment.

ONLY way for now - properbly forever.

BTW - no need for a stored procedure, a view should be able to handle the read filtering, too :-) Easier to use.|||This may be too simplistic for your application, but it's one approach.

I do this with a session item for the uid captured during the login process. Each DB entry the user makes it stores the uid in the table. In the select statement it pulls just the records that contain the uid of the person logged in.

selectwhatever fromyourtable where uidcolumn='" & Session("uid") & "'",yourconnection)
|||Thanks a lot for all your replies guys!

It's great to know that the solution I was going for is the only one plausible.
I suspected as much, but it can't hurt to make sure, can it? :-)

Thanks again!

Valein

Friday, February 24, 2012

Database design problem

We have to design a database for UserInfo. We already have a user
table, and contains userid. There are three user type(ex. student,
teacher,admin), they have their own tables. i don't know how to add the
personal infomation field. One way is putting some common field into
the user table, the other is laying the infomation of subtype into
their own tables.Which is better?Is personal info the same for all types? is it present in all types? If yes,
feel free to add it to the user table.
MC
"Readon Shaw" <xydarcher@.163.com> wrote in message
news:1132886720.966817.144210@.o13g2000cwo.googlegroups.com...
> We have to design a database for UserInfo. We already have a user
> table, and contains userid. There are three user type(ex. student,
> teacher,admin), they have their own tables. i don't know how to add the
> personal infomation field. One way is putting some common field into
> the user table, the other is laying the infomation of subtype into
> their own tables.Which is better?
>|||yes, but what is the advantages of that?
MC wrote:
> Is personal info the same for all types? is it present in all types? If ye
s,
> feel free to add it to the user table.
> MC
> "Readon Shaw" <xydarcher@.163.com> wrote in message
> news:1132886720.966817.144210@.o13g2000cwo.googlegroups.com...|||Readon Shaw wrote:
> yes, but what is the advantages of that?
The same advantage as that of having a user table at all - to help you
to apply constraints against it and therefore ensure the integrity of
your data. For example, if you have a name or email address that's
common to all types of user you'll perhaps want to add a constraint
that the address or name be unique across all users. That's much easier
to do if they are all in one table.
In general, the fewer places in which one attribute can appear, the
fewer the opportunities there are for anomalies and incorrect data.
David Portas
SQL Server MVP
--|||Phew, thanks David, I was trying to come up with a short answer :).
In addition let me point out that the entity in this design is User, and
that 'additional' tables might be called 'derivations'. Since the
information you're adding to design is based on entity and not on
derivation, you should apply it there. And only there.
Am I making sense here?
MC
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1132916473.316709.85460@.f14g2000cwb.googlegroups.com...
> Readon Shaw wrote:
> The same advantage as that of having a user table at all - to help you
> to apply constraints against it and therefore ensure the integrity of
> your data. For example, if you have a name or email address that's
> common to all types of user you'll perhaps want to add a constraint
> that the address or name be unique across all users. That's much easier
> to do if they are all in one table.
> In general, the fewer places in which one attribute can appear, the
> fewer the opportunities there are for anomalies and incorrect data.
> --
> David Portas
> SQL Server MVP
> --
>|||MC wrote:
> Phew, thanks David, I was trying to come up with a short answer :).
> In addition let me point out that the entity in this design is User, and
> that 'additional' tables might be called 'derivations'. Since the
> information you're adding to design is based on entity and not on
> derivation, you should apply it there. And only there.
> Am I making sense here?
>
> MC
>
Intuitively that makes sense, yes. More formally, this problem is the
subject of a design rule that Chris Date calls the Principle of
Orthogonal Design, which is used to prevent certain types of redundancy
and anomaly. Roughly this says that integrity constraints should
prevent data being recorded in more than one table if there is some
non-loss decomposition of the same data into fewer tables. That doesn't
absolutely preclude the user name (for example) appearing in both the
Teacher and Student tables but it does require that there should be
some constraint to prevent the same person appearing in both. For
practical reasons it is therefore more efficient to implement one
column and one constraint in one table rather than some more complex
constraints across several tables.
See the following article for more discussion of this.
http://www.dbdebunk.com/page/page/622331.htm
David Portas
SQL Server MVP
--|||Just to be certain, i didnt really try to explain the logic to you David,
but to the original poster :).
MC
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1132923609.030176.20790@.z14g2000cwz.googlegroups.com...
> MC wrote:
> Intuitively that makes sense, yes. More formally, this problem is the
> subject of a design rule that Chris Date calls the Principle of
> Orthogonal Design, which is used to prevent certain types of redundancy
> and anomaly. Roughly this says that integrity constraints should
> prevent data being recorded in more than one table if there is some
> non-loss decomposition of the same data into fewer tables. That doesn't
> absolutely preclude the user name (for example) appearing in both the
> Teacher and Student tables but it does require that there should be
> some constraint to prevent the same person appearing in both. For
> practical reasons it is therefore more efficient to implement one
> column and one constraint in one table rather than some more complex
> constraints across several tables.
> See the following article for more discussion of this.
> http://www.dbdebunk.com/page/page/622331.htm
> --
> David Portas
> SQL Server MVP
> --
>

Database design issue

hi,
we are designing a web application for defect tracking. In this for each
project the user can choose his own template for writing testcases... we nee
d
to persist this data.As you can see there can be any number of textbox in
that template.
We suggested two models,
1. a table with a text column holding the XML format which contains the
template with data .
2. a table containing variable name and value as column such that a crosstab
query would return the template values for a particular project.
But the .net developers suggest creating the table on the fly while the
template is chosen.. Please note once a template is chosen for the project i
t
remains the same.
which one would be better?If you are not going to query within the template and get a subset of
testcases.you can use the XML method.But we don't have validation techniques
for the XML schema in SQL 2000. So if that's not a problem, then storing as
XML should be the best option.
But if you have cases like, the user will select testcase 5 in the template
and edit it and save it, then you are better off with the second option
because manipulation of XML is tough.
In case of option 1, You can take out the XML and edit it and replace the
old one with the new one. If thats fine, then go for option 1.
Hope this helps.

Database design for status field

Hello,

I have a database design question. I want to store a status in a table. In the ASP.NET interface for the user this status will be adapted to the language of the user.

This is how it would look like:

StatusID 1 = "yes" for English, "oui" for French, "ja" for Dutch
StatusID 2 = "no" for English, "non" for French, "neen" for Dutch
StatusID 3 = "error" for English, "erreur" for French, "fout" for Dutch

I don't want to do the translation in ASP.NET and it should be done in one query.

How would it look like in the database design.

WimVM, how about this,

if you are asking about how to design a table or tables, you could have one table (status) like this:

statusID is you primary key and three additional fields (english, french, dutch)

so for instance if you have an english speaker your "yes" would be returned by

declare @.statusintset status = (getYourIdFromApp)select english from status where statusId = @.status
hope this is helpful -- jp|||

Hello,

Thanks for your reply. This would indeed do it, nice and easy. What I forgot to say was that the language is set by an ID, LanguageID. This holds the value 1 for English, 2 for Dutch, 3 for French and 4 for German.

I would need a way that I have more flexibility when I add or disable a language. In the above example you need to know the position of the value linked to the value. Sorry for not informing you about this in the first place.

Thanks

|||

WimVM:

Hello,

Thanks for your reply. This would indeed do it, nice and easy. What I forgot to say was that the language is set by an ID, LanguageID. This holds the value 1 for English, 2 for Dutch, 3 for French and 4 for German.

I would need a way that I have more flexibility when I add or disable a language. In the above example you need to know the position of the value linked to the value. Sorry for not informing you about this in the first place.

Thanks

I still have not found a solution for this. It would be great if somebody could help me with this. Thanks.

|||

WimVM:

Thanks for your reply. This would indeed do it, nice and easy. What I forgot to say was that the language is set by an ID, LanguageID. This holds the value 1 for English, 2 for Dutch, 3 for French and 4 for German.

I would need a way that I have more flexibility when I add or disable a language. In the above example you need to know the position of the value linked to the value. Sorry for not informing you about this in the first place.

Hi Wim, I have some suggestions.

Add a new table to your database called Languages. This table will have 2 fields: LanguageID and LanguageName. The data would look like this:

LanguageID LanguageName
1 English
2 Dutch
3 French
4 German

Add another table called Statuses. This table will have 2 fields: StatusID and StatusName. This table would not necessarily be used in queries, but could be used to store metadata about the Statuses. The data would look like this:

StatusID StatusName
1 Yes Status
2 No Status


Add another table called StatusTranslation. This table will have 3 fields: StatusID, LanguageID, and Translation. The data would look like this:

StatusID LanguageID StatusTranslation
1 1 yes
2 1 no
1 2 ja
2 2 neen
1 3 oui
2 3 non
1 4 ja
2 4 nein

Now, assuming your main data table is called MyTable. This table might look something like this:

ID Column1 Column2 UserLanguageID StatusID
1 Value1 Value2 2 1
2 SomeValue SomeValue2 1 2
3 Value1 Value2 3 1

The query to pull out the status data, translated for the user's language, would look like this:

SELECT
ID,
StatusTranslation
FROM
myTable
INNER JOIN
StatusTranslation ON myTable.StatusID = StatusTranslation.StatusID AND myTable.UserLanguageID = StatusTranslation.UserLanguageID

And the result of that query would be:

ID StatusTranslation
1 ja
2 no
3 oui

This has made some assumptions, such as that you have the UserLanguageID in the same table as the StatusID. You'd need to adjust the queries and data tables to fit your situation, but perhaps this will help get you started.

For some background, you might like Alister Jones' (SomeNewKid) blog post:Localizing the Content, which lead's to Karl Seguin's article:Creating multilingual websites - Part 2.

|||Thankstmorton!

Sunday, February 19, 2012

Database Design

Dear All,
I have just visited a colleague who advised me that the best way to design a
database (speed maximisation for end user be it web or vb) is not to have one
large database but to have your data split into 4 databases where the 4
divisions data is stored separately, rather than one larger database that
stores all data that has to be queried through Stored Procedures. The
databases are likely to be stored on the same hard disk so I don't think
there is a Serial I/O benefit to be gained.
These are not going to be large databases (only about 20,000 records). I
just don't know if my colleague is correct. The logic seems correct but where
is the evidence?
Thanks again.
Alastair MacFarlane
Hi Alastair,
You would get more benifits from ensuring you have the required indexes and
constraints in the database model then partioning the database.
The biggest benifit any databse can get is indexes and correct design. From
there and only after should you think about partionaing.
So while partionaing of Very large databases is good , first do the normal
stuff and then worry about it.
kind regards
Greg O
Need to document your databases. Use the first and still the best AGS SQL
Scribe
http://www.ag-software.com
"Alastair MacFarlane" <AlastairMacFarlane@.discussions.microsoft.com> wrote
in message news:D9B3A0AD-A0EB-4066-A91A-80B9BD0FA4AB@.microsoft.com...
> Dear All,
> I have just visited a colleague who advised me that the best way to design
> a
> database (speed maximisation for end user be it web or vb) is not to have
> one
> large database but to have your data split into 4 databases where the 4
> divisions data is stored separately, rather than one larger database that
> stores all data that has to be queried through Stored Procedures. The
> databases are likely to be stored on the same hard disk so I don't think
> there is a Serial I/O benefit to be gained.
> These are not going to be large databases (only about 20,000 records). I
> just don't know if my colleague is correct. The logic seems correct but
> where
> is the evidence?
> Thanks again.
> Alastair MacFarlane

Database Design

Dear All,
I have just visited a colleague who advised me that the best way to design a
database (speed maximisation for end user be it web or vb) is not to have on
e
large database but to have your data split into 4 databases where the 4
divisions data is stored separately, rather than one larger database that
stores all data that has to be queried through Stored Procedures. The
databases are likely to be stored on the same hard disk so I don't think
there is a Serial I/O benefit to be gained.
These are not going to be large databases (only about 20,000 records). I
just don't know if my colleague is correct. The logic seems correct but wher
e
is the evidence?
Thanks again.
Alastair MacFarlaneHi Alastair,
You would get more benifits from ensuring you have the required indexes and
constraints in the database model then partioning the database.
The biggest benifit any databse can get is indexes and correct design. From
there and only after should you think about partionaing.
So while partionaing of Very large databases is good , first do the normal
stuff and then worry about it.
kind regards
Greg O
Need to document your databases. Use the first and still the best AGS SQL
Scribe
http://www.ag-software.com
"Alastair MacFarlane" <AlastairMacFarlane@.discussions.microsoft.com> wrote
in message news:D9B3A0AD-A0EB-4066-A91A-80B9BD0FA4AB@.microsoft.com...
> Dear All,
> I have just visited a colleague who advised me that the best way to design
> a
> database (speed maximisation for end user be it web or vb) is not to have
> one
> large database but to have your data split into 4 databases where the 4
> divisions data is stored separately, rather than one larger database that
> stores all data that has to be queried through Stored Procedures. The
> databases are likely to be stored on the same hard disk so I don't think
> there is a Serial I/O benefit to be gained.
> These are not going to be large databases (only about 20,000 records). I
> just don't know if my colleague is correct. The logic seems correct but
> where
> is the evidence?
> Thanks again.
> Alastair MacFarlane