Since database connections seems to be compile time, and you have to set A4GL_SQLTYPE in order to compile against database X - I wonder how you can open concurrent connections.. I cannot find any documentation on how to do this - but according to http://aubit4gl.sourceforge.net/aubit4gldoc/manual/html/features_summary.html it maybe that you have to use ODBC connections to each instead of native??
It seems that "open session" and "use session" can be used to dynamically switch at runtime. But compile time seems to be the kicker.. especially if you use "define x like table.column" in 4gl, unless it allows "define x like db.table.column" or searches both databases.
Showing posts with label aubit4gl. Show all posts
Showing posts with label aubit4gl. Show all posts
Friday, June 26, 2009
Thursday, June 25, 2009
Aubit4GL: mysql connection specification
Since this is not well documented on Aubit4gl site, posting here:
To connect to mysql database:
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".
To connect to mysql database:
- Make sure your mysql server is not bound to localhost - even local connections are via hostname
- 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.
- Do "export MYSQL_SERVER=hostname"
- Set/export the following environment variables:
A4GL_SQLUID=test #whatever connection user isAnd now take the simple.4gl program:
A4GL_SQLPWD=test #whatever connection password is
A4GL_LEXDIALECT=INFORMIX
A4GL_LEXTYPE=C
A4GL_SQLTYPE=mysql
database test # of whatever your database name is
main
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".
Monday, June 22, 2009
Aubit4GL and libmysqld
Had a frustrating time trying to build aubit4gl on ubuntu with mysql support.
This is from libmysqlclient15-dev package. Turns out its not even an ubuntu issue.. its actual mysql bug:
http://bugs.mysql.com/bug.php?id=39288
I did see somewhere that it was fixed in libmysqlclient16-dev - which is not available in hardy (8.04) which I need.
I stumbled upon this link and was able to build a relocatable libmysqld.. but then I ran it this:
/usr/bin/ld: /usr/lib/mysql/libmysqld.a(net_serv.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/lib/mysql/libmysqld.a: could not read symbols: Bad value
This is from libmysqlclient15-dev package. Turns out its not even an ubuntu issue.. its actual mysql bug:
http://bugs.mysql.com/bug.php?id=39288
I did see somewhere that it was fixed in libmysqlclient16-dev - which is not available in hardy (8.04) which I need.
I stumbled upon this link and was able to build a relocatable libmysqld.. but then I ran it this:
gcc -shared -L/lib -o /opt/aubit4gl/src/plugins-1.10RC_62/libSQL_mysqldb.so db-mysql.o -L/usr/local/lib -L/usr/local/mysql -L/usr/lib/mysql -L/usr/lib -L/opt/aubit4gl/src/lib -lmysqld -laubit4gl-1.10RC_62 -Wl,-Bsymbolic-functions -L/usr/lib/mysql -lmysqld -lwrap -lrteven though libwrap is in /lib .. arrrg ok.. so I did the following:
/usr/bin/ld: cannot find -lwrap
cd lib/libsql/mysql(ie. I just removed -lwrap and -lrt and it went ok) and proceeded to compile the remainder of aubit4gl. Now to test against mysql
gcc -shared -L/lib -o /opt/aubit4gl/src/plugins-1.10RC_62/libSQL_mysqldb.so db-mysql.o -L/usr/local/lib -L/usr/local/mysql -L/usr/lib/mysql -L/usr/lib -L/opt/aubit4gl/src/lib -lmysqld -laubit4gl-1.10RC_62 -Wl,-Bsymbolic-functions -L/usr/lib/mysql -lmysqld
cd ../../..
make
Subscribe to:
Posts (Atom)