Showing posts with label guys. Show all posts
Showing posts with label guys. Show all posts

Wednesday, March 28, 2012

Putting encypted values in a database

hi guys,

Could any one tell me whats the best way to put encypted data into a table.
i have a textfield that a single integer is entered into it. It is then encrypted using DES encrption algorithim.It converts the value to byte(Convert2ByteArray method) I pass the data to a stored procedure which converts it to char before inserting it into the table. when i checked the database all it entered was System.Byte[]. Does anyone know where im goin wrong?

Mairtin

The problem lies because the .ToString method of your byte [] returns "System.Byte[]". You will need to manually convert this over to a string before placing this into your Stored Procedure.

System.Converthas a couple methods to help you with this.

byte [] encryptedBytes = GetEncryptedBytes( unencryptedData );
string encryptedString = System.Convert.ToBase64String( encryptedBytes );

To unencrypt the string you must go the other way.

byte encryptedBytes = System.Convert.FromBase64String( encryptedString );
unencryptedData = GetDecryptedString( encryptedBytes );

bill
|||

hey billrob,

i tried that out.
I dont know if it has done what is suppose to! I wrote the encrypted value out to a textfile aswell to see the difference.

in the database the value was Mw==
in the textfile the value looked like ??Xq/ ê à?*?a?]T¥ù?±@.àcl<tTàFE/.(without System.covert used on it )

Somehow i think i may be going wrong,

|||How were you viewing it in the Database? The binary data looks (from textfile) looks like valid data, post some of your code, but remove your Vector and key from the post.

ToBase64 and FromBase64 are inverse operations. If you take your binary blob, base64 it, then turn it back into binary, you will have the same thing.

How large did you make your text column in the database that stores this information.

bill

FYI, the Base64String stuff is very similiar to how .NET processes the ViewState.

Wednesday, March 21, 2012

Purge a Transaction Log?

Hi Guys,
I have MS SQL Server 2000 which, among others, has a database on it used for
McAffee protection pilot (A policy driven AV managment system). Over the las
t
month or so the Tlog ldf has exploded in size to over 10GB (the mdf is only
25MB). How can I purge this log with minimal disruption to the database.
I tried shrinking the database and restoring from a backup but this seems to
have had no effect on the ldf file. I sopke to someone who sugested exportin
g
the data, objects and procedures etc. but during a test run this came back
with errors and also it seems quite long winded.
I don't have that much background in SQLserver but I know in Exchange - the
backup API will purge the tlogs once a backup has been successful - can
something similar be configured?. I noticed the maximum log file size
settings - which I will set once I have purged the ldf file.
Any ideas?
Thanks,
Niall.Hi
Check out
http://msdn.microsoft.com/library/d...r />
_1uzr.asp
John
"Niall" wrote:

> Hi Guys,
> I have MS SQL Server 2000 which, among others, has a database on it used f
or
> McAffee protection pilot (A policy driven AV managment system). Over the l
ast
> month or so the Tlog ldf has exploded in size to over 10GB (the mdf is onl
y
> 25MB). How can I purge this log with minimal disruption to the database.
> I tried shrinking the database and restoring from a backup but this seems
to
> have had no effect on the ldf file. I sopke to someone who sugested export
ing
> the data, objects and procedures etc. but during a test run this came back
> with errors and also it seems quite long winded.
> I don't have that much background in SQLserver but I know in Exchange - th
e
> backup API will purge the tlogs once a backup has been successful - can
> something similar be configured?. I noticed the maximum log file size
> settings - which I will set once I have purged the ldf file.
> Any ideas?
> Thanks,
> Niall.sql

Purge a Transaction Log?

Hi Guys,
I have MS SQL Server 2000 which, among others, has a database on it used for
McAffee protection pilot (A policy driven AV managment system). Over the last
month or so the Tlog ldf has exploded in size to over 10GB (the mdf is only
25MB). How can I purge this log with minimal disruption to the database.
I tried shrinking the database and restoring from a backup but this seems to
have had no effect on the ldf file. I sopke to someone who sugested exporting
the data, objects and procedures etc. but during a test run this came back
with errors and also it seems quite long winded.
I don't have that much background in SQLserver but I know in Exchange - the
backup API will purge the tlogs once a backup has been successful - can
something similar be configured?. I noticed the maximum log file size
settings - which I will set once I have purged the ldf file.
Any ideas?
Thanks,
Niall.Hi
Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_da2_1uzr.asp
John
"Niall" wrote:
> Hi Guys,
> I have MS SQL Server 2000 which, among others, has a database on it used for
> McAffee protection pilot (A policy driven AV managment system). Over the last
> month or so the Tlog ldf has exploded in size to over 10GB (the mdf is only
> 25MB). How can I purge this log with minimal disruption to the database.
> I tried shrinking the database and restoring from a backup but this seems to
> have had no effect on the ldf file. I sopke to someone who sugested exporting
> the data, objects and procedures etc. but during a test run this came back
> with errors and also it seems quite long winded.
> I don't have that much background in SQLserver but I know in Exchange - the
> backup API will purge the tlogs once a backup has been successful - can
> something similar be configured?. I noticed the maximum log file size
> settings - which I will set once I have purged the ldf file.
> Any ideas?
> Thanks,
> Niall.

Purge a Transaction Log?

Hi Guys,
I have MS SQL Server 2000 which, among others, has a database on it used for
McAffee protection pilot (A policy driven AV managment system). Over the last
month or so the Tlog ldf has exploded in size to over 10GB (the mdf is only
25MB). How can I purge this log with minimal disruption to the database.
I tried shrinking the database and restoring from a backup but this seems to
have had no effect on the ldf file. I sopke to someone who sugested exporting
the data, objects and procedures etc. but during a test run this came back
with errors and also it seems quite long winded.
I don't have that much background in SQLserver but I know in Exchange - the
backup API will purge the tlogs once a backup has been successful - can
something similar be configured?. I noticed the maximum log file size
settings - which I will set once I have purged the ldf file.
Any ideas?
Thanks,
Niall.
Hi
Check out
http://msdn.microsoft.com/library/de...r_da2_1uzr.asp
John
"Niall" wrote:

> Hi Guys,
> I have MS SQL Server 2000 which, among others, has a database on it used for
> McAffee protection pilot (A policy driven AV managment system). Over the last
> month or so the Tlog ldf has exploded in size to over 10GB (the mdf is only
> 25MB). How can I purge this log with minimal disruption to the database.
> I tried shrinking the database and restoring from a backup but this seems to
> have had no effect on the ldf file. I sopke to someone who sugested exporting
> the data, objects and procedures etc. but during a test run this came back
> with errors and also it seems quite long winded.
> I don't have that much background in SQLserver but I know in Exchange - the
> backup API will purge the tlogs once a backup has been successful - can
> something similar be configured?. I noticed the maximum log file size
> settings - which I will set once I have purged the ldf file.
> Any ideas?
> Thanks,
> Niall.

pulling unique records from this query

Hi guys, need your help! (sorry this is quite long)
I've got a table of Projects which I'm using with an asp:Repeater to display
a list of the projects. Here's the sql...
SELECT ProjectID, ProjectName, ProjectClient, DartsContact, LeadArtist,
Projects.AreaOfWork, AreaOfDoncaster, StartDate, EndDate, Running,
WorkAreas.AreaofWork AS AOWName, WorkAreas.RelatesTo AS AOWRelates FROM
Projects, WorkAreas
WHERE (NOT Running=0) AND (Projects.AreaOfWork LIKE '%' + WorkAreas.AOWCode
+ '%') AND (Deleted = 0) ORDER BY ProjectName ASC
As you can hopefully see, I'm using two tables to pull the data together.
It worked fine, until we made a change to the way the data is stored. The
Projects.AreaOfWork field now contains multiple AOWCodes seperated by a
delimiter. So now, whenever I run this query, I get more than 1 line for eac
h
project where there are multiple values in AreaOfWork. So, if I have a
project...
ProjectID, ProjectName, AreaOfWork
1, Test Proj 1, EDU
2, Test Proj 2, EDU|COM
I get 2 lines for Test Project 2, each with a unique AreaOfWork (one with
EDU, one with COM).
2 things... I need to stop it returning multiple records for the same
project when theres more than one AreaOfWork, but I also need to return the
entire AreaOfWork string, because I still need access to those.
Any help would be greatly appreciated.
Cheers
Danwhy have you chosen to store your data like that (delimited) - it
breaks with normalisation, and is the main reason your having problems.
surely it would be easier if you had a separate table like
tblProjWorkAreas(ProjectID, AreaOfWork). Is there are reason for not
doing this?|||I see your point mate. Time constraints are the main reason for this.. it's
an addition to a project that's been running for a couple of years (the
having multiples instead of one).
Is there a way to get the query to work!?
"Will" wrote:

> why have you chosen to store your data like that (delimited) - it
> breaks with normalisation, and is the main reason your having problems.
> surely it would be easier if you had a separate table like
> tblProjWorkAreas(ProjectID, AreaOfWork). Is there are reason for not
> doing this?
>|||actually, further to this... I *think* i can do half of what I want to do in
code, if I can get it to just select unique records... :)
"Will" wrote:

> why have you chosen to store your data like that (delimited) - it
> breaks with normalisation, and is the main reason your having problems.
> surely it would be easier if you had a separate table like
> tblProjWorkAreas(ProjectID, AreaOfWork). Is there are reason for not
> doing this?
>|||depends on what you want out. If we take your example where you have
EDU|COM, what output would you want - the area of work columns x2?
could you post a fuller example in terms of data from both tables, and
what you'd like your query to result in.|||Hi Dan,
Thanks for using MSDN Managed Newsgroup Support.
As Will mentioned, it is not a good idea to store your data like that.
So I want to know why you use the WorkAreas.AreaofWork and
WorkAreas.Relates in the query. If you want to unique the only Project in
this query, I think you may need to exclude the WorkAreas Table.
Also, you may provide me the result of the query now if you have 2
AreaOfWork in the Project Table.
I need to know the exactly different of these 2 records.
Sincerely,
Wei Lu
Microsoft Online Community Support
========================================
==========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
==========
This posting is provided "AS IS" with no warranties, and confers no rights.|||Thank you both for your help. I managed to get this to work using a differen
t
method, so no need to concern yourselves anymore :) I do appreciate that
using a third table would be a much better solution, and may consider that
for future redevlopment.
In answer to your question Wei, the reason for showing the AOW fields is
simply to show which Areas of Work a Project belongs to. WorkAreas.Relates i
s
a field that allows us to have inherited Areas of Work in the table, like so
.
aowcode aowname relates_to
1 Education null
2 Adult Ed 1
3 Preschool 1
etc.
Again, thank you both for your help today!
Cheers
Dan
"Wei Lu" wrote:

> Hi Dan,
> Thanks for using MSDN Managed Newsgroup Support.
> As Will mentioned, it is not a good idea to store your data like that.
> So I want to know why you use the WorkAreas.AreaofWork and
> WorkAreas.Relates in the query. If you want to unique the only Project in
> this query, I think you may need to exclude the WorkAreas Table.
> Also, you may provide me the result of the query now if you have 2
> AreaOfWork in the Project Table.
> I need to know the exactly different of these 2 records.
> Sincerely,
> Wei Lu
> Microsoft Online Community Support
> ========================================
==========
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ========================================
==========
> This posting is provided "AS IS" with no warranties, and confers no rights
.
>

Monday, March 12, 2012

PULL huge table from SQL Server Problem

Hey Guys

I have meet the same problem, too.

I create a table with 1,380,000 rows data,

the db real size about 114 MB.

The primary key size is nchar(6).

When I use RDA pull, I found that the primary

key in the PDA disappear. So, It took a long time

to get query response.

But when I delete some rows to 680,000 rows of data.

After I pull, The primary key can pull from the SQL Server.

PS: I didn't change any code. Just delete some rows.

Is that SQL-Mobile's bug?

PS: 1.Database and Temp Database limitation both are 384MB

2.If I use query analyzer to add primary key it works! so strange!!

3.Pull process return "S_OK".

4.After Pull process finished, the db connection still alive. It seems not like

time out problem.

5.Local Connection String:"Data Source='%s\\%s';SSCEBig Smileatabase Password='%s';SSCE:Encrypt Database='true';SSCE:Max Database Size=384;SSCE:Temp File Max size=384;SSCE:Temp File Directory=%s"

We do have tests that do PULL of 200 MB data and almost 10 Lakh rows. Is that possible for you to give the schema and few more details of your environment so that we can try reproducing and find the root cause.

Thanks,

Laxmi

Friday, March 9, 2012

Publishing from Oracle to Sql Server 2005

HI guys,

Am trying to do the above. Managed to configured the distributer. However, while trying to configure my oracle publisher, it failed as follows:

====================================================
Creating Publication

- Creating Publication 'oraTest' (Success)
* SQL Server created publication 'oraTest'.

- Adding article 1 of 1 (Error)
Messages
* SQL Server Management Studio could not create article 'USERS'. (New Publication Wizard)

ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Objects cannot be published from the publisher login schema [SCOTT].
Changed database context to 'distribution'. (Microsoft SQL Server, Error: 20802)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1187&EvtSrc=MSSQLServer&EvtID=20802&LinkId=20476

======================================================

As u guys can see, the publisher was created smoothly. It is the adding of the article, ie. my oracle table. I have ran the permission script as instructed in the BOL.

Wat am I missing? Can anyone pls help?

Thanks!

Cheers,
Kevin
-

Hi Kevin,

Can you please make sure that you have granted read permissions on the tables to the Oracle user account for managing Oracle publisher?|||Kevin -

The reason that you get this message is that you tried to publish tables that were in the schema account that you provided for replication. This is not supported since the replication account in Oracle is used strictly for supporting replication. As Mahesh mentions above, you just need to grant select on your tables (which shouldn't be owned by the replication user) to the replication user you created.

Matt Hollingsworth
Program Manager

Wednesday, March 7, 2012

Publish Subscription replication - Side effects?

Hi Guys,
I've been given the task of creating a disaster recovery "replica" of a
production SQL server and keeping it current.
(SQL 2000)
At first we thought of using scripts to do a backup/restore method.
But a couple of the databases are upwards of a hundred gigabytes...
A bit hard on drive space.
I thought a better method would be to replicate the databases using the
Publish and "push subscriptions".
I'm not very knowledgeable about SQL management, However with the help of
Google and a little time,
I mamnaged to make it work experimentally with the Northwind database.
But that's tiny compared to the live DBs
My question is:
Am I likely to see any 'unforseen' side effects of replicating by this
method?
Thanks,
Jim
To keep maximum performance on your main SQL Server I would consider
"pulling" the transactionally replicated data.
This article from Microsoft has alot of great tips on how to maximize
replication performance.
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/tranrepl.mspx
If you have money for a nice SAN unit you can check out Split Mirroring.
http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/spltmirr.mspx

/*
Warren Brunk - MCITP,MCTS,MCDBA
www.techintsolutions.com
*/
"Jim Millar" <Jim.Millar_NOSPAM_@.hotmail.com> wrote in message
news:epEJFv0QIHA.2376@.TK2MSFTNGP02.phx.gbl...
> Hi Guys,
> I've been given the task of creating a disaster recovery "replica" of a
> production SQL server and keeping it current.
> (SQL 2000)
> At first we thought of using scripts to do a backup/restore method.
> But a couple of the databases are upwards of a hundred gigabytes...
> A bit hard on drive space.
> I thought a better method would be to replicate the databases using the
> Publish and "push subscriptions".
> I'm not very knowledgeable about SQL management, However with the help of
> Google and a little time,
> I mamnaged to make it work experimentally with the Northwind database.
> But that's tiny compared to the live DBs
> My question is:
> Am I likely to see any 'unforseen' side effects of replicating by this
> method?
> Thanks,
> Jim
>
|||Thanks Warren!
I'll give it a go.
Unfortunately the client is 'cheap' and wants to spend as little as
possible.
Getting to be par for the course these days...
"Warren Brunk" <wbrunk@.techintsolutions.com> wrote in message
news:elyRBZ5QIHA.4180@.TK2MSFTNGP06.phx.gbl...
> To keep maximum performance on your main SQL Server I would consider
> "pulling" the transactionally replicated data.
> This article from Microsoft has alot of great tips on how to maximize
> replication performance.
> http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/tranrepl.mspx
> If you have money for a nice SAN unit you can check out Split Mirroring.
> http://www.microsoft.com/technet/prodtechnol/sql/2000/maintain/spltmirr.mspx
>
> --
> /*
> Warren Brunk - MCITP,MCTS,MCDBA
> www.techintsolutions.com
> */
>
> "Jim Millar" <Jim.Millar_NOSPAM_@.hotmail.com> wrote in message
> news:epEJFv0QIHA.2376@.TK2MSFTNGP02.phx.gbl...
>