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

Reply via email to