Using MySQL?

René
2008-05-11
2013-04-24
  • René
    René
    2008-05-11

    I've been trying to use MySQL with Jose, but I get this despite having everything installed properly:

    $ java -cp jose.jar de.jose.db.Setup -db MySQL-external -schema META
    java.sql.SQLException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
            at de.jose.db.DBAdapter.createAdapter(DBAdapter.java:241)
            at de.jose.db.DBAdapter.createAdapter(DBAdapter.java:167)
            at de.jose.db.DBAdapter.get(DBAdapter.java:152)
            at de.jose.db.JoConnection.init(JoConnection.java:89)
            at de.jose.db.Setup.<init>(Setup.java:64)
            at de.jose.db.Setup.main(Setup.java:1139)

    Any help will be very appreciated.

     
  • thbenda
    thbenda
    2011-12-25

    Hello everyone,
    Maybe for followers or any people interested by these software…

    First you'll have to create the database schema inside your local mysql server and assign user's permissions properly.

    Secondly, you'll have to get the mysql driver from mysql.com. and you put it in your personal java librairies folder - any folder of your computer.

    Third, you will open the datasources configuration file of jose:    /jose/config/datasources.xml.
    You must choose a given database connection type and fill all the necessary properties: host, port, db name, user, password, etc.

    And then you'll do the setup process - as the same XML file give you the cmdline stuff:

    $ java -classpath /home/bendathi/packages/java/mysql-connector-java-5.1.16/mysql-connector-java-5.1.16-bin.jar:jose.jar de.jose.db.Setup -db MySQL-external -schema META
    
    $ java -classpath /home/bendathi/packages/java/mysql-connector-java-5.1.16/mysql-connector-java-5.1.16-bin.jar:jose.jar de.jose.db.Setup -db MySQL-external -schema MAIN
    

    But I see some errors :)
    The first statment completes successfully, but the second one give two java stacktraces:

    CREATE TABLE Opening (Id INTEGER NOT NULL  PRIMARY KEY , HashKey BIGINT DEFAULT 0 NOT NULL , Ply INTEGER, ECO CHAR (3) DEFAULT '-' NOT NULL , Name VARCHAR (255) NOT NULL , Soundex CHAR (6) DEFAULT '-' NOT NULL )  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX Opening_1 ON Opening(HashKey)
    CREATE  INDEX Opening_2 ON Opening(ECO)
    CREATE  INDEX Opening_3 ON Opening(Name,Id)
    CREATE  INDEX Opening_4 ON Opening(Soundex,Id)
    INSERT INTO Opening VALUES (0, 0, 0, '-', '-', '-')
    CREATE TABLE Player (Id INTEGER NOT NULL  PRIMARY KEY , Name VARCHAR (255) NOT NULL , Soundex CHAR (6) DEFAULT '-' NOT NULL )  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX Player_1 ON Player(Name,Id)
    CREATE  INDEX Player_2 ON Player(Soundex,Id)
    INSERT INTO Player VALUES (0, '-', '-')
    CREATE TABLE Event (Id INTEGER NOT NULL  PRIMARY KEY , Name VARCHAR (255) NOT NULL , Soundex CHAR (6) DEFAULT '-' NOT NULL )  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX Event_1 ON Event(Name,Id)
    CREATE  INDEX Event_2 ON Event(Soundex,Id)
    INSERT INTO Event VALUES (0, '-', '-')
    CREATE TABLE Site (Id INTEGER NOT NULL  PRIMARY KEY , Name VARCHAR (255) NOT NULL , Soundex CHAR (6) DEFAULT '-' NOT NULL )  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX Site_1 ON Site(Name,Id)
    CREATE  INDEX Site_2 ON Site(Soundex,Id)
    java.lang.NullPointerException
        at de.jose.task.db.CheckDBTask.work(CheckDBTask.java:42)
        at de.jose.task.Task.run(Task.java:325)
    INSERT INTO Site VALUES (0, '-', '-')
    CREATE TABLE Collection (Id INTEGER NOT NULL  PRIMARY KEY , PId INTEGER REFERENCES Collection(Id), OPId INTEGER REFERENCES Collection(Id), Name VARCHAR (255) NOT NULL , Path VARCHAR (255), Attributes TINYINT DEFAULT 0 NOT NULL , SourceURL VARCHAR (255), LastModified TIMESTAMP NOT NULL , GameCount INTEGER DEFAULT 0 NOT NULL )  CHARACTER SET utf8 COLLATE utf8_general_ci
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at de.jose.window.JoDialog.<init>(JoDialog.java:274)
        at de.jose.task.ProgressDialog.<init>(ProgressDialog.java:43)
        at de.jose.task.Task.createProgressDialog(Task.java:389)
        at de.jose.task.Task$1.run(Task.java:368)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
        at java.awt.EventQueue.access$000(EventQueue.java:84)
        at java.awt.EventQueue$1.run(EventQueue.java:602)
        at java.awt.EventQueue$1.run(EventQueue.java:600)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
    CREATE  INDEX Collection_1 ON Collection(PId)
    CREATE  INDEX Collection_2 ON Collection(Name)
    CREATE  INDEX Collection_3 ON Collection(Path)
    CREATE  INDEX Collection_4 ON Collection(SourceURL)
    CREATE  INDEX Collection_5 ON Collection(LastModified)
    INSERT INTO Collection VALUES (1,null,null, 'collection.clipboard', ':/1/', 16, '-', {fn now()}, 0)
    INSERT INTO Collection VALUES (2,null,null, 'collection.autosave', ':/2/', 16, '-', {fn now()}, 0)
    INSERT INTO Collection VALUES (3,null,null, 'collection.trash', ':/3/', 16, '-', {fn now()}, 0)
    CREATE TABLE Game (Id INTEGER NOT NULL  PRIMARY KEY , CId INTEGER NOT NULL  REFERENCES Collection(Id), Idx INTEGER NOT NULL , Attributes SMALLINT DEFAULT 0 NOT NULL , OCId INTEGER, OIdx INTEGER, PlyCount INTEGER DEFAULT 0 NOT NULL , Result TINYINT DEFAULT 0 NOT NULL , WhiteId INTEGER NOT NULL  REFERENCES Player(Id), BlackId INTEGER NOT NULL  REFERENCES Player(Id), WhiteELO INTEGER, BlackELO INTEGER, EventId INTEGER NOT NULL  REFERENCES Event(Id), SiteId INTEGER NOT NULL  REFERENCES Site(Id), GameDate DATE, EventDate DATE, DateFlags SMALLINT DEFAULT 0 NOT NULL , OpeningId INTEGER NOT NULL  REFERENCES Opening(Id), ECO CHAR (3), AnnotatorId INTEGER NOT NULL  REFERENCES Player(Id))  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX Game_1 ON Game(Idx)
    CREATE  INDEX Game_2 ON Game(Attributes)
    CREATE  INDEX Game_3 ON Game(Result)
    CREATE  INDEX Game_4 ON Game(WhiteId)
    CREATE  INDEX Game_5 ON Game(BlackId)
    CREATE  INDEX Game_6 ON Game(WhiteELO)
    CREATE  INDEX Game_7 ON Game(BlackELO)
    CREATE  INDEX Game_8 ON Game(EventId)
    CREATE  INDEX Game_9 ON Game(SiteId)
    CREATE  INDEX Game_10 ON Game(GameDate)
    CREATE  INDEX Game_11 ON Game(EventDate)
    CREATE  INDEX Game_12 ON Game(OpeningId)
    CREATE  INDEX Game_13 ON Game(ECO)
    CREATE  INDEX Game_14 ON Game(AnnotatorId)
    CREATE  INDEX Game_15 ON Game(CId,Id)
    CREATE  INDEX Game_16 ON Game(CId,Idx,Id)
    CREATE TABLE MoreGame (GId INTEGER NOT NULL  PRIMARY KEY  REFERENCES Game(Id), WhiteTitle VARCHAR (32), BlackTitle VARCHAR (32), Round VARCHAR (32), Board VARCHAR (32), FEN VARCHAR (128), Info VARCHAR (255), Bin LONG VARBINARY, Comments LONG VARCHAR, PosMain LONG VARCHAR, PosVar LONG VARCHAR)  CHARACTER SET utf8 COLLATE utf8_general_ci
    CREATE  INDEX MoreGame_1 ON MoreGame(WhiteTitle)
    CREATE  INDEX MoreGame_2 ON MoreGame(BlackTitle)
    CREATE  INDEX MoreGame_3 ON MoreGame(Round)
    CREATE  INDEX MoreGame_4 ON MoreGame(Board)
    CREATE  INDEX MoreGame_5 ON MoreGame(Info)
    CREATE  FULLTEXT  INDEX MoreGame_6 ON MoreGame(Comments)
    java.sql.SQLException: The used table type doesn't support FULLTEXT indexes
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2619)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2569)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:813)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:656)
        at de.jose.db.JoStatement.execute(JoStatement.java:85)
        at de.jose.db.JoStatement.executeUpdate(JoStatement.java:116)
        at de.jose.db.JoConnection.executeUpdate(JoConnection.java:356)
        at de.jose.db.Setup.createSingleIndex(Setup.java:722)
        at de.jose.db.Setup.createTable(Setup.java:481)
        at de.jose.db.Setup.createTables(Setup.java:135)
        at de.jose.db.Setup.main(Setup.java:1152)
    

    Nothing blocking for me, but for normal people - there could not understand howto point out solutions :)

     
  • thbenda
    thbenda
    2011-12-25

    Nothing blocking but I tell the trick for people: you must set MySQL Engine to the value MyISAM before running install.
    Because only MyISAM Engine supports FULLTEXT indexes.

    Have good chess games :)