Archive | September, 2006

MySQL UDF 5.0.24a

13 Sep

This was installed so that UDF could be used.

If you don’t use the patch and just use the generated .so file you’ll get an error like:

mysql> CREATE FUNCTION lookup RETURNS STRING SONAME ‘udf_example.so’;
ERROR 1126 (HY000): Can’t open shared library ‘udf_example.so’ (errno: 2 /usr/lib/udf_example.so: undefined symbol: __gxx_personality_v0)

To do this:

  1. Install the MySQL 5.0.24a binaries, make sure you use the ‘Max’ server as you need dynamic library loading
  2. Get the MySQL 5.0.24a source, go to the sql/ directory and patch the source using the diff found at http://lists.mysql.com/commits/9750. You will also need to rename udf_example.cc to udf_example.c.

Once you’ve done this, you need to compile the source using:

  1. libtool –mode=compile gcc -I. -I../include/ -c ./udf_example.c
  2. libtool –mode=link gcc -shared -fPIC -o udf_example.so udf_example.lo

Copy the resulting ‘udf_example.so’ to JS Tech Notes › Edit — WordPress/usr/lib. You can run ‘ldconfig -r -s’ to test the library.

Now get into mysql, make sure the server says its ‘5.0.24a-max’.

Test the function:

CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so';
select lookup("imvs.org")

							

Breaking java/mysql mapping

1 Sep

I was receiving the following error in my Tomcat logs:

— The error occurred in org/imvs/qc/server/dao/ibatis/maps/Result.xml.
— The error occurred while applying a result map.
— Check the Result.materialLotNumberFromResultByTestInstrument.
— Check the result mapping for the 'lotNumbers' property.
— Cause: com.ibatis.common.jdbc.exception.NestedSQLException:
— The error occurred in org/imvs/qc/server/dao/ibatis/maps/Result.xml.
— The error occurred while applying a result map.
— Check the getLotNumberByMaterialIdLotNumberId-AutoResultMap.
— Check the result mapping for the 'expiryDate' property.
— Cause: java.sql.SQLException: Cannot convert value '2006-03-16 09:53:58' from column 3(2006-03-16 09:53:58 ) to TIMESTAMP. Caused by: java.sql.SQLException: Cannot convert value '2006-03-16 09:53:58' from column 3(2006-03-16 09:53:58 ) to TIMESTAMP.; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
— The error occurred in org/imvs/qc/server/dao/ibatis/maps/Result.xml.

Its because java had been updated to jdk1.5.0_07 (from jdk1.5.0_03).

When we rolled it back, it worked again.

Looks like _07 breaks some java-mysql connector things.

(We tried both mysql-connector-java-3.0.x and mysql-connector-java-3.1.x)