You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Harris - ICT <Ma...@MeridianEnergy.co.nz> on 2018/06/18 03:12:46 UTC

JdbcMessageIdRepository and SQL Server: schema

Hello.

I'm using Camel version 2.16.2 and am trying to create a JDBC message id repository within a Microsoft SQL Server database.

I have created the appropriate JdbcMessageIdRepository bean and populated it with my SQL Server data source but I am finding that the "CAMEL_MESSAGEPROCESSED" table is being automatically created in the default schema of the database, which is called "dbo". I actually need to create the database table in another schema, not the default one.

I have looked through the Camel documentation but cannot find any reference to how to do this.

For other Java projects using JPA, I have used a similar approach and can add database schema configuration when I set up my javax.persistence.EntityManagerFactory. Can I do something similar for Camel's JdbcMessageIdRepository?

Thanks for any assistance.

Mark Harris - Software Developer
Meridian Energy Limited
287-293 Durham Street North, Christchurch 8013
DDI : 03 345 9080
www.meridianenergy.co.nz


Attention:

This email together with any attachments is confidential and
may be subject to legal privilege.
If you are not the intended recipient please delete the message and
notify the sender.
Any views or opinions presented are solely those of the author and
will not necessarily reflect the views of Meridian Energy.


PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING.


RE: JdbcMessageIdRepository and SQL Server: schema

Posted by Mark Harris - ICT <Ma...@MeridianEnergy.co.nz>.
Many thanks for this.

I had to do a bit more than this - as well as creating the database manually, I had to prefix the SQL Server schema into the SQL statements that are used by the repository (exists, create, query, insert, delete). I did this when creating my JdbcMessageIdRepository object.

Mark

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Monday, 18 June 2018 23:12
To: users@camel.apache.org
Subject: Re: JdbcMessageIdRepository and SQL Server: schema

Hi

You can either create the table before-hand yourself in the right schema.

Or you can try to configure the createString option on the JdbcMessageIdRepository, where you can specify the SQL statement it uses. The default one is:

CREATE TABLE CAMEL_MESSAGEPROCESSED (processorName VARCHAR(255), messageId VARCHAR(100), createdAt TIMESTAMP)

You can view it in the source code, and see what happens etc.

On Mon, Jun 18, 2018 at 5:12 AM, Mark Harris - ICT <Ma...@meridianenergy.co.nz> wrote:
> Hello.
>
> I'm using Camel version 2.16.2 and am trying to create a JDBC message id repository within a Microsoft SQL Server database.
>
> I have created the appropriate JdbcMessageIdRepository bean and populated it with my SQL Server data source but I am finding that the "CAMEL_MESSAGEPROCESSED" table is being automatically created in the default schema of the database, which is called "dbo". I actually need to create the database table in another schema, not the default one.
>
> I have looked through the Camel documentation but cannot find any reference to how to do this.
>
> For other Java projects using JPA, I have used a similar approach and can add database schema configuration when I set up my javax.persistence.EntityManagerFactory. Can I do something similar for Camel's JdbcMessageIdRepository?
>
> Thanks for any assistance.
>
> Mark

--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Attention:

This email together with any attachments is confidential and
may be subject to legal privilege.
If you are not the intended recipient please delete the message and
notify the sender.
Any views or opinions presented are solely those of the author and
will not necessarily reflect the views of Meridian Energy.


PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING.


Re: JdbcMessageIdRepository and SQL Server: schema

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can either create the table before-hand yourself in the right schema.

Or you can try to configure the createString option on the
JdbcMessageIdRepository, where you can specify the SQL statement it
uses. The default one is:

CREATE TABLE CAMEL_MESSAGEPROCESSED (processorName VARCHAR(255),
messageId VARCHAR(100), createdAt TIMESTAMP)

You can view it in the source code, and see what happens etc.

On Mon, Jun 18, 2018 at 5:12 AM, Mark Harris - ICT
<Ma...@meridianenergy.co.nz> wrote:
> Hello.
>
> I'm using Camel version 2.16.2 and am trying to create a JDBC message id repository within a Microsoft SQL Server database.
>
> I have created the appropriate JdbcMessageIdRepository bean and populated it with my SQL Server data source but I am finding that the "CAMEL_MESSAGEPROCESSED" table is being automatically created in the default schema of the database, which is called "dbo". I actually need to create the database table in another schema, not the default one.
>
> I have looked through the Camel documentation but cannot find any reference to how to do this.
>
> For other Java projects using JPA, I have used a similar approach and can add database schema configuration when I set up my javax.persistence.EntityManagerFactory. Can I do something similar for Camel's JdbcMessageIdRepository?
>
> Thanks for any assistance.
>
> Mark Harris - Software Developer
> Meridian Energy Limited
> 287-293 Durham Street North, Christchurch 8013
> DDI : 03 345 9080
> www.meridianenergy.co.nz
>
>
> Attention:
>
> This email together with any attachments is confidential and
> may be subject to legal privilege.
> If you are not the intended recipient please delete the message and
> notify the sender.
> Any views or opinions presented are solely those of the author and
> will not necessarily reflect the views of Meridian Energy.
>
>
> PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING.
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2