Trustworthy Databases

Forum for users of SQL Packager database archive utility

Moderator: David Atkinson

Trustworthy Databases

Postby james.taylor » Mon Jul 28, 2008 1:59 pm

I have a CLR Assembly that is part of my default database and needs to e included in my Packager application.

In order for the CLR Assembly to be created within my database, the database needs to be modified to be 'Trustworthy'

The Packager does not seem to modify this database setting and as a result the Package fails to install correctly.

Is there something i need to configure with the SQL Packager application at build time that i am not doing, or any way to default any new databases to be trustworthy?

Many thanks
james.taylor
 
Posts: 4
Joined: Tue Mar 18, 2008 2:32 pm

Postby David Atkinson » Mon Jul 28, 2008 5:27 pm

Hi James,

Currently it is not possible to amend the SQL Script that SQL Packager outputs, so adding the line "ALTER DATABASE [IOS01] SET TRUSTWORTHY ON" is sadly not an option.

However, we are tentatively looking into the possibility of allowing SQL Packager to read in its input from a file, which should allow for a lot more flexibility.

If anyone else knows of any instances of where editing the Packager script may solve an existing problem, please respond to this thread or email me personally, as this will add weight to this enhancement candidate.

Regards,

David Atkinson
Product Manager
Red Gate Software
David.Atkinson at red-gate.com
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby james.taylor » Mon Jul 28, 2008 5:38 pm

David,

Thanks for the response.

I do have another reason for requiring the ability to alter/modify the script. This would be to modify the default passwords that the Redgate applications apply by default to their user creation scripts.

At our company we do have standard fixed users and passwords that our applications use internally. The ability to change these would be an ideal enhancement to the Packaging application.

Failing that, is there anyway of altering the default passwords that your script generators use?
james.taylor
 
Posts: 4
Joined: Tue Mar 18, 2008 2:32 pm

Postby tchaplin@miningis.com.au » Thu Sep 04, 2008 4:30 am

I got this to work by hacking the PackageExecutor.cs file in Red Gate\\SQL Packager 5\\SQL Packager Code Templates\\C#

Code: Select all
sqlCommand.CommandText = "ALTER DATABASE " + m_DatabaseName + " SET TRUSTWORTHY ON";
sqlCommand.ExecuteNonQuery();


I put it just under this code:

Code: Select all
string [] dbOptions = m_DatabaseProperties.DatabaseOptions;
               if (dbOptions != null)
               {
                  foreach (string dbOption in dbOptions)
                  {
                     try
                     {
                        if (dbOption.Length > 0)
                        {
                           sqlCommand.CommandText = "Exec sp_dboption '" + m_DatabaseName + "', '"+ dbOption +"' ,'on'";   
                           sqlCommand.ExecuteNonQuery();
                        }
                     }
                     catch
                     {
                        //MessageBox.Show(sqlCommand.CommandText,e.Message, System.Windows.Forms.MessageBoxIcon.Information);
                     }


                     //node.Nodes.Add(string.Format("db_option '{0}', 'on'", dbOption));   
                  }            
               }


It would be great if the ability to set all database options was made available in the future.
tchaplin@miningis.com.au
 
Posts: 15
Joined: Wed Apr 23, 2008 1:52 am

Specify a template

Postby tchaplin@miningis.com.au » Thu Sep 04, 2008 6:11 am

Is it possible to have multiple SQL Packager Code Templates and specify which one to use when packaging?

I have to do custom editing to the template for each of our different products.
tchaplin@miningis.com.au
 
Posts: 15
Joined: Wed Apr 23, 2008 1:52 am


Return to SQL Packager Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest