|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
MalformedEndpointExceptionWhen i try to fire this sql aganst Oracle
jdbc://SELECT%*%20FROM%20CATS_OWNER.V_CATS_CPH_WWW_SUBSCRIBE%20WHERE%20(FLT_TYPE%20in%20('B','C','G','J','S')%20AND%20PUBLIC_ROLL_OFF%20=%200)%20AND%20SCHEDULE_TM%20>=%20'2007-04-13%2012:16:40'%20AND%20SCHEDULE_TM%20<=%20'2007-04-13%2014:16:40' i get an org.mule.umo.endpoint.MalformedEndpointException. This sql works perfectly in sql+ and TOra. The problem only comes when i add the last two conditions, SCHEDULE_TM >= '2007-04-13 12:16:40' AND SCHEDULE_TM <= '2007-04-13 14:16:40' ...SCHEDULE_TM is a Date field. What's wrong with inserting dates this way? |
|
|
Re: MalformedEndpointExceptionMy first guess would be the ":" that mark the separators between hours, minutes and seconds.
I think they're being "misinterperated" by the connector. On 4/13/07,
acw <andreas.willadsen@...> wrote:
|
|
|
Re: MalformedEndpointExceptionThis is how I solved this:
- configure your connector like this: <connector name="MyConnector" className="org.mule.providers.jdbc.JdbcConnector"> <properties> <container-property name="dataSource" reference="MyDataSource" /> <map name="files"> <property name="MyQuery" value="MyQuery.sql" /> </map> <factory-property name="queries" factory="foo.bar.LoadFromFileFactory" /> </properties> </connector> - next create the following class: package foo.bar; import java.util.HashMap; import java.util.Map; import org.mule.config.PropertyFactory; import org.mule.util.IOUtils; public class LoadFromFileFactory implements PropertyFactory { public LoadFromFileFactory() { } public Object create(Map properties) throws Exception { HashMap ret = new HashMap(); HashMap<String, String> files = (HashMap<String, String>) properties.get("files"); String fileName = null; String content = null; for (String key : files.keySet()) { fileName = files.get(key); content = IOUtils.getResourceAsString(fileName, this.getClass()); ret.put(key, content); } return ret; } } - finally configure your endpoint: <endpoint name="MyEndpoint" address="jdbc://MyQuery" connector="MyConnector" /> Done. The cool thing is that there's no need to escape your queries anymore. You can just create a file called MyQuery.sql containing your query, put it in your classpath and you're set. @Mule guru's, maybe you can add this code (or a better version) to Mule and add the above sample in the documentation. Thanks! |
|
|
Re: MalformedEndpointExceptionSo what should I use instead? yyyy-MM-dd hh:mm:ss is the format in the db...
|
|
|
Re: MalformedEndpointExceptionThis is not a suitable solution for me, as the sql string is built dynamically....Unless mule can register a change in the sql file...
|
|
|
Re: MalformedEndpointExceptionCheck out the Mule documentation on jdbc provider:
http://mule.codehaus.org/display/MULE/Jdbc+Provider especially the "Creating Queries" part should be of interest to you :) On 4/13/07, acw <andreas.willadsen@...> wrote:
|
|
|
|
|
|
RE: MalformedEndpointExceptionHave you tried using the
TO_DATE Oracle function instead of using the date as string directly? I think you
may see some issues with the TNS_DATE_FORMAT value of your session. (it may not
be set in your case) -- jo From:
Tim Schraepen [mailto:sch3lp@...] My first guess would be
the ":" that mark the separators between hours, minutes and seconds. On 4/13/07, acw
<andreas.willadsen@...>
wrote:
|
|
|
Re: MalformedEndpointExceptionThx for the inputs, I've solved this, and here is the solution:
Since the boolean operators '<' and '>' also gave a problem, i replace these with %3C (<) and %3E (>). Then i wrap my date in a to_date('2007-04-13 12:16:40','YYYY-MM-DD HH24:MI:SS'). This gives a query looking like: SELECT * FROM CATS_OWNER.V_CATS_CPH_WWW_SUBSCRIBE WHERE (FLT_TYPE in ('B','C','G','J','S') AND PUBLIC_ROLL_OFF = 0) AND SCHEDULE_TM %3E= to_date('2007-04-13 12:16:40','YYYY-MM-DD HH24:MI:SS') AND SCHEDULE_TM %3C= to_date('2007-04-13 14:16:40','YYYY-MM-DD HH24:MI:SS')
|
|
|
Re: MalformedEndpointExceptionIndeed, the problem is finding the correct escape characters.
When I was using URLs like this, I just copy pasted the select statement in a browser (like firefox) and let him resolve the escaping. E.g. query: select * from a where b <= 1000 Paste this as: http://a.b.c/a?select * from a where b <= 1000 Returns as: http://a.b.c/a?select%20*%20from%20a%20where%20b%20%3C=%201000 Rather stupid, but it works ;) |
|
|
Re: MalformedEndpointExceptionGuys,
could one of you please file an enhancement request in JIRA? We should be able to properly escape any special characters for the JDBC URL without making the user jump through .. the web browser ;) Holger --------------------------------------------------------------------- To unsubscribe from this list please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: MalformedEndpointException |
| Free embeddable forum powered by Nabble | Forum Help |