Interesting; so Postgis datastore correctly identified the parameters as 
intended for it; but could not determine that anything was wrong until you 
tried to connect and do something.

I often ask for the list of type names in order to check if a datastore is 
"working" (just as you have done).

-- 
Jody Garnett


On Thursday, 16 June 2011 at 9:34 PM, robert benjamin shimirwa wrote:

> hello everyone,
> i saw that when given wrong parameters (i'm using a postGIS database), the 
> DataStoreFinder.getDataStore(params) does return something different to null, 
> and do not throw any exception! i tried to read the source of the 
> DataStoreFinder class, getDataStore(params) method, but didn't find anything 
> helpful (truly talking, didn't understand!! didn't see where the params were 
> used!!). if anybody got tricks to check if the DataStoreFinder class did find 
> a valid resource, or any other way of testing the returned datastore, it 
> would be kind. i hope Jody is going reply the first. 
> 
>  JDataStoreWizard wizard = new JDataStoreWizard(new 
> PostgisNGDataStoreFactory());
>  int result = wizard.showModalDialog();
> 
>  try {
>  if (result == JWizard.FINISH) {
>  Map<String, Object> connectionParameters = wizard.getConnectionParameters();
>  dataStore = DataStoreFinder.getDataStore(connectionParameters);
>  }
>  } catch (IOException ex) {
>  Logger.getLogger(ConnexionBDD.class.getName()).log(Level.SEVERE, "Getting 
> the DataSotre bibaye ikibazo", ex);
>  System.exit(1);
>  }
>  if (dataStore == null) {
>  JOptionPane.showMessageDialog(null, "Echec connexion: verifier les 
> parametres");
>  System.exit(1);
>  }
>  else {
>  try {
> --------->>  tabs = dataStore.getTypeNames();
>  } catch (IOException ex) {
>  System.err.print("ntakirimo: "+ex);
>  }
>  JOptionPane.showMessageDialog(null, "Connexion reussi avec success!!");
>  }
> 
> it's only when i try to use the wrong datastore that it returns me an 
> IOException.
> 
> 
> 
> ------------------------------------------------------------------------------
> EditLive Enterprise is the world's most technically advanced content
> authoring tool. Experience the power of Track Changes, Inline Image
> Editing and ensure content is compliant with Accessibility Checking.
> http://p.sf.net/sfu/ephox-dev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected] 
> (mailto:[email protected])
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to