« Return to Thread: MalformedEndpointException

Re: MalformedEndpointException

by Tim Schraepen :: Rate this Message:

Reply to Author | View in Thread

Check 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:

This is not a suitable solution for me, as the sql string is built
dynamically....Unless mule can register a change in the sql file...


kennywest wrote:

>
> This 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!
>
>

--
View this message in context: http://www.nabble.com/MalformedEndpointException-tf3571684.html#a9979371
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: MalformedEndpointException