[Gvsig_english] How to get a DataSource reference from
DataSourceFactory
Jose Manuel Vivó (Chema)
josemanuel.vivo at iver.es
Mon Dec 11 08:36:01 CET 2006
Hi, Olivier
El Jueves 07 Diciembre 2006 12:27, Olivier Ertz escribió:
> Dear gvSIG hackers,
> How do I get a DataSource reference from the DataSourceFactory after
> having added a new FileDataSource ?
> Here is a code block to explain what I do :
>
> // load another data source
> String dsName = LayerFactory.getDataSourceFactory()
> .addFileDataSource("Bna Alphanumeric
> Driver","D:/tmp/VS-dis_Pop18501990.tab");
>
You can use these two methods:
* Open a new DataSource:
DataSource ds = LayerFactory.getDataSourceFactory()
.createRandomDataSource(dsName);
ds.start();
* By a Sql instruction:
DataSource ds = LayerFactory.getDataSourceFactory()
.executeSQL("Select * from " +dsName, DataSourceFactory.MANUAL_OPENING);
ds.start();
> Is there a method that can return a reference to the DataSource I've
> just added (I've only a name, so ...) ?
> Thanx for your help.
>
> Olivier.
Best regards
Chema.
--
=============
Jose Manuel Vivó (Chema)
Equipo de gvSIG
IVER T.I. S.A.
c/Salamanca 50
46005 Valencia
Spain
More information about the Gvsig_internacional
mailing list