我在使用apache开源的DdlUtils ,想测试一下连接数据库的效果,可是不知道怎么做。
我想用这个方法获得连接,可是应该怎么做呢?
public static Platform createNewPlatformInstance(String jdbcDriver, String jdbcConnectionUrl)
我的写法是:
Platform platform = PlatformFactory.createNewPlatformInstance("oracle.jdbc.driver.OracleDriver","jdbc:oracle:thin:@127.0.0.1:1521:orcl;user=aaa;password=111111");
可是得到的platform是Null的。我看API还有这个方法:
public static Platform createNewPlatformInstance(DataSource dataSource)
可以传个DataSource ,可是我只是个单独的带main函数的类,怎么获得DataSource 呢?我看只能lookup,我这种情况怎么lookup呢?感谢各位大侠指教!