Here are two Oracle patches submitted by Tobia. I think Andrea was going to commit one, but I do not see any mention in the issue that he did. http://jira.codehaus.org/browse/GEOT-3175 http://jira.codehaus.org/browse/GEOT-3176
Tobia is now a committer. On 05/08/10 09:48, Jody Garnett wrote: > Hey Tobia; > > I am sifting through email looking at the state of Oracle (and plan to > release geotools 2.6.5 tomorrow). There are a number of good ideas you > have provided (both this email and one on byte[] mappings). > > Did you ever create a jira and push these changes back into the project? > > jody > > On Fri, Jul 2, 2010 at 8:35 PM, Tobia Di Pisa > <[email protected]> wrote: >> Hi, >> >> I have consulted the Oracle documentation at this link: >> >> http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#top >> (in the 'Connections' section) >> >> and I see that the HOST and PORT parameters are not always required to >> compose the JDBC URL. >> >> In the current 'getJDBCUrl' method the DATABASE parameter is alwais required >> to compose the JDBC URL but, in the JDBCDataStoreFactory >> class, this parameter not have the "required" flag set up. >> >> To resolve this problem I modified the OracleNGDataStoreFactory class as >> follow: >> >> 1) Marking HOST and PORT parameters as not "required" and DATABASE as >> "required": >> >> ... >> >> /** parameter for database port */ >> public static final Param PORT = new Param("port", Integer.class, >> "Port", false, 1521); >> >> /** parameter for database host */ >> public static final Param HOST = new Param("host", String.class, "Host", >> false, "localhost"); >> >> /** parameter for database instance */ >> public static final Param DATABASE = new Param("database", String.class, >> "Database", true); >> >> ... >> >> 2) Modifying 'getJDBCurl' method as follow: >> >> ... >> >> @Override >> protected String getJDBCUrl(Map params) throws IOException { >> String db = (String) DATABASE.lookUp(params); >> String host = (String) HOST.lookUp(params); >> Integer port =(Integer) PORT.lookUp(params); >> >> if(db.startsWith("(")) >> return JDBC_PATH.concat(db); >> else if(db.startsWith("/")&& host != null&& port != null) >> return >> JDBC_PATH.concat("//").concat(host).concat(":").concat(port.toString()).concat(db); >> else if(host != null&& port != null) >> return >> JDBC_PATH.concat(host).concat(":").concat(port.toString()).concat(":").concat(db); >> else >> throw new IOException("Unable to properly compose the JDBC URL >> string, some parameters as host and port may be null !"); >> } >> >> ... >> >> 3) Modifying the 'setupParameters' method introducing the new HOST, PORT and >> DATABASE definitions: >> >> ... >> >> @Override >> protected void setupParameters(Map parameters) { >> // NOTE: when adding parameters here remember to add them to >> OracleNGOCIDataStoreFactory and >> // OracleNGJNDIDataStoreFactory >> >> super.setupParameters(parameters); >> parameters.put(LOOSEBBOX.key, LOOSEBBOX); >> parameters.put(MAX_OPEN_PREPARED_STATEMENTS.key, >> MAX_OPEN_PREPARED_STATEMENTS); >> parameters.put(PORT.key, PORT); >> parameters.put(HOST.key, HOST); >> parameters.put(DATABASE.key, DATABASE); >> parameters.put(DBTYPE.key, DBTYPE); >> } >> >> ... >> >> Before opening a JIRA I propose these changes. >> >> >> Best regards, >> Tobia >> >> >> 2010/7/1 Andrea Aime<[email protected]> >>> >>> Tobia Di Pisa ha scritto: >>>> >>>> Hi all, >>>> >>>> I need to access an Oracle data store using the following parameters: >>>> >>>> USER: xxx >>>> >>>> PASSWD: xxx >>>> >>>> DATABASE: (DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = >>>> xxx)(PORT = xxxx))(ADDRESS = (PROTOCOL = TCP)(HOST = xxx)(PORT = >>>> xxxx))(LOAD_BALANCE = >>>> yes))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxx.xxx.xxx.xx)(FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5)))) >>>> >>>> When you run the OracleNGDataStoreFactory.getJDBCUrl (Map params) >>>> protected method, the execution of the 'lookUp' function throws an >>>> IOException as the HOST and PORT parameters are required. >>>> >>>> This is the method code: >>>> >>>> ... >>>> @Override >>>> protected String getJDBCUrl(Map params) throws IOException { >>>> String host = (String) HOST.lookUp(params); >>>> String db = (String) DATABASE.lookUp(params); >>>> int port = (Integer) PORT.lookUp(params); >>>> >>>> if( db.startsWith("(") ) >>>> return JDBC_PATH + db; >>>> else if( db.startsWith("/") ) >>>> return JDBC_PATH + "//" + host + ":" + port + db; >>>> else >>>> return JDBC_PATH + host + ":" + port + ":" + db; >>>> } >>>> ... >>>> In fact, if the DATABASE parameter starts with "(", the HOST and >>>> PORT parameters are not used because the function returns 'JDBC_PATH + db'. >>>> To resolve this problem I used this code: >>>> >>>> ... >>>> @Override >>>> protected String getJDBCUrl(Map params) throws IOException { >>>> String db = (String) DATABASE.lookUp(params); >>>> if(db.startsWith("(")) >>>> return JDBC_PATH + db; String host = >>>> (String) HOST.lookUp(params); int port = (Integer) >>>> PORT.lookUp(params); >>>> if( db.startsWith("/") ) >>>> return JDBC_PATH + "//" + host + ":" + port + db; >>>> else >>>> return JDBC_PATH + host + ":" + port + ":" + db; } >>>> ... >>>> >>>> Are there any contraindications to change the method 'getJDBCUrl' in this >>>> way ? >>> >>> I don't think so, but for jdbc-ng changes you should open a Jira and >>> cc me, Justin and Christian (the module maintainers). >>> >>> Is the above really solving the issue? Host and port are marked >>> as required at the JDBCDataStoreFactory declaration. >>> I think you also create clones in OracleDataStoreFactory >>> that do not have the "required" flag set up and use those >>> in getParametersInfo >>> >>> Cheers >>> Andrea >>> >>> >>> -- >>> Andrea Aime >>> OpenGeo - http://opengeo.org >>> Expert service straight from the developers. >>> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first >> _______________________________________________ >> Geotools-gt2-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- Ben Caradoc-Davies <[email protected]> Software Engineering Team Leader CSIRO Earth Science and Resource Engineering Australian Resources Research Centre ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
