Hi Elton,

This is not an easy question

If I look at the javadoc, it seems that from the layer, I can get the 
connection

myLayer.getDataSourceQuery().getDataSource().getConnection();

This is not a JDBC connection but a OpenJUMP connection.
If you use the right syntax for the query, from there, it should be 
possible to

connection.executeQuery(queryString, monitor);

I did not test anything and may have missed something important.

I do not see anyway to get the ConnectionDescriptor and all the 
connection stuff from a layer with current code.
Maybe possible to sublass layer or DataSource to store 
ConnectionDescriptor stuff.

my 2 cts

Michaël




Elton Chan a écrit :
> Hi there,
>
> I have two postgis layers from the same database added in openjump and 
> would like to perform further query with code using SQL and 
> AdhocQuery. How can I retrieve the database connection of the postgis 
> layer (added manually)?
>
> It seems that I need to re-construct a parameter list for the 
> connection and create a datastoreconnection before I can make a 
> AdhocQuery, which I can do it without problem. However, I don't want 
> to re-construct the parameter list every time I need it. In fact, I've 
> found that there is a ConnectionDescriptor class that may help but I 
> don't know how to use it. I am thinking if I can retrieve a 
> ConnectionDescriptor based on an existing postgis layer.
>
> Grateful if you can give me some idea how to do it.
>
> Thanks,
> Elton
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> Jump-pilot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>   


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to