SQL Driver Sample Programs

From CometWiki

(Difference between revisions)
Jump to: navigation, search
Line 5: Line 5:
In order to start using the SQL Driver in Comet, you must have access to a MySql database somewhere.  It can be on your local machine, on the local network, or out on the internet somewhere.  If you already have a MySql database server installed and configured, please skip forward to the [[#Example Database and Tables|Example Database and Tables]] section.
In order to start using the SQL Driver in Comet, you must have access to a MySql database somewhere.  It can be on your local machine, on the local network, or out on the internet somewhere.  If you already have a MySql database server installed and configured, please skip forward to the [[#Example Database and Tables|Example Database and Tables]] section.
-
If you are setting up a MySql server, we recommend you download the free Community Server version of [http://dev.mysql.com/downloads/mysql/5.1.html#downloads MySql 5.1].  This is simply because we have been using mostly version 5.1 for testing, but the SQL driver should work with all 5.x and later versions of MySql server.  Once you have downloaded the MSI installer, install it on your local machine (if you are simply testing), or on your server if you wish to host your MySql data elsewhere.  Once the installation is complete, the wizard should automatically start the MySql configuration utility, which guides you through the rest of the set up process.  If not, you can find it usually under <nowiki>Start->Programs->MySQL->MySQL Server X.X->MySQL Server Instance Config Wizard</nowiki>
+
If you are setting up a MySql server, we recommend you download the free Community Server version of [http://dev.mysql.com/downloads/mysql/5.1.html#downloads MySql 5.1].  This is simply because we have been using mostly version 5.1 for testing, but the SQL driver should work with all 5.x and later versions of MySql server.  Once you have downloaded the MSI installer, install it on your local machine (if you are simply testing), or on your server if you wish to host your MySql data elsewhere.  We strongly recommend installation on your local workstation for testing purposes in order to cut out problems that might occur with network/internet protocol issues.  Once the installation is complete, the wizard should automatically start the MySql configuration utility, which guides you through the rest of the set up process.  If not, you can find it usually under Start->Programs->MySQL->MySQL Server X.X->MySQL Server Instance Config Wizard
-
==Configuring MSsql==
+
==Configuring MySql Community Server==
 +
 
 +
If you are configuring MySql Community Server to serve data for anything more than testing, we recommend you refer to the [http://dev.mysql.com/doc/refman/5.1/en/ MySql 5.1 Reference Manual], otherwise for simple testing purposes, the configuration wizard is fairly straightforward.  In general, the defaults for all of the wizard options are acceptable, save a few points which we will outline here.  Again, refer to the official documentation for more details on the available configuration options.
 +
 
 +
If you are running your database server on a networked machine, make sure you enable the TCP/IP networking option, as well as add the firewall exception to windows.  We will not cover any details for setting up your MySql server to handle database requests on the network or internet.  We recommend that you also install MySql as a Windows service, even if are only using it for testing.  There are some options that are set and new configuration options become available when you select this, which just makes everything easier.  You can always disable the service after the installation is complete.  Also, if you want to access any of the MySql utilities from the command prompt, we also recommend you check the option to include bin directory in windows PATH.  Lastly, make sure you enter a root password - leaving root passwords blank is bad form, even for testing.
 +
 
 +
Although it is also bad form to use the root account to access your MySql data, we are going to anyways to simply the configuration process.  If you would like to add your own user, please refer to the [http://dev.mysql.com/doc/refman/5.1/en/adding-users.html Adding User Accounts] section of the MySql documentation.  Make sure you create the user and grant the user rights to access and update the tables specified in the following section.  You will also have to change the user name used in the sample IB programs to connect to the MySql database.
==Example Database and Tables==
==Example Database and Tables==
 +
 +
==Example IB Programs==
==Example IB Programs==

Revision as of 17:59, 4 December 2009

This page shows how to set up MySql and sample IB programs to give you a better idea how the SQL Driver works in Comet. Please refer to the SQL Driver page for a more thorough reference.

Contents

Installing MySql Community Server

In order to start using the SQL Driver in Comet, you must have access to a MySql database somewhere. It can be on your local machine, on the local network, or out on the internet somewhere. If you already have a MySql database server installed and configured, please skip forward to the Example Database and Tables section.

If you are setting up a MySql server, we recommend you download the free Community Server version of MySql 5.1. This is simply because we have been using mostly version 5.1 for testing, but the SQL driver should work with all 5.x and later versions of MySql server. Once you have downloaded the MSI installer, install it on your local machine (if you are simply testing), or on your server if you wish to host your MySql data elsewhere. We strongly recommend installation on your local workstation for testing purposes in order to cut out problems that might occur with network/internet protocol issues. Once the installation is complete, the wizard should automatically start the MySql configuration utility, which guides you through the rest of the set up process. If not, you can find it usually under Start->Programs->MySQL->MySQL Server X.X->MySQL Server Instance Config Wizard

Configuring MySql Community Server

If you are configuring MySql Community Server to serve data for anything more than testing, we recommend you refer to the MySql 5.1 Reference Manual, otherwise for simple testing purposes, the configuration wizard is fairly straightforward. In general, the defaults for all of the wizard options are acceptable, save a few points which we will outline here. Again, refer to the official documentation for more details on the available configuration options.

If you are running your database server on a networked machine, make sure you enable the TCP/IP networking option, as well as add the firewall exception to windows. We will not cover any details for setting up your MySql server to handle database requests on the network or internet. We recommend that you also install MySql as a Windows service, even if are only using it for testing. There are some options that are set and new configuration options become available when you select this, which just makes everything easier. You can always disable the service after the installation is complete. Also, if you want to access any of the MySql utilities from the command prompt, we also recommend you check the option to include bin directory in windows PATH. Lastly, make sure you enter a root password - leaving root passwords blank is bad form, even for testing.

Although it is also bad form to use the root account to access your MySql data, we are going to anyways to simply the configuration process. If you would like to add your own user, please refer to the Adding User Accounts section of the MySql documentation. Make sure you create the user and grant the user rights to access and update the tables specified in the following section. You will also have to change the user name used in the sample IB programs to connect to the MySql database.

Example Database and Tables

Example IB Programs