Examples of JtdsDataSource


Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

  }

  @Bean
  @Override
  public DataSource dataSource() {
    JtdsDataSource ds = new JtdsDataSource();
    ds.setUser(System.getProperty("mssql.user", "unittest"));
    ds.setPassword(System.getProperty("mssql.password"));
    ds.setInstance(System.getProperty("mssql.instance"));
    ds.setServerName(System.getProperty("mssql.hostname", "localhost"));
    ds.setDatabaseName("spring_data_jdbc_repository_test");
    return ds;
  }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

  }

  @Bean
  @Override
  public DataSource dataSource() {
    JtdsDataSource ds = new JtdsDataSource();
    ds.setUser(System.getProperty("mssql2012.user", "unittest"));
    ds.setPassword(System.getProperty("mssql2012.password"));
    ds.setInstance(System.getProperty("mssql2012.instance"));
    ds.setServerName(System.getProperty("mssql2012.hostname", "localhost"));
    ds.setDatabaseName("spring_data_jdbc_repository_test");
    return ds;
  }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

     *
     * @return the <code>XADataSource.
     * @throws SQLException if an error condition occurs
     */
    public XADataSource getDataSource() throws SQLException {
        JtdsDataSource xaDS = new JtdsDataSource();
        String user     = props.getProperty(Messages.get(Driver.USER));
        String pwd      = props.getProperty(Messages.get(Driver.PASSWORD));
        String host     = props.getProperty(Messages.get(Driver.SERVERNAME));
        String port     = props.getProperty(Messages.get(Driver.PORTNUMBER));
        String database = props.getProperty(Messages.get(Driver.DATABASENAME));
        String xaMode   = props.getProperty(Messages.get(Driver.XAEMULATION));
        String tds      = props.getProperty(Messages.get(Driver.TDS));
        String serverType = props.getProperty(Messages.get(Driver.SERVERTYPE));
        int portn;
        try {
            portn = Integer.parseInt(port);
        } catch (NumberFormatException e) {
            portn = 1433;
        }
        xaDS.setServerName(host);
        xaDS.setPortNumber(portn);
        xaDS.setUser(user);
        xaDS.setPassword(pwd);
        xaDS.setDatabaseName(database);
        xaDS.setXaEmulation(xaMode.equalsIgnoreCase("true"));
        xaDS.setTds(tds);
        xaDS.setServerType("2".equals(serverType)? 2: 1);
        return xaDS;
    }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

     * Tests that the factory can correctly rebuild a DataSource with no
     * properties set (i.e. all values should be null and no NPE should be
     * thrown).
     */
    public void testNoProperties() throws Exception {
        JtdsDataSource ds = new JtdsDataSource();

        Reference dsRef = ds.getReference();
        assertEquals("net.sourceforge.jtds.jdbcx.JtdsObjectFactory",
                     dsRef.getFactoryClassName());
        assertEquals("net.sourceforge.jtds.jdbcx.JtdsDataSource",
                     dsRef.getClassName());

        ds = (JtdsDataSource) new JtdsObjectFactory()
                .getObjectInstance(dsRef, null, null, null);

        assertNull(ds.getServerName());
        assertEquals(0, ds.getServerType());
        assertEquals(0, ds.getPortNumber());
        assertNull(ds.getDatabaseName());
        assertNull(ds.getDatabaseName());
        assertEquals(0, ds.getPortNumber());
        assertNull(ds.getTds());
        assertNull(ds.getCharset());
        assertNull(ds.getLanguage());
        assertNull(ds.getDomain());
        assertNull(ds.getInstance());
        assertEquals(false, ds.getLastUpdateCount());
        assertEquals(false, ds.getSendStringParametersAsUnicode());
        assertEquals(false, ds.getNamedPipe());
        assertNull(ds.getMacAddress());
        assertEquals(0, ds.getPrepareSql());
        assertEquals(0, ds.getPacketSize());
        assertEquals(false, ds.getTcpNoDelay());
        assertNull(ds.getUser());
        assertNull(ds.getPassword());
        assertEquals(0, ds.getLoginTimeout());
        assertEquals(0, ds.getLobBuffer());
        assertEquals(0, ds.getMaxStatements());
        assertNull(ds.getAppName());
        assertNull(ds.getProgName());
        assertEquals(false, ds.getXaEmulation());
        assertNull(ds.getLogFile());
        assertNull(ds.getSsl());
        assertEquals(0, ds.getBatchSize());
        assertNull(ds.getDescription());
        assertNull(ds.getBindAddress());
        assertEquals(false, ds.getUseJCIFS());
    }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

                                    if ("useMetadataCache".equals(fieldName)) {
                                        fieldName = "cacheMetaData";
                                    }
                                }

                                JtdsDataSource referenceDataSource = new JtdsDataSource();
                                invokeSetInstanceField(referenceDataSource, fieldName, expected);
                                Reference reference = referenceDataSource.getReference();
                                JtdsObjectFactory jtdsObjectFactory = new JtdsObjectFactory();
                                JtdsDataSource dataSource =
                                        (JtdsDataSource) jtdsObjectFactory.getObjectInstance(reference, null, null, null);

                                // Hack for JtdsDataSource.getTds()
                                {
                                    if ("tdsVersion".equals(fieldName)) {
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

     * Tests that the public constructor works.
     * <p/>
     * Needed so that this class has at least one test.
     */
    public void testPublicConstructor() {
        assertNotNull(new JtdsDataSource());
    }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

                                if ("useMetadataCache".equals(fieldName)) {
                                    fieldName = "cacheMetaData";
                                }
                            }

                            JtdsDataSource dataSource = new JtdsDataSource();
                            invokeSetInstanceField(dataSource, fieldName, expected);

                            // Hack for JtdsDataSource.getTds()
                            {
                                if ("tdsVersion".equals(fieldName)) {
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

                                {
                                    if ("useMetadataCache".equals(fieldName)) {
                                        fieldName = "cacheMetaData";
                                    }
                                }
                                JtdsDataSource dataSource = new JtdsDataSource();
                                invokeSetInstanceField(dataSource, fieldName, expected);
                                Reference reference = dataSource.getReference();
                                assertEquals(message, expected, reference.get(Messages.get(key)).getContent());
                            }
                            catch (NamingException e) {
                                throw new RuntimeException(e.getMessage());
                            }
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

                                if ("useMetadataCache".equals(fieldName)) {
                                    fieldName = "cacheMetaData";
                                }
                            }

                            JtdsDataSource dataSource = new JtdsDataSource();
                            dataSource.setServerName("non-null-value");
                            invokeSetInstanceField(dataSource, fieldName, expected);

                            Properties props = new Properties();
                            invokeInstanceMethod(dataSource, "addNonNullProperties",
                                                 new Class[]{Properties.class, String.class, String.class},
View Full Code Here

Examples of net.sourceforge.jtds.jdbcx.JtdsDataSource

        /**
         * Test connecting without specifying a host. Should get an SQL state
         * of 08001 (SQL client unable to establish SQL connection).
         */
        public void testNoHost() {
            JtdsDataSource ds = new JtdsDataSource();
            ds.setUser(TestBase.props.getProperty(Messages.get(Driver.USER)));
            ds.setPassword(TestBase.props.getProperty(Messages.get(Driver.PASSWORD)));
            ds.setDatabaseName(TestBase.props.getProperty(Messages.get(Driver.DATABASENAME)));
            try {
                ds.setPortNumber(Integer.parseInt(
                        TestBase.props.getProperty(Messages.get(Driver.PORTNUMBER))));
            } catch (Exception ex) {
                // Ignore
            }
            try {
                assertNotNull(ds.getConnection());
                fail("What the?...");
            } catch (SQLException ex) {
                assertEquals("Expecting SQL state 08001. Got " + ex.getSQLState(), "08001", ex.getSQLState());
            } catch (Throwable t) {
                t.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.