Mysql java functionality