@Override public void setUrl(String url) { dataSource.setUrl(url); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url) { setDriver(driver); setUrl(url); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param conProps the JDBC connection properties * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, Properties conProps) { setDriver(driver); setUrl(url); setConnectionProperties(conProps); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param username the JDBC username to use for accessing the DriverManager * @param password the JDBC password to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, String username, String password) { setDriver(driver); setUrl(url); setUsername(username); setPassword(password); }
@BeforeClass public static void setUp() { dbFile = System.getProperty("java.io.tmpdir") + File.separator + "batch_sqlite_inc.db"; dataSource = new SimpleDriverDataSource(); dataSource.setDriverClass(org.sqlite.JDBC.class); dataSource.setUrl("jdbc:sqlite:" + dbFile); template = new JdbcTemplate(dataSource); template.execute("create table max_value (id integer primary key autoincrement)"); }
@Bean("dataSource") public DataSource dataSource() { SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); dataSource.setDriverClass(org.postgresql.Driver.class); dataSource.setUrl("jdbc:postgresql://localhost:5432/mybatis_plus"); dataSource.setUsername("postgres"); dataSource.setPassword("123123"); return dataSource; }
@Bean("dataSource") public DataSource dataSource() { SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); dataSource.setDriverClass(com.mysql.jdbc.Driver.class); dataSource.setUrl("jdbc:mysql://localhost:3306/mybatis_plus?useSSL=false&useUnicode=true&characterEncoding=UTF-8"); dataSource.setUsername("root"); dataSource.setPassword("123456"); return dataSource; }
@Bean public DataSource dataSource(){ SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); dataSource.setDriver(new Driver()); dataSource.setUrl("jdbc:h2:mem:test;MODE=mysql;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE"); dataSource.setUsername("sa"); dataSource.setPassword(""); return dataSource; }
SimpleDriverDataSource simpleDriverDataSource = new SimpleDriverDataSource(); simpleDriverDataSource.setDriverClass(org.h2.Driver.class); simpleDriverDataSource.setUrl("jdbc:h2:target/database/example;AUTO_RECONNECT=TRUE"); simpleDriverDataSource.setUsername(""); simpleDriverDataSource.setPassword("");
@Override public void setUrl(String url) { dataSource.setUrl(url); }
public void setUrl(String url) { dataSource.setUrl(url); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url) { setDriver(driver); setUrl(url); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url) { setDriver(driver); setUrl(url); }
@Bean public DataSource someDataSource() throws SQLException { final SimpleDriverDataSource dataSource = new SimpleDriverDataSource(); dataSource.setUrl(System.getProperty("db.url")); dataSource.setUsername(System.getProperty("db.user")); dataSource.setPassword(System.getProperty("db.password")); // Driver, connection properties, if any, and other stuff return dataSource; }
@Bean public DataSource dataSource() { SimpleDriverDataSource ds = new SimpleDriverDataSource(); try { @SuppressWarnings("unchecked") Class<? extends Driver> driverClass = (Class<? extends Driver>) Class.forName(environment.getProperty("jdbc.driver", "org.h2.Driver")); ds.setDriverClass(driverClass); } catch (Exception e) { log.error("Error loading driver class", e); } // Connection settings ds.setUrl(environment.getProperty("jdbc.url", "jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000")); ds.setUsername(environment.getProperty("jdbc.user", "sa")); ds.setPassword(environment.getProperty("jdbc.password", "")); return ds; }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param conProps the JDBC connection properties * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, Properties conProps) { setDriver(driver); setUrl(url); setConnectionProperties(conProps); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param conProps JDBC connection properties * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, Properties conProps) { setDriver(driver); setUrl(url); setConnectionProperties(conProps); }
@Configuration public class SomeConfigClass { @Autowired private Environment env; public DataSource dataSource() { SimpleDriverDataSource ds = new SimpleDriverDataSource(); ds.setUsername(env.getProperty("jdbc.username")); ds.setPassword(env.getProperty("jdbc.password")); ds.setDriverClass(Driver.class); ds.setUrl(env.getProperty("jdbc.url")); return ds; } }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param username the JDBC username to use for accessing the DriverManager * @param password the JDBC password to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, String username, String password) { setDriver(driver); setUrl(url); setUsername(username); setPassword(password); }
/** * Create a new DriverManagerDataSource with the given standard Driver parameters. * @param driver the JDBC Driver object * @param url the JDBC URL to use for accessing the DriverManager * @param username the JDBC username to use for accessing the DriverManager * @param password the JDBC password to use for accessing the DriverManager * @see java.sql.Driver#connect(String, java.util.Properties) */ public SimpleDriverDataSource(Driver driver, String url, String username, String password) { setDriver(driver); setUrl(url); setUsername(username); setPassword(password); }