更新时间:2022-06-11 22:01:33
从 newInstance 调用中删除所有不必要的导入和驱动程序类,如下所示:
Remove all unnecessary imports and driver class from newInstance call as follows:
import groovy.sql.Sql
sql = Sql.newInstance("jdbc:oracle:thin:@localhost:1521:databasename", "username", "password")
上面的内容就足够了,对我来说很好用,但是我使用的是ojdbc6-11.2.jar
The above is enough and works just fine for me, however I'm using ojdbc6-11.2.jar
此外,取决于您使用的是 SID 还是服务名称,可能必须将JDBC URL的最后一个分号更改为斜杠.
Beside depends on if you are using SID or service name the last semicolon at JDBC URL might have to be changed for slash.