Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] [udig-users] SQL Server connection bug [SEC=UNCLASSIFIED]

Good evening:

I am afraid I do not have an SQL Server to test against.

The geotools docs are here:
- http://docs.geotools.org/latest/userguide/library/jdbc/sqlserver.html

Could you write a quick test case or java program to confirm you are able to connect using GeoTools?

The SQL Server plugin is supported plugin in GeoTools so we can ask for help once we confirm we are able to connect.
That is a good question. In fact I assume you are using the SQL Server connection as of Import->Datastore->Microsoft SQL Server
Right?

That means that the proper connection classes are extracted from geotools and you will not find any SQLServerDataStoreFactory 
written anywhere.
That is correct  - the class is DataStoreService; and the toDataAccess method is responsible for connecting.


    public synchronized DataAccess< ? , ? > toDataAccess() throws IOException {
        if (dataStore == null) {
            // connect!
            try {
                dataStore = factory.createDataStore(connectionParams);
            } catch (IOException e) {
                message = e;
                throw e;
            }
        }
        return dataStore;
    }

I guess the gui is built in: net.refractions.udig.catalog.geotools.data.DataStoreParameterPage

There is an internal class that tests for the connection: net.refractions.udig.catalog.geotools.data.DataStoreParameterPage.TestConnection
That might be a good place to lurk with a breakpoint.
 Reviewing.

    private final class TestConnection implements IRunnableWithProgress {
        private boolean isConnected;
        public void run( IProgressMonitor monitor ) throws InvocationTargetException,
                InterruptedException {
            isConnected = false;
            DataAccessFactory factory = getPreviousPage().getFactory();
            connectionParameters = getParams();

            if (factory.canProcess(connectionParameters)) {
                try {
                    factory.createDataStore(connectionParameters);
                    isConnected = true;
                } catch (IOException e) {
                    setErrorMessage(e.toString());
                }
            }
        }
        public boolean isConnected() {
            return isConnected;
        }
    }

Looks like that will set the error message if there is any problem connecting. So if you are able to make it past this screen we should be good to go.

Jody



Back to the top