Sommer Gerhard ha scritto:
Andrea,
you were right. It is better now, but it still does not work, as
?loginTimeout=0 is appended automatically resulting in something like
jdbc:.....geoserver?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory?loginTimeout=0...
Heh, you're right. I've checked the code further and it seems there's no workaround. The connection is in fact managed by the following pooling
data source code:
org.postgresql.jdbc2.optional.ConnectionPool poolDataSource = null;
String dbUrl = connPath;
String poolKey = dbUrl + user + pass;
LOGGER.fine("looking up pool key " + poolKey);
Object poolDS = dataSources.get(poolKey);
poolDataSource = (org.postgresql.jdbc2.optional.ConnectionPool)poolDS;
LOGGER.fine("pool is " + poolDataSource);
if (poolDataSource == null) {
poolDataSource = new org.postgresql.jdbc2.optional.ConnectionPool();
//source.setDataSourceName("Geotools Postgis");
poolDataSource.setServerName(host);
poolDataSource.setDatabaseName(dbName);
poolDataSource.setPortNumber(port);
poolDataSource.setUser(user);
poolDataSource.setPassword(pass);
//source.setMaxConnections(10);
//the source looks like this defaults to false, but we have
//assumed true (as that's how it was before pooling)
poolDataSource.setDefaultAutoCommit(true);
Unfortunately it means that the workaround has no way of working,
and what's worse, there's not setSSL or similar method in poolDataSource, which as you can see is a class provided by the
driver itself. Basically the coders here assumed that if you're using
pooling, you're not using SSL (reasonable assumption usually, but
not in your case).
So... it seems the only way make your situation work is to
replace the postgis connection pool with another one (like DBCP)
that allows for the specification of whatever connection property
you want (provided that it can be specified in the JDBC URL, as is
with your case).
Support for external connection pools and JNDI provided pools is
indeed planned for geotools, but not in the very short term (not
days, but I guess before two months).
Your best bet is to fix the postgis data store by yourself,
shouldn't be too hard. Replace the above code with a connection
pool setup with DBCP adn using connPath as is and you should be ok.
Cheers
Andrea