Here's my code:

        Map params = new HashMap();
        params.put("dbtype", "postgis");        //must be postgis
        params.put("host", "localhost");        //the name or ip address of the machine running PostGIS
        params.put("port", new Integer(5432));  //the port that PostGIS is running on (generally 5432)
        params.put("database", "db");      //the name of the database to connect to.
        params.put("user", "postgres");         //the user to connect with
        params.put("passwd", "");               //the password of the user.

        try
        {
            DataStore pgDatastore = DataStoreFinder.getDataStore(params);
       
            System.out.println(pgDatastore.getTypeNames()[0]);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

I'm using geotools 2.2 and the same jdbc driver as you (postgresql-8.1-407.jdbc3.jar). As I said before, it works fine. Looking the differences between this code and the one you sent, I just notice that you use props.getProperty(...) to put the parameters in the map, I suppose that method returns strings with the correct values. ¿What's the props object?. If it's a Property object, it sounds strange to me the names of the properties you ask for.

I don't have the postgis-driver-1.0.jar in the classpath (altough it should make no difference), appart from that, it's the same.


Bye,
Antonio
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to