BaH.DBMySQL tutorial for newbie?

BlitzMax Forums/Brucey's Modules/BaH.DBMySQL tutorial for newbie?

Rixarn(Posted 2009) [#1]
Hi! I have previously used Bah.DBSQLite module and it works like a charm! but now i want to do the same thing in MySQL and i'm totally clueless about what to do :( i have downloaded Sunīs MYSQL server 5.1 and 30 day trial version of navicat...

Is there anyone that can help me? thanks!


xlsior(Posted 2009) [#2]
Never used Navicat, but personally I like MySQL Control Center:
http://sourceforge.net/projects/mysqlcc/

(Free to use, so no trial version necessary)


Brucey(Posted 2009) [#3]
I know this is possibly overkill (well, it is, if you only want an SQL server), but you might look at something like LAMP or XAMPP.
Basically, it's everything you need to run a webserver instance, including MySQL, Apache, PHP, etc.
But it does come nicely pre-configured, and with something called phpMyAdmin, which is a web-frontend to MySQL.

But it depends how much you want/need to learn about MySQL before you get to the point of actually using it :-)


Htbaa(Posted 2009) [#4]
All you really need is MySQL Query Browser :-)


Winni(Posted 2009) [#5]
Remember that MySQL is licensed under the GPL and that you have to open source your own application as well when you use the MySQL server -- unless you purchase the proprietary/commercial version of MySQL.

The good news is that MySQL has an excellent documentation which can be downloaded in PDF form from the MySQL AB website. READ IT.

If you want to avoid those licensing issues, use PostgreSQL instead of MySQL. It is licensed under the BSD license and is generally a more capable and powerful product than MySQL anyway. It also has an excellent documentation.

www.postgresql.org


Brucey(Posted 2009) [#6]
Then of course there's Oracle.

It's quite good, apparently.


Rixarn(Posted 2009) [#7]
Thanks all for posting :)

@xlsior I'll give it a try, since i wont have navicat in a month :)

@HTbaa since im a total newb, i think i find the Query Browser a little hard to use than other visual programs

@Brucey , Im doing a cognitive training system (something similar, but not equal to Facebook's Who has the biggest brain). A home version of it uses SQLite (since it records your time of response, successes, errors, for every game for every play) But the version i need to mod is for a University here in Mexico, they want to install it on a server and use the software with some kind of virtualization tool of Novel in their Local-Networked computers. So i'm forced to drop SQLite, in favor of a non-serverless SQL. I know little or nothing about LAMP (sorry bout the noob question, but this stands for Linux Apache MySQL PHP?), but i'll download them and give it a try :) But Now that Winni just scared me with the GPL licensing :O (BTW my proyect couldn't possibly exist if it werent for your modules, BIG thanks man... if i manage to sell copies of my software ill be sure to remember donating :) )

@Winni Youīre saying that if i use MySQL in my program, i have to opensource my app? Omg if that's true, then i can't use MySQL...Then i'll look into postgresql and oracle... i have 2 weeks left to make this so i'll better start studying


Sanctus(Posted 2009) [#8]
@Winni
That's false. You only have to open source the application (or pay) if you plan to publish the part where you use the database part.
For example if you make a online game where the client doesn't have to do anything with the database which is only modified by the server then you are free to use it without opensource-ing the project or paying anything. You can also sell the game.
I just talked with the support of MySQL about this.


mic_pringle(Posted 2009) [#9]
@All

I think perhaps you all misunderstand what the GPL and opensource means.

You can use MySQL (or any opensource package licensed under the GPL) in any application you like, for free. You only have make available any changes you make to the original source.

So if you use it as stock, then you have no need to worry about breaking any licenses. If you make any changes to the original source, you need to publish only those changes, as a patch file or similar, not the entire source for the whole project.

That's the whole idea behind opensource. When people use the software in their own projects, they contribute back any changes they make, so if necessary they can be included in the main source, benefitting everyone.

-Mic


Brucey(Posted 2009) [#10]
You can use MySQL (or any opensource package licensed under the GPL) in any application you like, for free. You only have make available any changes you make to the original source.

No. That's not an accurate statement.

One of the reasons I stay well clear of GPL libraries, is that by using them I would have to make my module GPL. This in turn would require the user to release their application as GPL.

This is why it is called a "viral" license, I imagine.

As far as I am aware, with regards to MySQL, simply "connecting" to a MySQL database doesn't require the connecting software to be GPL'd. Of course the license of the "connector" dll may come into this.


mic_pringle(Posted 2009) [#11]
@Brucey

I'm afraid I'd have to disagree. I have read and re-read the GPL several times and I'm positive it only applies to the software and chages made to that software released under that license.

If I release some software that uses MySQL as a backend, I should include the MySQL source, and a copy of the GPL in my package. Or at least make that source available on request.

If I make changes to the MySQL source, then those changes automatically inherit the GPL (only if I decide to make them available to the public) and I have to make those changes available, along with a copy of the GPL. Or at least make those changes available on request.

However, if I just use MySQL as a backend, and access it through a driver for example, the software I write to do this is not a derivative of the MySQL source, and therefore I can release it under any license I so desire and charge for it if I so wish, with absolutley no requirement what so ever to release the source code for my application.

-Mic


Brucey(Posted 2009) [#12]
No. I think you are confusing LGPL with GPL. :-)

If I have an LGPL library - say for example, Qt, I can link to the DLLs and use any license on my own code which uses this library.
However, I cannot link to static-binaries of this library, because LGPL states that my code becomes a derivative, and therefore I must license my code as GPL.

Differently, wxWidgets, although being essentially an LGPL'd library, has an exclusion clause which allows static-linking of the library. With this rule, I can static-link my own code and give it any license I choose.

If a library is GPL, unless there is a clause somewhere which allows runtime linking, your own code has to fall under the umbrella of the GPL.

As an example of this. Qt used to have a GPL license on Windows. This meant, unless you were using the commercial license variant of it, your code would have to be GPL'd too - even if you were only using the DLLs.
This is why they recently changed their license to be LGPL, because it is slightly more permissive, and is likely therefore to have wider adoption.

Anyway, if you peruse the many webpages and posts on the subject, you'll find there's much confusion on how to interpret the GPL.

The GPL is viral, and I try not to get involved with it if I can help myself.
I much prefer MIT/Apache/BSD style licenses, and occasionally LGPL if the library is easy to build (myself) for MinGW.


mic_pringle(Posted 2009) [#13]
@Brucey

I whole heartedly agree that there is much confusion on how to best interpret the GPL, especially now you've thrown in the LGPL which opens up a whole new can o' worms :-)

I also have to agree that the MIT/Apache/BSD alternatives are a much better choice.

-Mic


TieBender(Posted 2009) [#14]
OK, everyone is discussing GPL and license, but what about the question by Rixarn?

****************
Hi! I have previously used Bah.DBSQLite module and it works like a charm! but now i want to do the same thing in MySQL and i'm totally clueless about what to do :( i have downloaded Sunīs MYSQL server 5.1 and 30 day trial version of navicat...

Is there anyone that can help me? thanks!
***************

I want to know as well, plz.
Also, it would be really nice, if someone would be so kind as to clarify to me:
Does Brucey's MySQL run by PHP?
Does Brucey's MySQL run in Blitz3D?
Where can I get Brucey's MySQL? (ddl, decl etc.)

In the case that Brucey's MySQL does indeed need PHP or Blitz3D does not support it, then please, someone, inform me of something that works for Blitz3D and (importantly) where I can get it.


Thanks a bunch!
Tie


Pete Rigz(Posted 2009) [#15]
Brucey's module won't work for Blitz3d as it's a Blitzmax module. However you might want to have a look at ETNA, which may fulfil your needs: http://repeatuntil.free.fr/Etna/index.html


Brucey(Posted 2009) [#16]
To use the MySQL database module, you need BlitzMax, and a running MySQL database server.

Rather than do a fresh install of MySQL, it may be better for you - to begin with - to use a MySQL server that comes preconfigured with one of the many Apache/MySQL/PHP distributions - because you simply install it, start it, and you can start using it immediately.
The one I like to use is XAMPP.
As I mentioned in an earlier post, it comes with a nice PHP-based administration app.

Does Brucey's MySQL run by PHP?

No. MySQL runs as a standalone server. You connect to it directly via the module.

Does Brucey's MySQL run in Blitz3D?

No. But I'm sure someone has probably already written a userlib for it.

Where can I get Brucey's MySQL?

You can download both BaH.Database and BaH.DBMySQL modules from my google code site.

:-)


Brucey(Posted 2009) [#17]
I stumbled onto MySQL Workbench today.
It's a fantastic, free, schema design tool.

If I'd known about it beforehand, I probably wouldn't have mocked up my design using google docs image editor (which is itself very good, I have to say).

So I've now migrated the model into Workbench, added the relationships, and "synch'd" the model with the database. As if by magic, it has created all the tables, indexes and foreign key constraints :-)

For data entry, etc, I still use phpMyAdmin.


Just FYI :-)