Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Connection connection = null;
- try {
- Class.forName("org.postgresql.Driver");
- connection = DriverManager.getConnection(
- "jdbc:postgresql://localhost:5432/","postgres", "12345");
- Statement statement = connection.createStatement();
- statement.execute("CREATE DATABASE mydb");
- //now I hav to connect to mydb
- connection.close();
- } catch (ClassNotFoundException ex) {
- Logger.getLogger(OracleToPostgres.class.getName()).log(Level.SEVERE, null, ex);
- }catch (SQLException ex) {
- Logger.getLogger(OracleToPostgres.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
Add Comment
Please, Sign In to add comment