> Adam,
>
> Thanks a lot! I'll check it out and let you know how it goes.
>
> Kind regards,
>
> Danny
>
> Quoting Adam Retter <
adam@...>:
>
>> Danny, during some spare time at lunch today I have added in two
>> additional functions to the SQL module for JNDI support -
>>
>> sql:get-jndi-connection($jndiName)
>> sql:get-jndi-connection($jndiName, $username, $password)
>>
>> Hopefully that will help you, unfortunately I have not had the time to
>> test this as I have no easy access to JNDI sources. Anyways the code
>> is in eXits's trunk. If you can check that out and build it and give
>> it a test then that would be great.
>>
>> Thanks Adam.
>>
>>
>> 2008/5/8 Adam Retter <
adam@...>:
>>> Not much is required, really you need an extra function (perhaps
>>> called get-jndi-connection()) in the SQLModule which would be very
>>> similar to the existing sql:get-connection() method.
>>>
>>> For a function such as sql:get-jndi-connection($jndiName, $username,
>>> $password), All it would really need to do is something like this -
>>>
>>> String dbJNDI = args[0].getStringValue();
>>> String dbUser = args[1].getStringValue();
>>> String dbPassword = args[2].getStringValue();
>>>
>>> Context ctx = new InitialContext();
>>> DataSource ds = (DataSource) ctx.lookup(dbJNDI);
>>> Connection con = ds.getConnection(dbUser, dbPassword);
>>>
>>> //get the existing connections map from the context
>>> HashMap connections =
>>> (HashMap)context.getXQueryContextVar(SQLModule.CONNECTIONS_CONTEXTVAR);
>>> if(connections == null)
>>> {
>>> //if there is no connections map, create a new one
>>> connections = new HashMap();
>>> }
>>>
>>> //get an id for the connection
>>> long conID = getUID();
>>>
>>> //place the connection in the connections map
>>> connections.put(new Long(conID), con);
>>>
>>> //store the updated connections map back in the context
>>> context.setXQueryContextVar(SQLModule.CONNECTIONS_CONTEXTVAR, connections);
>>>
>>> //return the uid handle of the connection
>>> return new IntegerValue(conID);
>>>
>>>
>>> 2008/5/8 <
exist@...>:
>>>>
>>>> Hi,
>>>>
>>>> We're currently in a project in which we're going to use exist and
>>>> xquery to aggregate data from several sources like external web
>>>> services, data stored in exist and data stored in RDBMS-es.
>>>>
>>>> We're using the httpclient module to call the external web services
>>>> and are going to use the sqlmodule for getting the data from the
>>>> RDBMS-es.
>>>>
>>>> eXist will be run from within tomcat or jetty.
>>>> For the SQL connections, it would be nice if I was able to reference a
>>>> jndi resource that is managed by tomcat/jetty. This way tomcat/jetty
>>>> will be responsible for maintaining and cleaning up the connections to
>>>> the databases and it will result in a more scalable solution as
>>>> compared to opening and closing a connection for each query that is run.
>>>>
>>>> Since I'm no programmer, I would like to know if someone has done this
>>>> already or what needs to be changed/added to the sql module to
>>>> implement this.
>>>>
>>>> Any feedback on this idea will be much appreciated.
>>>>
>>>>
>>>> Kind regard,
>>>>
>>>> Danny
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>>>> Don't miss this year's exciting event. There's still time to save $100.
>>>> Use priority code J8TL2D2.
>>>>
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone>>>> _______________________________________________
>>>> Exist-open mailing list
>>>>
Exist-open@...
>>>>
https://lists.sourceforge.net/lists/listinfo/exist-open>>>
>>>
>>>
>>> --
>>> Adam Retter
>>>
>>> eXist Developer
>>> { England }
>>>
adam@...
>>> irc://irc.freenode.net/existdb
>>>
>>
>>
>>
>> --
>> Adam Retter
>>
>> eXist Developer
>> { England }
>>
adam@...
>> irc://irc.freenode.net/existdb
>>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
>
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/> _______________________________________________
> Exist-open mailing list
>
Exist-open@...
>
https://lists.sourceforge.net/lists/listinfo/exist-open>