Revision 44361 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.db/org.gvsig.fmap.dal.db.h2/src/main/java/org/gvsig/fmap/dal/store/h2/H2SpatialHelper.java

View differences:

H2SpatialHelper.java
61 61
        if( dbfilename!=null && dbfilename.endsWith(".mv.db") ) {
62 62
            dbfilename = dbfilename.substring(0, dbfilename.length()-6);
63 63
        }
64
        StringBuilder commonParameters = new StringBuilder();
65
        commonParameters.append(";MODE=PostgreSQL");
66
        commonParameters.append(";SCHEMA=PUBLIC");
67
        commonParameters.append(";ALLOW_LITERALS=ALL");
68
        
69
//        Integer LOCK_TIMEOUT = (Integer) params.getDynValue("LOCK_TIMEOUT");
70
//        if( LOCK_TIMEOUT!=null ) {
71
//            commonParameters.append(";LOCK_TIMEOUT=").append(LOCK_TIMEOUT);
72
//        }
73
//        Integer MULTI_THREADED = (Integer) params.getDynValue("MULTI_THREADED");
74
//        if( MULTI_THREADED!=null ) {
75
//            commonParameters.append(";MULTI_THREADED=").append(MULTI_THREADED);
76
//        }
77
//        Integer CHACHE_SIZE = (Integer) params.getDynValue("CHACHE_SIZE");
78
//        if( LOCK_TIMEOUT!=null ) {
79
//            commonParameters.append(";CHACHE_SIZE=").append(CHACHE_SIZE);
80
//        }
81
//        Integer LOG = (Integer) params.getDynValue("LOG");
82
//        if( LOCK_TIMEOUT!=null ) {
83
//            commonParameters.append(";LOG=").append(LOG);
84
//        }
85
//        Integer LOCK_MODE = (Integer) params.getDynValue("LOCK_MODE");
86
//        if( LOCK_TIMEOUT!=null ) {
87
//            commonParameters.append(";LOCK_MODE=").append(LOCK_MODE);
88
//        }
89
        
64 90
        if( StringUtils.isEmpty(params.getHost()) ) {
65 91
            // Asumimos que es una conexion directa sobre el filesystem
66 92
            if( StringUtils.equalsIgnoreCase(FilenameUtils.getExtension(params.getFile().getName()),"zip") ) {
67 93
                connectionURL =  MessageFormat.format(
68
                    "jdbc:h2:zip:{0}!/{1};MODE=PostgreSQL",
94
                    "jdbc:h2:zip:{0}!/{1}"+commonParameters.toString(),
69 95
                    dbfilename,
70 96
                    params.getDBName()
71 97
                );
72 98
            } else {
73 99
                connectionURL =  MessageFormat.format(
74
                    "jdbc:h2:file:{0};MODE=PostgreSQL",
100
                    "jdbc:h2:file:{0}"+commonParameters.toString(),
75 101
                    dbfilename
76 102
                );
77 103
            }
78 104
        } else if( params.getPort() == null ) {
79 105
            connectionURL =  MessageFormat.format(
80
                "jdbc:h2:tcp://{0}/{1};MODE=PostgreSQL",
106
                "jdbc:h2:tcp://{0}/{1}"+commonParameters.toString(),
81 107
                params.getHost(),
82 108
                dbfilename
83 109
            );            
84 110
        } else {
85 111
            connectionURL =  MessageFormat.format(                
86
                "jdbc:h2:tcp://{0}:{1,number,#######}/{2};MODE=PostgreSQL",
112
                "jdbc:h2:tcp://{0}:{1,number,#######}/{2}"+commonParameters.toString(),
87 113
                params.getHost(),
88 114
                params.getPort().intValue(),
89 115
                dbfilename
......
165 191
            try {
166 192
                conn.createStatement().execute("CREATE SCHEMA IF NOT EXISTS PUBLIC;SET SCHEMA PUBLIC");
167 193
            } catch(SQLException ex) {
168
                //do nothing
194
                // Ignore this error.
169 195
            }
196

  
170 197
            return conn;
171 198
        }
172 199

  

Also available in: Unified diff