Trustworthy Databases

james.taylorjames.taylor Posts: 6
edited September 4, 2008 1:11AM in SQL Packager Previous Versions
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

Comments

  • 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
    Product Manager
    Redgate Software
  • 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?
  • I got this to work by hacking the PackageExecutor.cs file in Red Gate\SQL Packager 5\SQL Packager Code Templates\C#
    sqlCommand.CommandText = "ALTER DATABASE " + m_DatabaseName + " SET TRUSTWORTHY ON";
    sqlCommand.ExecuteNonQuery();
    

    I put it just under this code:
    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.
  • 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.
Sign In or Register to comment.