Hi Charles,
How did you setup the default endpoint of the producerTemplate?
It looks the query is used be resolved as an CamelEndpoint, that could
explain why this line of code is called.
at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:57)
Willem
On 3/23/11 1:05 AM, Charles Moulliard wrote:
I use a ProducerTemplate to create the SQL query send to sql endpoint.
When I launch camel, I get this error :
Caused by: java.net.URISyntaxException: Illegal character in opaque
part at index 54:
sql:INSERT%20INTO%20REPORT.T_INCIDENT%20(INCIDENT_REF,
%20%20%20%20%20%20%20INCIDENT_DATE,GIVEN_NAME,FAMILY_NAME,SUMMARY,DETAILS,EMAIL,PHONE)
%20%20%20%20%20%20%20VALUES%20('099','2011-03-21','Charles','Moulliard','Incident%20Webinar','This%20is%20a
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20report%20incident%20for%20webinar-001','[email protected]','+111%2010%2020%20300'
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parse(URI.java:3019)
at java.net.URI.<init>(URI.java:578)
at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Is there a way to avoid that ?
Here is the code :
public void insertRecord(@Body String ref) {
StringBuilder query = new StringBuilder();
query.append("sql:INSERT INTO REPORT.T_INCIDENT (INCIDENT_REF,\n" +
"
INCIDENT_DATE,GIVEN_NAME,FAMILY_NAME,SUMMARY,DETAILS,EMAIL,PHONE)\n" +
" VALUES (");
query.append("'" + ref + "'");
query.append("'2011-03-21','Charles','Moulliard','Incident
Webinar','This is a\n" +
" report incident for
webinar-001','[email protected]','+111 10 20 300'");
template.sendBody(query.toString());
}
Regards,
Charles Moulliard
Sr. Principal Solution Architect - FuseSource
Apache Committer
Blog : http://cmoulliard.blogspot.com
Twitter : http://twitter.com/cmoulliard
Linkedin : http://www.linkedin.com/in/charlesmoulliard
Skype: cmoulliard
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang