Creating MySQL support Options
Ruben
Posted: Friday, December 21, 2007 1:34:48 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Hi there,

I'm a C# developer and I want to create MySQL support for umbraco.

What do you think would be the best way to provide this?

What I was thinking:

* Extending the MS Enterprise Library with wrappers for MySQL Connector
(much like http://www.codeproject.com/KB/database/MySQL_connector_for_MSEL.aspx)

I'm not familiar with the Enterprise Library, but I learn fast :)

Second question:
Database methods always look like SqlHelper.ExecuteReader(GlobalSettings.DbDSN, ...

Would it be possible to let the SqlHelper decide, based on the DbDSN string, what database class to use? Does anyone know how exactly this works, and where I can find sufficient documentation?

Thanks!

Ruben

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Friday, December 21, 2007 1:37:10 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Third question: What version of the Enterprise Library does umbraco 3.0 use?

I see Microsoft.ApplicationBlocks.Data.dll has version 1.0.1559.20655, but what library version is this exactly? Just to make sure I write compatible code.

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Friday, December 21, 2007 1:46:05 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
This could be a starting point: http://www.codeproject.com/KB/database/MySql_with_Ent_Lib.aspx

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
sjors
Posted: Friday, December 21, 2007 2:01:58 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 408
Location: Amsterdam
Why would you like to use a inferrior database?
Ruben
Posted: Friday, December 21, 2007 2:36:43 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
"Inferior" depends on one's point of view. Please read http://www.mysql.com/why-mysql/case-studies/ to refine your opinion. (http://articles.techrepublic.com.com/5100-22-1054385.html for a more neutral comparison.)

But to address your question: the main reason is budget. By a lot of hosting companies (including mine), you get a MySQL database for free.

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
sjors
Posted: Friday, December 21, 2007 3:21:14 PM

Rank: Fanatic

Joined: 7/20/2006
Posts: 408
Location: Amsterdam
Ruben wrote:

"Inferior" depends on one's point of view. Please read http://www.mysql.com/why-mysql/case-studies/ to refine your opinion. (http://articles.techrepublic.com.com/5100-22-1054385.html for a more neutral comparison.)

But to address your question: the main reason is budget. By a lot of hosting companies (including mine), you get a MySQL database for free.

That article is full of rubish (its also outdated), main aspects:

-SqlServer Express is free and suites for almost every website
-Writer is talking about performance, LOL in 2003 sqlserver was leading the most respected database benchmark: http://web.archive.org/web/20030412183831/http://www.tpc.org/tpcc/results/tpcc_perf_results.asp
-The part about Replication is hilarious, i can hardly take someone serious who is using words like:
Quote:

In SQL Server, you can also record every SQL statement, but doing so can be costly. I know of one development shop that had to do this because of other architectural issues, and the sheer volume of data that they were storing on tape was quite remarkable. Instead, SQL Server relies on elaborate mechanisms of record and transaction locking, cursor manipulation, and dynamic replication of data to keep database servers synchronized. If you're skilled at juggling these mechanisms, replication is pretty easy

Is this guy talking about the transaction log?


Quote:
Both products have perfectly acceptable default security mechanisms, as long as you follow the manufacturer's directions and keep up with your security patches. Both products operate over well-known default IP ports

Uhm, someone who is putting a database on a non firewalled ported should be fired directly.

I don't want to bash mysql, but the guy who wrote this article can't be taken serious.

And about mysql and Umbraco, someone already started that i think ;)
Maybe its worth to take a look at Microsoft Linq?
drobar
Posted: Friday, December 21, 2007 3:51:38 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,698
Location: KY, USA
As much as I enjoy the banter of argumentation, we should stay on topic and not get sidetracked with debate over the relative merits of various databases. MySQL is certainly adequate to run an umbraco site. As is SQLserver (and Express). As are many others.

The original poster made a valid point that MySQL is often included in a web hosts offerings and wonders if umbraco could be made to work with it rather than SQLserver.

Abstracting the data layer is an involved topic and ongoing discussion. You can pick up the thread at http://www.codeplex.com/umbraco/Thread/View.aspx?ThreadId=2665.

Leonardo in Brazil has been working on making umbraco work in a MONO environment. I haven't seen any updates on progress lately, but his blog provides interesting reading at http://aspnetajax.blogspot.com/.

However... given the abundance of ASP.NET hosting providers that also have SQLserver (or express) support at very reasonable rates, I'm not sure why you would want to attempt to make the code changes to umbraco to enable MySQL support (and deal with the potential bugs). Wouldn't you spend more time and money on the development than you'd save by going with (for example) a $10/month plan at http://www.webhost4life.com or any number of other places?

Feel free to ask for hosting recommendations (webhost4life is simply one I'm familiar with, but certainly isn't the only or even best option for everyone).

Don't let me talk you out of your quest, though. The umbraco community would be very interested in your input and help with the DAL implementation so that everyone could benefit from your efforts!

cheers,
doug.

MVP 2007-2009 - Official Umbraco Trainer for North America - Percipient Studios
psterling@homax
Posted: Friday, December 21, 2007 4:31:55 PM

Rank: Fanatic

Joined: 10/30/2007
Posts: 215
Location: Bellingham
There is a parallel discussion regarding abstracting the Umbraco DAL to the point of the provider model http://forum.umbraco.org/17382 for v4.*.

I, for one, think that implementing a provider model for the DAL offers the 'best' potential to solve lots of issues at once - albeit at a significant effort cost. For many potential Umbraco users I expect being database agnostic will be a very compelling feature.

Even Rob Conery - who created SubSonic and works for Microsoft - says that MySQL is a 'great' database platform.

-Paul

motusconnect.com :: level-2 certified :: MVP 2008/2009
Ruben
Posted: Friday, December 21, 2007 5:01:46 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Let's indeed close the "MySQL is bad"-discussion for now, I'm an IT pro so I know the benefits and drawbacks of a commercial solution. And for this discussion, it doesn't interest me at all. The only thing I know is that I have a client which has 5 medium-size sites I want to port to Umbraco, and he's not going to pay any more just because I'd do something with MS SQL Server that can be done with MySQL as well. (And the hosting firm doesn't allow SQL Server Express). In the IT business, budget and price are that facts, performance comes second.

So, I want to make it MySQL-compatible because:
* I believe an open source platform should be able to work together with open source databases
* MySQL is free
* It is possible

Fact: several persons have started it, none have finished a decent solution as far as I know.

Since the Umbraco code relies specifically on the Enterprise library instead of a self-made data class, I think it's more interesting to extend the Enterprise library instead of all calls to this library. (I'll take a look in the data abstracting forum thread as well).

Could you just help me out with this one: What version of the Enterprise Library does umbraco 3.0 use?

Thanks,

Ruben



Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
psterling@homax
Posted: Friday, December 21, 2007 5:05:40 PM

Rank: Fanatic

Joined: 10/30/2007
Posts: 215
Location: Bellingham
Rueben -

version: 1.0.1559.20655
assembly: Microsoft.ApplicationBlocks.Data.dll

-Paul


motusconnect.com :: level-2 certified :: MVP 2008/2009
Ruben
Posted: Friday, December 21, 2007 5:10:38 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Yes thanks, this is the version information, but to what Microsoft release does this exactly correspond? (Seems they've made a lot of them already). That way, I can obtain the appropriate source.

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Friday, December 21, 2007 5:15:24 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
BTW @Sjors: just got a message from my hosting company (where I've got a reseller account for 50 websites), they won't install SQL Server at any price, so I'm stuck with either an Access of a MySQL database. Seems like an easy choice?

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
psterling@homax
Posted: Friday, December 21, 2007 5:26:44 PM

Rank: Fanatic

Joined: 10/30/2007
Posts: 215
Location: Bellingham
Ruben
Posted: Friday, December 21, 2007 5:31:45 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Thanks.

Tonight, I'm gonna play around a bit, and let you know as soon as I find something.

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Friday, December 21, 2007 5:34:15 PM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
BTW, you can see why I asked: although the assembly version is 1.x, it's part of the Data Access Application Block for .NET v2 :ermm: :)

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Saturday, December 22, 2007 12:44:30 AM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Alright, I've work a few hours, and now I have a datalayer abstraction prototype.
I've only tested it briefly (tired now!) but it seems to work.

Features:
* new assembly "datalayer" providing generic classes for database access
-> Sql Server adapter implemented using Microsoft.ApplicationBlocks.Data
-> Provides a framework to add other databases support, like MySQL
* other assemblies don't rely on the Microsoft.ApplicationBlocks.Data assembly anymore
-> all references in code updated (by hand!)
* main class SqlHelper is a field of BusinessLogic.Application

To do:
* create MySQL layer
-> problems will arise when non-standard SQL is used (sometimes necessary, since the standard doesn't cover it all)
* create more independence

Download: http://www.3click.be/umbraco-datalayer.rar

Tell me guys, what do you think?

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
jesper
Posted: Saturday, December 22, 2007 8:44:45 AM

Rank: Administration

Joined: 7/25/2006
Posts: 415
Location: vipperoed, denmark
I just wan't to say that I think the initiative is great. Even without alternative db providers it will keep the code clean.

I glanced at your code and couldn't figure out how to use it, but I'll have a go later (if Christmas and family allows). If you wan't to ensure that more ppl test it, then throw in some "3 steps to success" or even some binaries.

merry merry

Jesper



webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP
Ruben
Posted: Saturday, December 22, 2007 9:30:52 AM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
Well indeed, it prevents a lot of code replication for data access.

Usage guide:
* extract the original source
* extract my files over it
* open the whole thing with Visual Studio. Your solution must contain the following projects:
- umbraco.businesslogic
- umbraco.cms
- umbraco.controls
- umbraco.CPalmTidy
- umbraco.datalayer
- umbraco.interfaces
- umbraco.presentation
- umbraco.providers

I this explanation sufficient to get it to work?

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
Ruben
Posted: Saturday, December 22, 2007 9:37:31 AM

Rank: Aficionado

Joined: 12/21/2007
Posts: 169
Location: Belgium
You can find the binaries over here: http://www.3click.be/umbraco-datalayer-bin.rar. This package contains all umbraco-specific assemblies.

Ruben Verborgh | Umbraco Core Team Developer | Working on: Data layer table utility. | LinkedIn
hartvig
Posted: Saturday, December 22, 2007 10:18:12 AM

Rank: Addict

Joined: 3/17/2008
Posts: 953
Location: Nyborg, Denmark
Ruben - you should join the core team. This is awesome. Shoot me an e-mail nh AT umbraco (.) dk.

/n

Jeeeez, did I really start this :-)
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.