Posts tagged with 'vistadb'

Converting GraffitiCMS from VistaDB to SQL Server on GoDaddy

Is that SEO-specific enough, do you think? Heh. Anyway, here's the situation. I started this blog using GraffitiCMS about a year ago, previously having used static web pages created with CityDesk. All my sites are hosted on GoDaddy: I went with a Deluxe hosting option which means I can host pretty much as many sites as I want to in the same single folder tree.

At the time — can't remember why — I decided to stick with the default VistaDB as the database instead of opting to go to SQL Server. Throughout the year, things have been good, no issues whatsoever, so my decision seemed sane. Until about two weeks ago that is, when everything went to hell in a handcart in a hurry. Essentially, for a whole week, this blog went offline:

Visits fall off a cliff 

I still don't know what was up. I uploaded a blog post the day before, then, blam, November 15th was a black hole that lasted 6 days. As detailed here, I tried to fix it once I was back home from PDC — thought I'd had, but ever since it's been acting weird. Every now and then, for no discernable reason I can see, some process (obviously an ASP.NET IIS process) locks some section of the VistaDB database file and it's curtains for the blog until the process resets, several hours later. I'm guessing that it's some bug in GraffitiCMS and one request is hanging, causing everything else to hang. Or it's because something is timing out from taking too long. At any rate the log slowly starts to fill up with errors, since every three minutes or so some process kicks off to clean out deleted records:

Error logs

Plus the site has suddenly been acting as if it's very tired. It's just been plain slow. Just nasty to use (I was counting something like 7 seconds for a blog post to come up).

Finally yesterday I'd had enough. The site locked up again (for about 5 hours this time), so it was just time to move to SQL Server. At least with that I have some diagnostic tools and the like to find out what's going on.

With my GoDaddy hosting plan I have the ability to have up to 2 SQL Server databases. Not many, Benny, but then again I only need one. First problem is that, by default, GoDaddy does not expose your SQL Server database for remote access. They provide a nice web-based tool to manage your database, but it seemed a little limiting to me: I wanted to use SQL Server Management Studio to manage my database. Plus, the only way I was going to be able to get all my data into the database was to do it via a remote connection.

So I fired off an email to support asking for the right to access my database remotely. I got a reply back after three hours saying that I should delete my current databases (after backing them up of course). Also they had to move my whole domain onto another hosting server in order to allow remote access to the database. No problem (I only had a test database to try out the standard GoDaddy tools and this was soon dropped), so I quickly replied that my domain was ready to be moved. Four hours later, I got a reply saying, in effect, that "due to its complex nature, your issue has been relayed to our Advanced Technical Support Team". OK, I let support take their course and went to bed.

This morning, I had a slew of messages saying that the move had been successful and that I could now access SQL Server remotely. Amazingly the whole site was much more responsive than before: I reckon the previous hosting server was a bit overloaded (perhaps this was also part of my problem?). This evening, then, was the time for the Big Conversion.

1. I logged into my hosting account on GoDaddy and created a new database. On the database creation page was a radio button to state whether this database could be connected to remotely or not, something that had been missing before:

Remote access FTW 

I made sure that the button was set to Yes. 5 minutes or so later, the database had been created.

2. I fired up SQL Server Management Studio (SSMS) 2008 and connected to the SQL Server URL given by the database configuration page, providing the user name and password I'd set up for the database. It connected just fine.

3. However, when I tried to open the Databases node in the Object Explorer, I got SQL Server error 916. My credentials were not able to access another database I'd never heard of. I went back to the SSMS server login dialog, and added my database name. Same error. I googled for the answer and found this article by Clay Burt that described the same issue. It made reference to this Microsoft Connect post about how to fix the problem. Once I did this and refreshed, I saw a huge long list of the databases on the server, of which mine was one. (Of course, the only database I was able to open was my own.)

4. I opened my database in SSMS and then ran the Graffiti_SQL_Schema.sql script (it's in the top level \Data folder of the GraffitiCMS install). This created the database schema that Graffiti uses. Then it was time for the data.

5. I copied my whole GraffitiCMS site from GoDaddy onto my local disk. I normally do this for backups every couple of days anyway, but this time I wanted to make sure I had the latest, most-up-to-date Vista VDB3 database file. I was going to be using the DataMover utility to copy the data over to SQL Server. I set an "under repair" default.html file in the root folder so that visitors would know something was going on.

6. Now it was time for DataMover. This utility is found in the \Data\Utility\Migrations folder of the GraffitiCMS install. It requires two databases: the source and the destination. For the source, I browsed to the folder containing the VDB3 file I'd just downloaded, and for the target, I entered in the .NET connection string that pointed to the GoDaddy SQL Server instance that was hosting my database. (GoDaddy provide this in their database control panel. Open the database control panel, click on the pencil icon next to your database, then click on Configuration. Find the one that says .NET, it's just a case of selecting it all, copy-and-pasting it, and then overwriting the dummy password with the real one). I clicked Copy Data and then started to write this blog post about how I did it all.

7. Once all the data had been copied to the SQL Server database, it was time to fix the web.config file that I'd downloaded. First of all, I located the current connection string. It looked like this for me:

<add name="Graffiti" connectionString="Data Source=|DATADIRECTORY|\boyetblog.vdb3" />

I changed it to look like this (with certain values changed to protect the innocent, namely, me):

<add name="Graffiti" connectionString="Data Source=boyetblog.db.999999999.hostedresource.com;Initial Catalog=BoyetBlog;Persist Security Info=True;User ID=userid;Password=password;" />

Now I had to change the data provider. Further down web.config, there's a line that said:

<add key="DataBuddy::Provider" value="DataBuddy.VistaDBProvider, DataBuddy"/>

And I changed it to look like this:

<add key="DataBuddy::Provider" value="DataBuddy.SQL2K5DataProvider, DataBuddy"/>

I then uploaded the changed web.config file to the root of my blog site.

8. Time to test. I played around with as many features of the site that I could, especially the admin pages, including reporting. All seemed to work just fine. In fact, better than that, it is rip-roaringly fast. Having the database engine on a separate machine from the hosted web server is just slick like skates on ice.

 

Album cover for World MachineNow playing:
Level 42 - World Machine
(from World Machine)


Fixing site problems

Bang in the middle of my trip to Los Angeles for PDC, on 15th November, this GraffitiCMS site you are reading (http://blog.boyet.com/) went down. Hard. It seemed to happen just after my last post as well.

I added a "site under repair" default.html file to the root directory while I investigated (it would be picked up first if no filename is entered in a browser address bar). I had absolutely no idea what was wrong. I couldn't log into the site (indeed, the main page didn't even come up) to check out the error logs. The site is hosted on GoDaddy, but when logged into that I couldn't see anywhere that described what was up. I could FTP into the file system on GoDaddy's servers, so I did make a backup just in case. I even reset the whole application on GoDaddy, removing it from IIS, and re-adding it, hoping that would help. After downloading the whole site via FTP, I attached to the local version with the IIS running on may laptop and it seemed to come up just fine.

Another problem was that even when the main page was up (it was as slow as heck in doing so), clicking on an in-site link would crash the application, producing the GraffitiCMS error page. Again, no idea why.

Finally I decided to take a look this evening. I downloaded the site again, this time to my desktop. I attached the local site to IIS7 and investigated. Pretty soon I got a server error (a Yellow Screen of Death) which indicated that I had a duplicate key in graffiti_Post_Statistics. OK, then. Onto the next problem.

I'm using GraffitiCMS in its default mode, using a VistaDB database. The only database management tool for VistaDB databases is part of the VistaDB database engine itself. Using a helpful post from DamianM (Migrating Graffiti CMS from VistaDB to SQL Server), I downloaded a trial version of VistaDB 3 and installed it. I then ran the Data Builder tool that's part of the product to repair and pack the database. I still got a duplicate key error on running the site, so I went back into the tool and deleted the record causing the key violation. After that all was fine: the site came up and I could navigate through to in-site URLs. I then uploaded the fixed database to GoDaddy's servers and the public site worked perfectly again.

However, this does not bode well for the future. The VistaDB trial I installed runs out in 29 days (it's a 30 day trial). VistaDB is up to version 4 now, and DamianX intimates that the database file format has changed; in other words, you have to use the Data Builder 3 tool to fix a VistaDB 3 database. I'm going to email Jason Short, the owner of VistaDB, to verify whether this is true or not (I can't find any such information on their site). If so, once the trial runs out, I'm SOL if this problem happens again. (Of course, if the current version of VistaDB works with VDB3 files — without upgrading them to some VDB4 format — then this is no problem.)

Also, although Graffiti comes with a Data Mover application (and you can copy the data for your site from one VistaDB database to another blank one), it would not have solved this particular problem. I had to physically delete the erroneous record from the table. At the very least, Telligent should have provided a simple database repair app with GraffitiCMS(heck, VistaDB provide the source code for Data Builder so you can do exactly that). But then again, Telligent don't particularly care about GraffitiCMS any more — version 2 was due "in early summer", but we now have snow here in Colorado with no new version in sight.

In conclusion, the short-term moral of the tale is that it's time to migrate this site to SQL Server. Not dissing the VistaDB folks here, but a database needs an easily downloadable management tool.

And the long-term moral is to use some other blogging engine.

Now playing:
Kool & the Gang - Jungle Boogie
(from Gold (CD 1))


Search

About Me

I'm Julian M Bucknall, the M because it's my middle initial and because I and the other Julian Bucknall (the movie guy) would like to differentiate ourselves.

I'm a programmer by trade, an actor by ambition, and an algorithms guy by osmosis. I write articles for PCPlus in my spare time, not that there's much of that.

Julian M Bucknall Apart from that, an ex-pat Brit, atheist, microbrew enthusiast, Pet Shop Boys fanboy, slide rule and HP calculator collector, amateur photographer, Altoids muncher.

DevExpress

I'm Chief Technology Officer at Developer Express, a software company that writes some great controls and tools for .NET and Delphi. I'm responsible for the technology oversight and vision of the company.

Validation

Validate markup as HTML5 (beta)     Validate CSS

Bottom swirl

Archives

February 2012 (4)
SMTWTFS
« Jan  
1234
567891011
12131415161718
19202122232425
26272829

Like this Archive Calendar widget? Download it here.

Social networking

Google ads

The OUT Campaign

The OUT Campaign

My Tweets

Bottom swirl