MIgrate data from XML to database

Topics: ASP.NET 2.0
May 22, 2008 at 8:10 AM
Hi,

I would like to migrate post data from XML to database. Is there an easier way to do this other than writing migration code? Also, copy-paste is not a good option in my scenario as I have a lot of posts and users.

Thanks,
Rachit
May 22, 2008 at 8:42 PM
I think that's the only way to do it. The code to achieve this is pretty easy to write I think if you have direct access to the database and the xml files. If you need some help, just ask.
Coordinator
May 22, 2008 at 10:13 PM
Go to settings page, scroll all the way down to import/export section and click "export" button. It will export your current blog into XML (BlogML) file. Then change provider to SQL server, again settings page, this time click "import". It will launch importer application. Tell it where to find that XML file and it will load your data into database, no code required.
May 22, 2008 at 10:51 PM
Two quick questions...

1.  Why would you want to use SQL for storing your Blog entries?  Not that there is anything wrong with this, it's just that unless you are having many, many users connecting to your blog the performance isn't going to be any different.  In fact it could be slower if you are running SQL on the same server, or if you have a slow/unreliable connection to the SQL server.  My personal opinion is to stay with XML for ease of backup and management unless you are seeing a serious number of concurrent users comming to your site...

2.  Does the BlogML export/include procedure include the categories and such?  I remember when I switched from Blogger to BlogEngine.NET the categories did not come over correctly...

Chris
May 27, 2008 at 6:34 AM

In BlogEngine.NET, whether you use XML or database there would be not much difference since it uses a lot of caching implemented as singleton. Once data is cached, application code would deal with in-memory data than persistence storage. If your website is popular, then the cache would stay longer since there are many user accessing your website causing your web application to stay alive.

But I personally prefer database than XML files because:

1. My username and password would not be stored in a plain text file where anyone who got access to the file can see it.

2. I'm a developer, so I can also put other extra integrity constraint on the tables, which I can't do to XML files.

3. If someday I need to search data based on certain criteria, database could give you advantage since they are optimized to do that.

4. I can integrate blog engine with other application that already store data in the database.

Regards,
Agus Suhanto
http://suhanto.com

 

Jul 1, 2008 at 10:45 AM
I'm loving BlogEngine.NET but this Importer-Application is driving me crazy... !!

I also want to switch from the XML-Provider to the SQL-Provider. Exporting all posts was done in a few seconds. But everytime I want to import the resulting BlogML.xml file (after switching to SQL-Provider in the web.config) I just get a error-message "The username or password is incorrect". I double-checked my input and wether my username nor my password are incorect, the importer just isn't capable of importing my postings into the blog.

*nag nag*

Any solution for this problem?

Best regards,
Gordon Breuer
Aug 18, 2008 at 4:00 PM
I'm in the process of upgrading 1.4.0.0 to 1.4.5 and am tackling the XML to SQL as part of an upgrade for a mate at MostlySafeForWork.

I'm doing a test upgrade of to a local C:\inetpub\wwwroot\test site before trying live site.

I hope this helps someone:
1. Using Version 1.4.0.0.
2. (At least for me) The Blog Importer can only be launched from Microsoft Internet Explorer (I'm using 7.0). FF just offers to save the file.
3. My (working) Blog Importer Settings are as follows: (Top-to-Bottom of the Blog Importer application)
(a) Source Type: BlogML
(b) Path: The Full Folder & File Path to the exported BlogML.xml file (e.g. C:\Document and Settings\[me]\Desktop\BlogML.xml)
(c) Files & Images: Download Blog Files and Images
(d) File Path: C:\download\MSFW_files (this is an FTP download of the site www\App_Data\Files folder)
-- Click the validate to Check = "Blog ML validates correctly." --

4. Blog Url: http://localhost/test/ (this is the URL of my local test migration site)
5. Login: Admin
6. Password: admin
-- Click Validate to Check you can login to your site = "Blog validates correctly."
7. I haven't used any Advanced Options
8. Click the Import button.

As I'm using a local IIS site I wasn't too concerned with invalid image source URLs. Therefore image URLS were missing the local Virtual Directory site name "test". If I edit the HTML adding "test", this then corrected the invalid image URL. I'll update to 1.4.5.0, re-test and then Go for Gold* on live site tomorrow.

Nick Harrington

* only because we British are doing quite well this weekend in the Olympics.


Aug 20, 2008 at 11:23 AM
This is a post-upgrade review following 1.4.0 to 1.4.5 and BlogML import to a MS-SQL Server database.

Only minor issues to report:

1. BlogML Import doesn't import any Tags. You need to re-add these manually.
2. Pages are not migrated. You need to re-create these -- so check you have a backup before migration.
3. All of your existing BE site settings are (of course) not migrated. You need to re-configure Analytics, SnapShots, Mail Settings, sitename, etc.
4. Posts containing * (asterix) within post Title and Slug cannot be retrieved with "Bad Request" returned on accessing a post. The BlogML Import routine needs to probably manage these characters with a replace. I'm guessing this is causing a SQL error.

A successful migration!

Nick

Post script:
327 posts in a 5Mb SQL database. Not bad at all.
Aug 21, 2008 at 6:00 PM
There needs to be a better mechanism for moving from one system to another.  When I upgraded from 1.3.1 to 1.4.5, I didn't want to have to upgrade the database, so I attempted to move from SQL back to Xml.  But too much data was lost in the BlogML file, so I was pretty much forced to stay as SQL.

...Matt
Aug 21, 2008 at 9:17 PM
I just finished reading the details on BlogML and it seems to do this type of conversion...

Ability to port blog content between Storage Providers: This is the case where you might be using a blogging engine such as Single User Blog and you are running off of one provider - such as DotTextProvider (where the content reads and writes to an existing .Text schema) and you want to continue to use Single User Blog but move to a new data structure. In this case you would configure Single User Blog to use the DotTextProvider and run an "Export to BlogML" function, then you would re-configure your provider to your native provider and run the "Import from BlogML" function.

Might be worth a shot...

Chris