[Need Help]Compare encrypted functions doesn't work

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

[Need Help]Compare encrypted functions doesn't work

Postby kevinlan » Wed Nov 02, 2011 2:30 pm

Error Message :Index was outside the bounds of the array.


System.IndexOutOfRangeException was unhandled
Message="Index was outside the bounds of the array."
Source="RedGate.BackupReader"
StackTrace:
at bV.GetPage(cG pfid, Byte[] targetArray)
at di.<GetHobtRowsFromIAM>d__0.MoveNext()
at di.<GetTableRowsFromIAM>d__e.MoveNext()
at bH.a(String A_1, IEnumerable`1 A_2, IEnumerable`1 A_3)
at bH.PopulateTable(ITableName name, bU pageProvider, bz schemaProvider, aJ tracker)
at RedGate.BackupReader.LiveConnection.PopulateAdditionalSystemTables(List`1 tables)
at RedGate.BackupReader.LiveConnection.PopulateAdditionalSystemTables(ITableName[] tables)
at N..ctor(SqlConnection conn, SQLVersion version)
at w.RedGate.SQLCompare.Engine.IDatabaseHelper.GetEncryptedText(r resultSet, Int32 objectID)
at p.a(o A_1, Boolean A_2)
at p.a(o A_1)
at RedGate.SQLCompare.Engine.Database.Register(ConnectionProperties connectionProperties, Options options)
at Tools.SqlCompareReport.SqlCompareReport.RunCompareRport(Int32 RID, String SourceServer, String SourceDB, String DesServer, String DesDB) in C:\\Documents and Settings\\user\\My Documents\\Visual Studio 2008\\Projects\\DataBaseTools\\SqlCompareReport\\SqlCompareReport.cs:line 39
at SqlCompareReport.Program.Main(String[] args) in C:\\Documents and Settings\\Klan\\My Documents\\Visual Studio 2008\\Projects\\DataBaseTools\\SqlCompareReport\\Program.cs:line 25
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:



Hi Guys ,i am so lost in this error message .Could someone could help me

when call the register function to Register the database, it raise this error all the same.if there hasn't Encrypted objects, it can work well.


DALCompareReport logreport = new DALCompareReport();
string DifferentType = string.Empty;
string FileName = string.Empty;
Options myoptions = Options.Default | Options.DecryptPost2kEncryptedObjects | Options.IgnorePermissions | Options.IgnoreWhiteSpace | Options.IgnoreUsers;


public void RunCompareRport(int RID,string SourceServer, string SourceDB, string DesServer, string DesDB)
{
using (Database stagingDB = new Database(), productionDB = new Database())
{
//ConnectionProperties sourceConnectionProperties = new ConnectionProperties(Program.StagingServerName, Program.StagingDatabaseName);
// ConnectionProperties targetConnectionProperties = new ConnectionProperties(Program.ProductionServerName, Program.ProductionDatabaseName);

ConnectionProperties sourceConnectionProperties = new ConnectionProperties(SourceServer, SourceDB);
ConnectionProperties targetConnectionProperties = new ConnectionProperties(DesServer, DesDB);

// Connect to the two databases and read the schema
try
{
Console.WriteLine("Registering database " + targetConnectionProperties.DatabaseName + " on server " + DesServer);


productionDB.Register(targetConnectionProperties,myoptions); --error happen in this line
kevinlan
 
Posts: 9
Joined: Wed Nov 02, 2011 2:13 pm

Postby james.billings » Thu Nov 03, 2011 7:08 pm

Thanks for your post, and sorry you're having some trouble.

If you have encrypted objects, then you need to ensure the backupreader DLL is included in your solution. In addition, you must compile specifically for "X86" rather than "AnyCPU".

Once you've checked that, if the problem persists, can you let us know:

- does the same thing happen in the SQL Compare GUI?
- what version of the Compare DLL are you using in your solution?
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby kevinlan » Fri Nov 04, 2011 4:01 am

Hi, i found this error only raise when the target server is X64, it would be ok if the trarget db server is X32 bit.

i have included the backupreader.dll and compiled my project as x86

there hasn't any problem when used the Sql Compare GUI.

i am using the Sql Comparision SDK 8.0

thanks
kevinlan
 
Posts: 9
Joined: Wed Nov 02, 2011 2:13 pm

Postby kevinlan » Fri Nov 04, 2011 4:30 am

the issue i came cross is similar with this one


https://www.red-gate.com/supportcenter/ ... %20Compare


thanks
kevinlan
 
Posts: 9
Joined: Wed Nov 02, 2011 2:13 pm

Postby james.billings » Fri Nov 04, 2011 9:15 am

Did compiling for 32-bit fix it? The BackupReader component (required for encryption) is 32-bit only which is why you need to do this.

If the problem persists, you may have an older DLL but I thought v8 should be ok. Check the version number of the actual DLL you are referencing.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby kevinlan » Fri Nov 04, 2011 9:32 am

Hi james:
thanks for you reply

i haven't fixed it .

your means that i compile my project with X86? i did it.

the backupreader version is 1.3.0.106

thanks
kevinlan
 
Posts: 9
Joined: Wed Nov 02, 2011 2:13 pm

Postby james.billings » Fri Nov 04, 2011 9:35 am

Can you try installing SQL Compare using this link and then reference all the DLLs in "C:\\Program Files (x86)\\Red Gate\\SQL Compare 8" instead of the ones in the SDK folder?
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby kevinlan » Mon Nov 07, 2011 6:48 am

Hi james, it can works by using the sql compare 8.5 version.

but i am a liittle confuse that why this error happened on the sdk 8.1,
it can works when i was using the Compare 8.1 UI .


thanks
kevinlan
 
Posts: 9
Joined: Wed Nov 02, 2011 2:13 pm

Postby james.billings » Mon Nov 07, 2011 12:46 pm

If you were using the 8.1 DLLs these may be different to the ones in 8.1 of Compare (there are "sub-versions"). Or it may have been a problem just accessing the DLLs via your own code rather than how Compare uses them internally. If it's good with the newer ones though, that's great.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests