Using PHAkT v1.0: Connecting to a MySQL Database using MyODBC

Connecting to a MySQL Database from within UltraDev can be a little daunting, especially if you're new to UltraDev. This tutorial explains how to connect to a MySQL database using MyODBC. Extremely usefull for PHAkt users!

Using PHAkT v1.0

Connecting to a MySQL Database using MyODBC

Now that you have successfully installed the MyODBC Driver ( Stage 1 ) and created a MyODBC DataSource ( Stage 2 ), you are ready to use your new connection within UltraDev.

Stage 3. Creating a Connection in UltraDev with the PHP Server Model.

This is the final stage of configuration.

Start UltraDev and open or create a page. Open the Data Bindings palette (Ctrl+F10, or Window->Data Bindings).

Click on the Define Connection button, and you should get a large window looking like this :-

Using the information that you should have from Stage 2 you can now complete this form. Use the following points to help you :-

In the UltraDev Connection Section

  1. Connection Name: Should always start with 'conn' for example 'connMyDatabase'. This is so that whenever you look at the source code you will know immediately that any occurrence of connMyDatabase refers to your connection.
  2. DB Type: Should in this instance be set to ODBC. The check radio button is not used for ODBC connections.
  3. URL: This is where most people make a mistake, in that they replace all of the original value in this box, you should NOT delete this value. The original value in this box will be either jdbc:odbc:DSN or jdbc:odbc:DSN_name, depending on your version of PHAkT. You should replace the word DSN (or DSN_name) with the name of the DSN you created in Stage 2. Following the example in Stage 2 you should have an entry in this box that looks like : jdbc:odbc:MySQLDataSource.
  4. User Name: This should be your MySQL Username
  5. Password: This should be your MySQL Password

In the PHP Connection Section

  1. dB Type: Should be set to MySQL.
  2. Host: Should be the Hostname or IP Address of the MySQL Server.
  3. User Name: Should be your MySQL Username (yes, you have already entered this above)
  4. Password: Should be your MySQL Password (yes, you have already entered this too).

Why do you have to duplicate the MySQL information ? Well, there are times when you want to work using one server for development, and another server for actual deployment. In these situations, before deploying your site you would edit the connection, and enter the information for your deployment MySQL server in the PHP Connection section above. When you do this the two sets of information will be different.

Once you have completed this form, click on Test. An alert box should pop up saying 'Connection was made successfully'. Click on OK and you have completed Stage 3, and you are ready to use the Database functions within UltraDev.

<<< Previous Page

Tim Green

Tim Green36 Years Old and recently married. Initially started as a COBOL, PASCAL, FORTRAN, ALGOL, 6502 and Z80 Assembly language programmer at age 16.

At age 19 I chased a career in acting where I had a couple of 'Extra' roles and appeared in 'Robin Hood' (no not the Kevin Costner one). Missed out on my big break when I contracted pneumonia which stopped me working on Aliens 3.

Following a 5 year stretch as a casual barman, chef and waiter on Spain's Costa Brava, I returned to the UK where I began work, on a VERY busy IT Support helpline.

Quickly moving through the ranks to Team Leader of Hardware, Software, 2nd level and Principle Support, I finally left after raising the service level from 17% to 98% and getting demoted by way of reward.

CEO of The Rawveg Consultancy, I provide custom extension development services, IT Consultancy, B2B and eBusiness consultancy services.

See All Postings From Tim Green >>

Comments

Be the first to write a comment

You must me logged in to write a comment.