MySql data layer - Table 'mojoportal.mp_sitehosts' doesn't exist

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
11/26/2007 9:37:04 AM
Gravatar
Total Posts 46

MySql data layer - Table 'mojoportal.mp_sitehosts' doesn't exist

Hi Joe,
I’m sure I’m missing something really simple but I’ve just installed MySql on my machine and am trying to get my sandbox version working on MySql (I also get the same error with the main trunk), I’ve created a new database and user and added all required permissions. I’ve deleted the reference to the MSSQL data layer in mojPortal.Business and replaced it with a reference to mojoPortal.Data.MySql. I’ve added the correct connection string to the web.config but I get the below message when I navigate to setup/default.aspx.
Cheers,
Rob
....

Table 'mojoportal.mp_sitehosts' doesn't exist
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: MySql.Data.MySqlClient.MySqlException: Table 'mojoportal.mp_sitehosts' doesn't exist

Source Error:

Line 352: sqlCommand.Append("WHERE HostName = ?HostName ;");
Line 353:
Line 354: IDataReader reader = MySqlHelper.ExecuteReader(
Line 355: GetConnectionString(),
Line 356: sqlCommand.ToString(),


Source File: C:\Data\HomeDev\mojo-SurveySandbox\mojoPortal.Data.MySql\dbFriendlyUrl.cs Line: 354

Stack Trace:

[MySqlException (0x80004005): Table 'mojoportal.mp_sitehosts' doesn't exist]
MySql.Data.MySqlClient.MySqlStream.OpenPacket() +226
MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId) +96
MySql.Data.MySqlClient.MySqlDataReader.GetResultSet() +70
MySql.Data.MySqlClient.MySqlDataReader.NextResult() +770
MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +1279
MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(MySqlConnection connection, MySqlTransaction transaction, String commandText, MySqlParameter[] commandParameters, Boolean ExternalConn) +230
MySql.Data.MySqlClient.MySqlHelper.ExecuteReader(String connectionString, String commandText, MySqlParameter[] commandParameters) +123
mojoPortal.Data.DBFriendlyUrl.GetByUrl(String hostName, String friendlyUrl) in C:\Data\HomeDev\mojo-SurveySandbox\mojoPortal.Data.MySql\dbFriendlyUrl.cs:354
mojoPortal.Business.FriendlyUrl.GetFriendlyUrl(String hostName, String friendlyUrl) in C:\Data\HomeDev\mojo-SurveySandbox\mojoPortal.Business\FriendlyUrl.cs:122
mojoPortal.Business.FriendlyUrl..ctor(String hostName, String friendlyUrl) in C:\Data\HomeDev\mojo-SurveySandbox\mojoPortal.Business\FriendlyUrl.cs:38
mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app) in C:\Data\HomeDev\mojo-SurveySandbox\Web\Components\UrlRewriter.cs:156
mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e) in C:\Data\HomeDev\mojo-SurveySandbox\Web\Components\UrlRewriter.cs:84
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
 

11/26/2007 10:14:40 AM
Gravatar
Total Posts 46

Re: MySql data layer - Table 'mojoportal.mp_sitehosts' doesn't exist

Hi Joe,

It seems that the urlRewriter module trys to rewrite the setup url. If I add the setup/default.aspx to the if statement below it doesn't try to rewrite and seems to work fine. However is this the right way to be doing things or I am missing something.

protected void UrlRewriter_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
String loweredPath = app.Request.Path.ToLower();

if (
(loweredPath.EndsWith(".gif"))
|| (loweredPath.EndsWith(".js"))
|| (loweredPath.EndsWith(".png"))
|| (loweredPath.EndsWith(".jpg"))
|| (loweredPath.EndsWith(".css"))
|| (loweredPath.EndsWith(".axd"))
|| (loweredPath.EndsWith("setup/default.aspx"))
 

11/26/2007 10:42:45 AM
Gravatar
Total Posts 18439

Re: MySql data layer - Table 'mojoportal.mp_sitehosts' doesn't exist

Hi Rob,

I think I introduced this bug recently while cleaning up FxCop violations. I was previously catching Exception but FxCop says to catch only specific exceptions so I changed it to catch InvalidOperationException which is what is thrown when using MS SQL on a new install. However MySql throws a MySqlException which inherits from System.Data.Common.DBException so I need to add another catch for that like this:

protected void UrlRewriter_BeginRequest(object sender, EventArgs e)
{
if (sender == null) return;

HttpApplication app = (HttpApplication)sender;

if (
(app.Request.Path.EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase))
|| (app.Request.Path.EndsWith(".js", StringComparison.InvariantCultureIgnoreCase))
|| (app.Request.Path.EndsWith(".png", StringComparison.InvariantCultureIgnoreCase))
|| (app.Request.Path.EndsWith(".jpg", StringComparison.InvariantCultureIgnoreCase))
|| (app.Request.Path.EndsWith(".css", StringComparison.InvariantCultureIgnoreCase))
|| (app.Request.Path.EndsWith(".axd", StringComparison.InvariantCultureIgnoreCase))
)
{
return;

}

if (WebConfigSettings.UseUrlReWriting)
{
try
{
RewriteUrl(app);
}
catch (InvalidOperationException ex)
{
log.Error(ex);
}
catch (System.Data.Common.DbException ex)
{
log.Error(ex);
}

}
}

 

I'll have this fixed in trunk by tonight.

Thanks for letting me know.

Joe

You must sign in to post in the forums. This thread is closed to new posts.