Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] How to get work Oracle plug-in (full tutorial )

Hi!

Some hints how to connect to Oracle DB using UDIG plug-in (This is full road while Jukka didn’t say about source code modifications ).

 

There are couple of bugs (if bug is not feature in that case) that were found and were the reason of fault to get connection.

The following steps must be performed:

 

1) From dummy-spatial-8.1.8.jar that is in  net.refractions.udig.lib delete the following class files:
            oracle.jdbc.*

            oracle.sql.*

           

2) Put classes12.jar or ojdbc14.jar into lib folder of net.refractions.udig.lib plugin

 

3) Add information about added JDBC driver library into all places in project (in “Library” and “Order and Export” tabs of “Java Build Path” entry in project properties dialog.

 

4) Don’t forget “Refresh” project in package Explorer

 

5) Open manifest editor and add JDBC driver library and “Runtime” tab. Add JDBC driver library into “Classpath” list, check that oracle.jdbc, oracle.jdbc.driver, oracle.jdbc.pool entries exist in “Exported packages” list.

 

The next steps are important and they concern source code and corrections that we can’t update into repository at the current momentJ..  and we have local versions of these corrections

 

In OracleServiceExtension class find the following method and comment the following code as specified in this snippet:

 

>>>>>======================

    public IService createService( URL id, Map<String,Serializable> params ) {

//        if(params!=null && params.containsKey(getFactory().getParametersInfo()[2].key)

//&& params.get(getFactory().getParametersInfo()[2].key) instanceof String){

//            String val = (String)params.get(getFactory().getParametersInfo()[2].key);

//            params.remove(val);

//            params.put(getFactory().getParametersInfo()[2].key,new Integer(val));

//        }

        if(!getFactory().canProcess(params))

            return null;

        if(id == null){

<<<<<======================

 

Then in OracleSpatialWizardPage find the following place and comment whatever is commented by me:

 

>>>>>======================

    public Map<String,Serializable> getParams() {

        Map<String,Serializable> params = new HashMap<String,Serializable>();

        Param[] dbParams = factory.getParametersInfo();

        params.put(dbParams[0].key,"oracle"); //$NON-NLS-1$

        params.put(dbParams[1].key, getHostText());

        String port1 = getPortText();

//                      try {

//                                 params.put(dbParams[2].key, new Integer(port1));

//                      } catch (NumberFormatException e) {

//                                 params.put(dbParams[2].key, new Integer(1521));

//                      }

<<<<<===================

 

 

Then in DataBaseRegistryWizardPage find line of code that is actually in createControl() method:

 

>>>>>>==================

        composite.setTabList(tablist.toArray(new Control[tablist.size()]));    

 

<<<<< ==================

 

 

and change it to the following snippet of code:

 

>>>>>>======================

 

        if (schema != null) {

 

            if(advanced == null)

                        composite.setTabList(new Control[]{host,user,pass,database,schema,advancedKey,port});

            else

                        composite.setTabList(new Control[]{host,user,pass,database,schema,advancedKey,advanced,port});

        }

        else {

            if(advanced == null)

                        composite.setTabList(new Control[]{host,user,pass,database,advancedKey,port});

            else

                        composite.setTabList(new Control[]{host,user,pass,database,advancedKey,advanced,port});

        }

 

 

<<<<< ================

       

 

After just recompile all plugins that were changed by these modifications and start application

 

 

This approach is only for those who works with source code… there is no way to make these modifications in compiled product J

 

If anyone who is able to submit changes to repository will do it,  that would be perfect!

Be open to ask me directly about problems (  vitali@xxxxxxxxxxxx )

 

 

Regards, Vitali.

 


Back to the top