0

Could someone please help sort my configuration out or point me at a MySql example which doesnt use JNDI. I'm getting...

Table 'modeshape.content_store' doesn't exist

...which I assume is because it's not auto creating the schema. I've tried using the modeshape2 property to no avail. Here's my config

{
    "name" : "My Repository",
    "monitoring" : {
        "enabled" : true
    },
    "workspaces" : {
        "default" : "defaultWorkspace",
        "allowCreation" : true
    },
    "storage" : {
        "cacheName" : "Teneo Repository",
        "binaryStorage" : {
            "type" : "database",
        "driverClass" : "com.mysql.jdbc.Driver",
        "username" : "modeshape",
        "password" : "modeshape",
        "url" : "jdbc:mysql://127.0.0.1:3306/modeshape?autoReconnect=true",
        "autoGenerateSchema" : "create"
        }
    }
}
TedTrippin
  • 3,525
  • 5
  • 28
  • 46

1 Answers1

0

ModeShape always attempts to create the table if the table doesn't already exist. (ModeShape does not recognize the autoGenerateSchema field in your configuration.)

Make sure that you've granted the database user permission to create tables. Or, simply create the table manually using DDL:

CREATE TABLE CONTENT_STORE (
  cid VARCHAR(255) NOT NULL,
  mime_type VARCHAR(255),
  ext_text VARCHAR(1000),
  usage INTEGER,
  usage_time TIMESTAMP,
  payload BLOB,
  primary key(cid)
)

You can adjust the size or types of the columns as needed, as long as the types are compatible with those listed above. For example, on MySQL the BLOB columns have a maximum size of (2^16+1) bytes, but simply change that to MEDIUMBLOB for (2^24+2) bytes or LONGBLOB for (2^32+3) bytes.

Randall Hauch
  • 7,069
  • 31
  • 28
  • just had a quick look at the code. Database.tableExists() returns false if it catches a SQLException yet Database.execute() is catching the SQLException and rethrowing as a BinaryStoreException. Is that what it should be doing? – TedTrippin Mar 19 '13 at 13:47
  • And I can't create the table with that sql as usage is a reserved word in MySql 5.5 :( – TedTrippin Mar 19 '13 at 16:31
  • I've logged this as an issue; see https://issues.jboss.org/browse/MODE-1861. It will be fixed in the upcoming release (3.2.0.Final). – Randall Hauch Mar 19 '13 at 17:44