camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Cable (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-4152) jdbc idempotent repository - table creation
Date Sat, 31 Dec 2011 14:40:30 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-4152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13178022#comment-13178022
] 

Julian Cable commented on CAMEL-4152:
-------------------------------------

Hi Christian, thanks for looking at this,

If the table does exist, there will be a debug log saying: "table for JdbcMessageIdRepository
already exists" - thats OK but maybe it should also say that this is a good thing!

If the table doesn't exist and is created, there will be a debug log saying:

creating table for JdbcMessageIdRepository because it doesn't exists...
table created with query 'CREATE TABLE CAMEL_MESSAGEPROCESSED (processorName VARCHAR(255),
messageId VARCHAR(100), createdAt TIMESTAMP)'
 
If the table doesn't exist and can't be created, there will be a debug log saying:

creating table for JdbcMessageIdRepository because it doesn't exists...

So in the good cases we now get sensible debug messages, but in the failure case I think we
need better ERROR messages.

Also, I think the DataAccessException can happen for other reasons, like the database password
is wrong, or the database is down, or the permissions are wrong.


Should we have an inner try clause? Something like:

try {
       jdbcTemplate.execute(createString); 
       log.info("table created with query '{}'", createString);
} catch(DataAccessException e) // or some other exception if that's not the right one
       log.error("table with query '{}' does not exist and could not be created. This may
be a permissions problem. Please create this table and try again.", createString);
       throw(e);
}

Or add the extra information to the Exception instead of logging and re-throw?

Oh and by the way, 

creating table for JdbcMessageIdRepository because it doesn't exists...

Should be

creating table for JdbcMessageIdRepository because it doesn't exist...

Just as an English language point.

Julian
                
> jdbc idempotent repository - table creation
> -------------------------------------------
>
>                 Key: CAMEL-4152
>                 URL: https://issues.apache.org/jira/browse/CAMEL-4152
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-sql
>    Affects Versions: 2.7.1
>         Environment: camels on any
>            Reporter: Julian Cable
>            Assignee: Christian Müller
>              Labels: idempotent, jdbc
>             Fix For: 2.9.1, 2.10
>
>
>  It would be nice if the class caught the error if the table does not exist and tried
to create it. If the create privilege is not available then a more informative exception can
be raised to inform the user what needs creating.
> I also suggest the schema is changed so that the fields are lower case as different database
engines handle case differently and use incompatible quoting for mixed case tables (Oracle,
MySql and Postgres are all slightly different).
> Julian

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message