Thursday, June 25, 2009

Aubit4GL: mysql connection specification

Since this is not well documented on Aubit4gl site, posting here:

To connect to mysql database:

  1. Make sure your mysql server is not bound to localhost - even local connections are via hostname
  2. Make sure you can connect to mysql server.. grant at least select privs using "grant select on db.* to 'test'@'hostname' identified by 'test';" NOTE: localhost privs are not enough - connection thru hostname.
  3. Do "export MYSQL_SERVER=hostname"
  4. Set/export the following environment variables:
A4GL_SQLUID=test #whatever connection user is
A4GL_SQLPWD=test #whatever connection password is

And now take the simple.4gl program:

database test # of whatever your database name is

display "Hello World"
end main

Compile with : aubit 4glpc simple.4gl -o simple.4ae

If it compiles - database connection is ok!

Thanks to Mike's comment below - using .aubit4gl.acl to store database:user:pw DOES work.. just be sure to "unset A4GL_SQLUID" and "unset A4GL_SQLPWD".


  1. Hi there..
    The ACL file should work for MYSQL too - but only if SQLUID and SQLPWD are not set in the environment.
    If either are set - it thinks you want to override the values in the ACLFILE..

    If that still doesn't work - let me know and I'll investigate..

    Mike A.

  2. Hi Mike,

    Tried again unsetting those variables and you are correct!! It does work.. will amend post.