Index: unix_installer/installer-package/build.xml =================================================================== RCS file: /usr/local/cvsroot/unix_installer/installer-package/build.xml,v diff -u -r1.4 -r1.5 --- unix_installer/installer-package/build.xml 30 Apr 2008 03:03:59 -0000 1.4 +++ unix_installer/installer-package/build.xml 5 May 2008 06:00:03 -0000 1.5 @@ -68,5 +68,13 @@ + + + + + Index: unix_installer/installer-package/install-lams.sh =================================================================== RCS file: /usr/local/cvsroot/unix_installer/installer-package/install-lams.sh,v diff -u -r1.9 -r1.10 Binary files differ Index: unix_installer/installer-package/readme =================================================================== RCS file: /usr/local/cvsroot/unix_installer/installer-package/readme,v diff -u -r1.5 -r1.6 Binary files differ Index: unix_installer/installer-package/bin/checkmysql.class =================================================================== RCS file: /usr/local/cvsroot/unix_installer/installer-package/bin/checkmysql.class,v diff -u -r1.2 -r1.3 Binary files differ Fisheye: Tag 1.2 refers to a dead (removed) revision in file `unix_installer/installer-package/bin/checkmysql.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `unix_installer/installer-package/conf/unix/authentication/lamsauthentication.dtd'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4 refers to a dead (removed) revision in file `unix_installer/installer-package/conf/unix/authentication/lamsauthentication.xml'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `unix_installer/installer-package/conf/unix/jboss/.log4j.xml.swp'. Fisheye: No comparison available. Pass `N' to diff? Index: unix_installer/installer-package/java/checkmysql.java =================================================================== RCS file: /usr/local/cvsroot/unix_installer/installer-package/java/checkmysql.java,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ unix_installer/installer-package/java/checkmysql.java 5 May 2008 05:59:51 -0000 1.1 @@ -0,0 +1,84 @@ +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.Statement; +import java.util.Properties; +import java.sql.SQLException; + +public class checkmysql +{ + private String version; + private String dbDriverClass; + private String dbDriverUrl; + private String dbUsername; + private String dbPassword; + + // Check that the mysql version is valid + public static void main(String[] args) throws SQLException + { + checkmysql me = new checkmysql(); + + if (args.length < 4) + { + System.out.println("Usage: Java checkmysql dbDriverUrl dbUsername dbPassword version"); + System.exit(1); + } + else + { + me.execute(args[0], args[1], args[2], args[3]); + } + } + + public void execute(String url, String user, String pass, String version) throws SQLException + { + + try{ + this.version = version; + this.dbDriverClass = "com.mysql.jdbc.Driver"; + this.dbDriverUrl = url; + this.dbUsername = user; + this.dbPassword = pass; + + Class.forName(dbDriverClass); + Connection conn = DriverManager.getConnection(dbDriverUrl, dbUsername, dbPassword); + conn.setAutoCommit(false); + PreparedStatement stmt = conn.prepareStatement("show variables where Variable_name=\"version\""); + ResultSet results = stmt.executeQuery(); + + if (results.first() == false) + { + throw new SQLException("No version row found in database"); + } + else + { + String dbVersion = results.getString("Value"); + if (dbVersion.contains(version) == false) + { + throw new SQLException("Your MySql Version: \"" + dbVersion + "\" is not compatible LAMS"); + } + else + { + System.out.println("MySql host is compatible with LAMS."); + } + + } + conn.close(); + } + catch (SQLException e) + { + System.out.println(e.getMessage()); + System.out.println("MySql check failed. Check that your MYSQL_HOST variable in lams.properties points to a MySql 5.x installation"); + System.exit(1); + } + catch (Exception e) + { + System.out.println(e.getMessage()); + System.out.println("Unknown failure finding MySql version"); + e.printStackTrace(); + System.exit(1); + } + } + +}