java - How can I switch the database context of an existing DataSource? -
let's have existing datasource master database. need create new database, , execute ddls on database. possible e.g, "use" command, or need create new datasource name of new database in jdbc url?
you can run "use" command regular jdbc statement.
statement stmt = connection.createstatement(); stmt.execute("use the_other_db"); dependending on dbms , driver might able use jdbc api call setcatalog():
connection.setcatalog("the_other_db")
Comments
Post a Comment