sabato, maggio 31, 2008

MySQL case sensitive in linux


MySQL table names are case-sensitive depending on the filesystem of the server. e.g. insensitive on Windows & Mac HFS+, Case sensitive on Unix.

It means that if you have stored the table PIPPO (upper case) in your database, the select query:
select * from pippo
doesn't work and it returns a message like ..."table pippo doesn't exist".
In order to prevent this problem you have to set set lower_case_table_names=1 in your /etc/mysql/my.cnf file. In this way the mysql server will store the table in the file system using lower case.
Here the steps I have followed:

  1. Chek the status of lower_case_table_names typing: $ mysqladmin -uroot -p variables
  2. $ sudo gedit /etc/mysql/my.cnf
  3. edit the file adding the entry lower_case_table_names=1 just under the group definition: [mysqld]

    [mysqld]
    #
    # * Basic Settings
    #

    #
    # * IMPORTANT
    # If you make changes to these settings and your system uses apparmor, you may
    # also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
    #

    lower_case_table_names=1

    user = mysql
    pid-file = /var/run/mysqld/mysqld.pid
    socket = /var/run/mysqld/mysqld.sock
    port = 3306
    basedir = /usr
    datadir = /var/lib/mysql
    tmpdir = /tmp
    language = /usr/share/mysql/english
    skip-external-locking

  4. shutdown the mysqlserver: $ mysqladmin -uroot -p shutdown
  5. start the mysqlserver: $ sudo mysqld &
  6. Chek the new status of lower_case_table_names typing: $ mysqladmin -uroot -p variables
  7. Remember that you have to re store the tables in the database, the best way to do that is dropping your database and running the SQL script.
  8. Test if works running a query like $ select * from pippo supposing you have stored PIPPO upper case

I ran this configuration with ubuntu 8.0.4, dell XPS1530, mysql 5-0
Enjoy with MySQL on linux.

dell XPS 1530 + ubuntu = fast

Here the log after executed mvn install on parancoe (trunk). Before I ran the command mvn clean, so the total time includes the compile step.
21 seconds not bad at all.

[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] Parancoe .............................................. SUCCESS [2.784s]
[INFO] Parancoe Yaml ......................................... SUCCESS [5.407s]
[INFO] Parancoe Core ......................................... SUCCESS [9.599s]
[INFO] Parancoe Web .......................................... SUCCESS [2.964s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21 seconds
[INFO] Finished at: Sat May 31 02:15:55 IST 2008
[INFO] Final Memory: 37M/132M
[INFO] ------------------------------------------------------------------------

install activation with maven

Problem

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) javax.activation:activation:jar:1.1.1

Try downloading the file manually from the project website.



Link
activation


Command
mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.1.1 -Dpackaging=jar -Dfile=activation.jar

giovedì, maggio 29, 2008

Executing main class with maven

If you want to run the main class of your application, let say mypackage.Pluto from maven, just run this command:


$ mvn exec:java -Dexec.mainClass=mypackage.Pluto


That's great, easy, simple...that's the maven way. Thanks to Lucio.