You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2022/04/11 08:57:36 UTC

Camel sql component with classpath script

Hello.

I've already used the sql component using the a "classpath" external
script in blueprint.
For example :
    <to uri="sql:classpath:sql/myscript.sql?..." />

Now I'm trying the same, but instead of a packaged jar bundle, I'd
like to test from a xml blueprint directly put in the deploy folder of
my servicemix.

The "classpath" keywork seems to be ignored, and I've the following
postgresql error :
    org.postgresql.util.PSQLException: ERROR: syntax error at or near
"classpath"

It seems that the full uri is passed to the driver ignoring the
classpath directive.

Is it a known issue on the sql component ?

Thanks for your help.

Regards.

Re: Camel sql component with classpath script

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

Thanks for your answer. I'm a bit disappointed : I can prototype as 
simple blueprints, without packaging, almost all my Camel routes, except 
the sql component. Could you please explain why the sql URI including 
the "classpath" is not interpreted the same way when running from a jar 
bundled context or in a single XML file that I deploy on my standalone 
Karaf/ServiceMix, while the SQL file is in a folder that is correctly 
present in the classpath ? Do you know if other components that accept 
classpath located external resources have also the same distinct behavior ?

Thanks again.

Regards.

Ephemeris Lappis

Le 11/04/2022 à 13:37, Claus Ibsen a écrit :
> Hi
>
> That is not possible. You cannot drop a .sql file into the deploy
> folder of karaf, and assume it knows how to deploy that.
> You need to put the sql script somewhere in the file system, and use
> file: to refer to the file.
>
> Or bundle it together with your camel app. Or bundle it in another
> .jar (maybe be a jar without any .class files).
> And then that bundle needs to export the java package name where the
> sql script is located, and your camel app bundle then needs to import
> that package.
>
> On Mon, Apr 11, 2022 at 10:57 AM Ephemeris Lappis
> <ep...@gmail.com> wrote:
>> Hello.
>>
>> I've already used the sql component using the a "classpath" external
>> script in blueprint.
>> For example :
>>      <to uri="sql:classpath:sql/myscript.sql?..." />
>>
>> Now I'm trying the same, but instead of a packaged jar bundle, I'd
>> like to test from a xml blueprint directly put in the deploy folder of
>> my servicemix.
>>
>> The "classpath" keywork seems to be ignored, and I've the following
>> postgresql error :
>>      org.postgresql.util.PSQLException: ERROR: syntax error at or near
>> "classpath"
>>
>> It seems that the full uri is passed to the driver ignoring the
>> classpath directive.
>>
>> Is it a known issue on the sql component ?
>>
>> Thanks for your help.
>>
>> Regards.
>
>

-- 
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus


Re: Camel sql component with classpath script

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

That is not possible. You cannot drop a .sql file into the deploy
folder of karaf, and assume it knows how to deploy that.
You need to put the sql script somewhere in the file system, and use
file: to refer to the file.

Or bundle it together with your camel app. Or bundle it in another
.jar (maybe be a jar without any .class files).
And then that bundle needs to export the java package name where the
sql script is located, and your camel app bundle then needs to import
that package.

On Mon, Apr 11, 2022 at 10:57 AM Ephemeris Lappis
<ep...@gmail.com> wrote:
>
> Hello.
>
> I've already used the sql component using the a "classpath" external
> script in blueprint.
> For example :
>     <to uri="sql:classpath:sql/myscript.sql?..." />
>
> Now I'm trying the same, but instead of a packaged jar bundle, I'd
> like to test from a xml blueprint directly put in the deploy folder of
> my servicemix.
>
> The "classpath" keywork seems to be ignored, and I've the following
> postgresql error :
>     org.postgresql.util.PSQLException: ERROR: syntax error at or near
> "classpath"
>
> It seems that the full uri is passed to the driver ignoring the
> classpath directive.
>
> Is it a known issue on the sql component ?
>
> Thanks for your help.
>
> Regards.



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