As ensured, that the connection is fine, we can change the single method:
Into this one:
However, we have to specify some additional information as well:
- java package - this is root package where you want DaobabGenerator to create classes.
Example: "com.myapplication.dao"
- psychical path - the place, where files has to be write
Example: "C:\\Projects\\MyApplication\\src\\main\\java\\com\\myapplication\\dao"
As we checked the connection, and the connection is fine, we can change the following method:
Prepare DataSource
private DataSource oracleDatabase(){
HikariConfig config = new HikariConfig();
config.setJdbcUrl( "jdbc:oracle:thin://@IP:PORT/orcl" );
config.setUsername( USER );
config.setPassword( PASS );
config.setDriverClassName("oracle.jdbc.OracleDriver");
config.setSchema(SCHEMA);
return new HikariDataSource( config );
}
Init Class Generator and set schema
ClassGenerator cg=new ClassGenerator(oracleDatabase());
cg.setSchema("myschema");
Set classes location and java package
cg.setJavaPackage("com.company.dao");
cg.setFileDirectoryPath("C:\\project\\src\\main\\java\\com\\company\\dao");
cg.createTables();
Execute generator.