You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jesper Olsen <jo...@dr.dk> on 2012/06/08 10:36:00 UTC

Using % sign in spring route sql select fails

I have a route with a select containing %-signs like this:

<route id="netwise-Route">
   <from uri="direct:start" />
   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
misc3 NOT LIKE '%*%'?dataSourceRef=netwiseXADataSource"/>
</route>

I get this error:		
Malformed escape pair at index 106:
sql:select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource	

I tried escaping the %-signs like this:

<route id="netwise-Route">
   <from uri="direct:start" />
   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
misc3 NOT LIKE '%25*%25'?dataSourceRef=netwiseXADataSource"/>
</route>

But still receives an error:
Malformed escape pair at index 108:
sql://select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource

I also tried reading the sql statement from a properties-file, but still
have the problem.

Any suggestions on how to use %-signs in a sql query?

Regards Jesper


--
View this message in context: http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using % sign in spring route sql select fails

Posted by nprajeshgowda <np...@gmail.com>.
Hi,

   i used the encoding, but still have some issue. Rather my problem is
little different.

   Let me take you through. so that you would be able to suggest me..


   We have camel routes defined as following, the "ana" is 

   from(JmsQNames.GETUSER + comURI + getUserQueueProps)
		.routeId(JmsQNames.DM_GETALLME + comURI)
		.beanRef("getUser")
		.*to("customEndPoint://" + hostname +
"?user="+user+"&password="+password)*
		.beanRef("getUser", "extract('" + comURI + "')")
		.transform(body());

Where in the property 'password' is being fed from karaf property *.cfg file
, in the cfg file i have input as 

Admin%25, then the value to my bean comes as Admin%, this worked fine. But
when the routes are getting constructed then there is the problem the
"to("customEndPoint://" + hostname + "?user="+user+"&password="+password)"
is throwing the error. 

    Caused by: org.apache.camel.FailedToCreateRouteException: Failed to
create route jmsvm:queue:getUser_net://net:1 at: >>>
To[customEndPoint://10.56.22.25?user=root&password=Admin123%] <<< in route:
Route[[From[jmsvm:queue:getUser_net://net:1?co... because of Failed to
resolve endpoint: ana://10.56.22.25?user=root&password=Admin123% due to:
Malformed escape pair at index 45:
ana://10.56.22.25?user=root&password=Admin123%

Cheers,
Rajesh



--
View this message in context: http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5732261.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using % sign in spring route sql select fails

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

Use %25 as shown at:
http://en.wikipedia.org/wiki/URL_encode

On Wed, May 8, 2013 at 4:51 PM, nprajeshgowda <np...@gmail.com> wrote:
> Hi Claus Ibsen ,
>
> we are using Camel version 2.9 in our first version of our product. In the
> latest version of our product we are using Camel 2.10 and the problem  is
> not seen.
>
> But need your help in finding a patch or workaround solution to Camel 2.9.
>
> Is there any workaround by which we can allow user to give % in the URI ?
>
>
> Br,
> Rajesh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5732192.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Using % sign in spring route sql select fails

Posted by nprajeshgowda <np...@gmail.com>.
Hi Claus Ibsen ,

we are using Camel version 2.9 in our first version of our product. In the
latest version of our product we are using Camel 2.10 and the problem  is
not seen.

But need your help in finding a patch or workaround solution to Camel 2.9.

Is there any workaround by which we can allow user to give % in the URI ?


Br,
Rajesh



--
View this message in context: http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5732192.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using % sign in spring route sql select fails

Posted by Claus Ibsen <cl...@gmail.com>.
In XML DSL you should be able to do it using spring bean style. It does
take a bit XML as you need to setup a spring jdbc template also

<bean id="myJdbcTemplate" class=" ...JdbcTemplate">
 ... the data source need to be injected
</bean>

<bean id="foo" class="org.apache.camel.component.sql.SqlEndpoint">
  <property name="jdbcTemplate" ref="myJdbcTemplate"/>
  <property name="query" value="insert the SQL value here"/>
</bean>

And in the DSL refer to the foo endpoint

<to ref="foo"/>



On Mon, Jun 11, 2012 at 12:58 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> I logged a ticket to see if we can fix this
> https://issues.apache.org/jira/browse/CAMEL-5355
>
>
> On Mon, Jun 11, 2012 at 9:38 AM, Jesper Olsen <jo...@dr.dk> wrote:
>
>> We are using camel version 2.7.1
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5714275.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Using % sign in spring route sql select fails

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

I logged a ticket to see if we can fix this
https://issues.apache.org/jira/browse/CAMEL-5355


On Mon, Jun 11, 2012 at 9:38 AM, Jesper Olsen <jo...@dr.dk> wrote:

> We are using camel version 2.7.1
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5714275.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Using % sign in spring route sql select fails

Posted by Jesper Olsen <jo...@dr.dk>.
We are using camel version 2.7.1

--
View this message in context: http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171p5714275.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using % sign in spring route sql select fails

Posted by Claus Ibsen <cl...@gmail.com>.
Ah you did that as %25 is the % sign itself.

What version of Camel are you using?


On Sat, Jun 9, 2012 at 9:01 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> %20 means space.
> I assume there is a similar encoding number for just the % sign.
>
>
> On Fri, Jun 8, 2012 at 10:36 AM, Jesper Olsen <jo...@dr.dk> wrote:
>
>> I have a route with a select containing %-signs like this:
>>
>> <route id="netwise-Route">
>>   <from uri="direct:start" />
>>   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
>> misc3 NOT LIKE '%*%'?dataSourceRef=netwiseXADataSource"/>
>> </route>
>>
>> I get this error:
>> Malformed escape pair at index 106:
>>
>> sql:select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource
>>
>> I tried escaping the %-signs like this:
>>
>> <route id="netwise-Route">
>>   <from uri="direct:start" />
>>   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
>> misc3 NOT LIKE '%25*%25'?dataSourceRef=netwiseXADataSource"/>
>> </route>
>>
>> But still receives an error:
>> Malformed escape pair at index 108:
>>
>> sql://select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource
>>
>> I also tried reading the sql statement from a properties-file, but still
>> have the problem.
>>
>> Any suggestions on how to use %-signs in a sql query?
>>
>> Regards Jesper
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Using % sign in spring route sql select fails

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

%20 means space.
I assume there is a similar encoding number for just the % sign.


On Fri, Jun 8, 2012 at 10:36 AM, Jesper Olsen <jo...@dr.dk> wrote:

> I have a route with a select containing %-signs like this:
>
> <route id="netwise-Route">
>   <from uri="direct:start" />
>   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
> misc3 NOT LIKE '%*%'?dataSourceRef=netwiseXADataSource"/>
> </route>
>
> I get this error:
> Malformed escape pair at index 106:
>
> sql:select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource
>
> I tried escaping the %-signs like this:
>
> <route id="netwise-Route">
>   <from uri="direct:start" />
>   <to uri="sql:select telno, misc3 from main where misc3 IS NOT NULL and
> misc3 NOT LIKE '%25*%25'?dataSourceRef=netwiseXADataSource"/>
> </route>
>
> But still receives an error:
> Malformed escape pair at index 108:
>
> sql://select%20telno,%20misc3%20from%20main%20where%20misc3%20IS%20NOT%20NULL%20and%20misc3%20NOT%20LIKE%20'%*%'?dataSourceRef=netwiseXADataSource
>
> I also tried reading the sql statement from a properties-file, but still
> have the problem.
>
> Any suggestions on how to use %-signs in a sql query?
>
> Regards Jesper
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Using-sign-in-spring-route-sql-select-fails-tp5714171.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen