JTDSDataSourceFactory implements DataSourceFactory { @Override public JtdsDataSource createDataSource(Properties props) throws SQLException { try { return setProperties(new JtdsDataSource(), props); } catch (Exception ex) { throw new SQLException(ex); } } JTDSDataSourceFactory(); @Override JtdsDataSource createDataSource(Properties props); @Override JtdsDataSource createConnectionPoolDataSource(Properties props); @Override JtdsDataSource createXADataSource(Properties props); @Override Driver createDriver(Properties props);  }
@Test public void testDS() throws SQLException { JTDSDataSourceFactory dsf = new JTDSDataSourceFactory(); Properties props = testProps(); JtdsDataSource ds = dsf.createDataSource(props); validateDS(ds); }
@Test public void testEmptyProps() throws SQLException { JTDSDataSourceFactory dsf = new JTDSDataSourceFactory(); Properties props = new Properties(); JtdsDataSource ds = dsf.createDataSource(props); assertNotNull(ds); }
@Test public void testPropsWithUrl() throws SQLException { JTDSDataSourceFactory dsf = new JTDSDataSourceFactory(); Properties props = new Properties(); props.put("databaseName", DB); props.put("user", USER); props.put("password", PASSWORD); props.put("url", "jdbc:jtds:sqlserver: JtdsDataSource ds = dsf.createDataSource(props); validateDS(ds); assertEquals("my-domain", ds.getDomain()); assertTrue(ds.getUseNTLMV2()); }