Database error after downloading from a remote to a local site

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

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.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
6/13/2011 5:47:11 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Database error after downloading from a remote to a local site

Hi,

I have used WebMatrix (WebDeploy) to create a local MojoPortal site, and to publish it to the net. This works fine.

I have made some changes on the published site and now want to download it back to my local pc where its easier to make large changes.

WebMatrix tells me the download was successful, but I get a database error message. I'm guessing its maybe to do with my local site using SQL CE and the remote using SQL?

I can't see a problem with my connection string, it looks fine. And it was working locally originally, all I have done is uploaded then downloaded it.

The error I see is:

Welcome to mojoPortal Setup
Probing system...
File system permissions ok.

The system cannot connect to the MSSQL database. Please check your connection string.


System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'MtlAdmin'. at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) at System.Data.SqlClient.SqlConnection.Open() at mojoPortal.Data.DBPortal.DatabaseHelperGetConnectionError(String overrideConnectionInfo)

Note: This page shows some information that is helpful during setup and upgrades but for security it would be best not to show any information when the system is up to date. You can disable setup and suppress all information on this page by setting DisableSetup=true in Web.config. When you need to upgrade, you can set this back to false. If you are logged in as Administrator setup will run and you will be able to see this page even if it is disabled in Web.config so you can easily leave it disabled and just login before upgrading. But if you are not logged in you will need to enable setup in Web.config

6/13/2011 6:08:14 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Database error after downloading from a remote to a local site

In order to move your site back and forth between two servers you will need to be using the same database platform on both sides. The reason for this is you have to backup and restore the database. See the Moving an Installation of mojoPortal document for further explanation.

Jamie

6/13/2011 6:35:42 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

Hi Jamie, thanks for the quick response, much appreciated.

My understanding is that WebMatrix deals with database upload / download.

My local pc is using datasource .\SQLExpress (am I right in saying this is SQL CE?). The remote site I have setup an SQL database. I can publish my local site to the remote one with no problem. My MojoPortal site runs on the hosted site correctly with the database having the correct data in it.

When it comes to downloading, WebMatrix tells me the download was successful. I assume that means the database has been downloaded correctly as well. But the MojoPortal site comes up with an error.

Does this make you think any differently?

6/13/2011 6:47:03 PM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Database error after downloading from a remote to a local site

Well, I can't speak to WebMatrix since I haven't used it myself--my experience is in manually moving mojoPortal sites and data (our platform is MySQL). Hopefully someone with better knowledge of WebMatrix for moving databases will chime in with better help for your situation.

Jamie

6/13/2011 7:02:01 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

OK, thanks again.

A little bit more info:

I just check my local database. It does seem to be correctly updated (I saw the new pages I added via the published site in there).

I did notice when I renamed the original database file I got no message but for the updated database I got a 'file access denied' dialog box shown saying i'll need to provide administrator permission to rename this file. The dialog box has a continue button which if pressed does rename the database file (I'm running it on a Windows 7 netbook). Not sure if this has any significance?

 

6/14/2011 3:14:58 AM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

(in my last post I mentioned renaming the database - I only did this to try going back to the old database to see if that worked, but it came up with the same error)

The error message says 'Cannot connect to MSSQL Database' - is this consistent with it trying to connect to SQLExpress?

Does anyone know where I might find more info about what errors MojoPortal has encountered?

6/14/2011 2:34:38 PM
Gravatar
Total Posts 18439

Re: Database error after downloading from a remote to a local site

SQLExpress is the same thing as SQL Server so it is compatible with your host if your host has SQL Server you could get a backup from the host and restore it locally.

Or you can use a different database locally. In any case the database connection string is going to be different on the host than on your home machine. Hopefully the connection string is in user.config, if user.config exists in the root of the site then it will use the connection string from user.config, else it will use it from Web.config.

So the idea is that your local user.config would not be the same as the one at your host and you would not want to overwrite the either of them with the other one or it will break your connection and give you the error you have now saying it can't connect to the database. Your local user.config connection string would point to your local SQLExpress database assuming you have one and the one on the server would point to the database provided by the host.

SQL CE is not the same as SQL Express/SQL Server. It is the easiest to work with because it is a file based database and there is no software to install, so copying the site already does copy the database since it is just a file on disk. But still with SQL CE you have to be careful to not copy over the database on the server with the local one that is not up to date or you would lose data. While SQL CE is the easiest to use since it doesn't require SQL Server to be installed, it is not going to perform as well as SQL Server, so given a choice I would rather have the more difficult installation/configuration and use a more robust db unless I'm just toying around.

You cannot easily go back and forth between SQL CE and SQL Server. There is a way to migrate from SQL CE to SQL Server/SQLExpress, but once done you would not want to go back.

Hope that helps,

Joe

6/14/2011 5:55:10 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

Hi Joe,

Thanks for your reply and for clearing up a few things.

I'm still a bit confused though. I started off with a working local copy of my website. I uploaded that to the net, and it still worked - even though it has the same user.config (which I believe has the connection string in it with the correct details for my local setup). WebMatrix has a settings page which asks for a handful of settings, one being the connection string for the remote (internet) database - so I guess that must go somewhere?

I added a couple of pages to the remote website, then used WebMatrix to download it to my local site. I did a text search for mtlAdmin (the user name flagged up in the error message) in the whole of the local site and the only one found is in the connection string in user.config - which has correct details for my local setup.

I'm currently trying this again - doing a 'round trip' with a new default MojoPortal installation and with different user names & db names for remote & local to see if that sheds any light. (I tried that already and got a collation conflict but I'm hoping if I do it again I wont get a similar error).

I'll post again with the results of that but in the mean time if you have any other ideas they would be gratefully received.

Many thanks for your great product MojoPortal,

Spike

6/14/2011 7:34:28 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

Well, I believe I've proved that the upload / download works by uploading a default install, changing the site name remotely then downloading (including the database) and that worked fine.

Tried downloading my real site again - same problem. Could there be some problem with the database? If so, why does the remote site still work? I'm still puzzled.

6/14/2011 8:55:14 PM
Gravatar
Total Posts 55
mojoPortal Community Expert
Arvixe Web Hosting / mojoPortal Community Liaison Looking for quality mojoPortal hosting? Try Arvixe Check out the MojoPortal Blogs at Arvixe

Re: Database error after downloading from a remote to a local site

At last I think I may have got there!

When I created my database on the hosting account I used the same user name as I had on my local database. Seems this is a no-no as the local database also stores the remote database user names (presumably this only happens on download) and because the local & remote user names were the same the local one got wiped.

That certainly caused me a bit of head scratching.

Looks like MojoPortal runs its installation routine after a download. Not sure why but presumably that won't cause any problems? (maybe it was just a symptom of the messing about I did trying to get to the bottom of this).

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