Package org.jitterbit.integration.database.driver

Examples of org.jitterbit.integration.database.driver.JdbcDriverDescriptor


        callback.caught(new NotImplementedYetException());
    }

    @Override
    public void getDrivers(JdbcDriverListCallback callback) {
        JdbcDriverDescriptor postgres = new JdbcDriverDescriptor("Postgresql", "jdbc:postgresql://%s/%s",
                        "org.postgresql.Driver", new BeginEndQuote("\"", "\""));
        callback.driversRetrieved(new JdbcDriverDescriptor[] { postgres }, null);
    }
View Full Code Here


        loc = new DatabaseLocation();
    }

    @Test
    public void ensureGetAndSetDriverWorks() {
        DriverDescriptor driver = new JdbcDriverDescriptor("PostgreSQL", "postgresql", "org.postgres.Driver",
                        BeginEndQuote.fromStrings("\"", "\""));
        TestDataUtils.testGetterAndSetter(loc, DatabaseLocation.DRIVER_PROPERTY, DriverDescriptor.class, "getDriver",
                        "setDriver", null, driver);
        loc.setDriver(null);
        assertTrue(loc.getDriver() == null);
View Full Code Here

        DriverDescriptor driver = OdbcDriverDescriptorFactory.createDescriptor("Postgresql", quotes);
        persist(driver, ODBC_FILE);
    }

    private void testPersistJdbc() throws Exception {
        DriverDescriptor driver = new JdbcDriverDescriptor("Postgresql", "jdbc:postgresql://%s/%s",
                        "org.postgresql.Driver", new BeginEndQuote("\""));
        persist(driver, JDBC_FILE);
    }
View Full Code Here

  }

  private String getSubProtocol(ConnectionParams params) throws ExternalDatabaseException {
      try {
            JdbcDriversConfig config = JdbcDriversConfig.getConfig();
            JdbcDriverDescriptor driver = config.getDriverDescriptor(params.getDriverName());
            String subprotocol = driver.getSubprotocol();
      writeLog("subprotocol=", subprotocol);
            return subprotocol;
        } catch (ServerConfigurationException ex) {
          writeLog(ex.toString());
            throw new ExternalDatabaseException(ex.getMessage(), ex);
View Full Code Here

        }
        return s.toString();
    }
   
    public static void main(String[] args) throws Exception {
        JdbcDriverDescriptor driver = new JdbcDriverDescriptor("Postgres", "postgresql", "org.postgresql.Driver", new BeginEndQuote("\""));
        DatabaseLocation loc = new DatabaseLocation();
        loc.setServer("linuxdoc");
        loc.setDatabase("Test");
        loc.setDriver(driver);
        Connection conn = DriverManager.getConnection(loc.getConnectionString(), "user1", "kongaqapass");
View Full Code Here

        BeginEndQuote quotes = BeginEndQuote.fromStrings("'", "'");
        DriverDescriptor driver = new OdbcDriverDescriptor("Informix", quotes);
        assertTrue(isInformix(driver));
        driver = new OdbcDriverDescriptor("PostgreSQL", quotes);
        assertFalse(isInformix(driver));
        driver = new JdbcDriverDescriptor("Informix", "informix", "a.b.c", quotes);
        assertTrue(isInformix(driver));
        driver = new JdbcDriverDescriptor("Postgres", "postgres", "a.b.c", quotes);
        assertFalse(isInformix(driver));
    }
View Full Code Here

     * @throws ServerConfigurationException
     *             if the driver configuration is incorrect, or the asked for driver is not
     *             registered on the server
     */
    public JdbcDriverDescriptor getDriverDescriptor(String name) throws ServerConfigurationException {
        JdbcDriverDescriptor driver = drivers.get(name);
        if (driver == null) {
            throw new ServerConfigurationException("The JDBC driver \"" + name +
                            "\" has not been registered on this server.");
        }
        return driver;
View Full Code Here

                    } else if ("EndQuote".equals(name)) {
                        endQuote = (value == null) ? "" : value;
                    }
                }
                builder.quotes(BeginEndQuote.fromStrings(beginQuote, endQuote));
                JdbcDriverDescriptor driver = builder.build();
                drivers.put(driver.getName(), driver);
            } catch (Exception ex) {
                error = new ServerConfigurationException("The Drivers section in jdbc.conf contains invalid data.", ex);
            }
        }
View Full Code Here

     * @return the opened <code>Connection</code>
     */
    @Override
    public Connection newConnection() throws ServerDbException, ServerAccessException, SQLException {
        try {
            JdbcDriverDescriptor driver = getDriver();
            driver.loadDriverClass();
            String url = driver.getConnectionString(connectionParams);
            String user = connectionParams.getUser();
            if (StringUtils.isEmpty(user)) {
                // Assume that the user name and password is defined manually in the connection string.
                return DriverManager.getConnection(url);
            }
View Full Code Here

public final class JdbcDriversConfigJUnitTest {

    @Test
    public void testSimpleConfiguration() {
        try {
            JdbcDriverDescriptor pgsql = new JdbcDriverDescriptor("PostgreSQL", "postgresql", "org.postgresql.Driver",
                            BeginEndQuote.POSTGRES);
            Xml xml = new Xml();
            xml.addDriver(pgsql, null);
            JdbcDriversConfig config = JdbcDriversConfig.fromXml(xml.toXml());
            List<JdbcDriverDescriptor> drivers = config.getRegisteredDrivers();
            assertEquals(1, drivers.size());
            JdbcDriverDescriptor driver = drivers.get(0);
            assertEquals(pgsql.getName(), driver.getName());
            assertEquals(pgsql.getSubprotocol(), driver.getSubprotocol());
            assertEquals(pgsql.getClass(), driver.getClass());
            assertNull(driver.getBeginEndQuotes());
        } catch (Exception e) {
            fail(e.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.jitterbit.integration.database.driver.JdbcDriverDescriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.