1
我试图在使用IBM的DB2Driver的驱动程序中打开SQL实例。无法从Groovy连接到DB2
有趣的是,当我包括:
def DB2Driver = new DB2Driver()
初始化就好了。
但是当我做
Sql.newInstance(info.getHost(), info.getConnectionMetaData().getParameterValue('username'), info.getConnectionMetaData().getParameterValue('password'), info.getConnectionMetaData().getParameterValue('driverClass'))
或者
Sql.newInstance(info.getHost(), info.getConnectionMetaData().getParameterValue('username'), info.getConnectionMetaData().getParameterValue('password'), 'com.ibm.db2.jcc.DB2Driver')
它将无法打开SQL连接,说合适的驱动程序没有找到。我如何获得与DB2打开的连接?
您是否在使用Grape(例如'@Grab()')来处理对DB2 jdbc驱动程序的依赖关系? –
问题与http://stackoverflow.com/questions/32494835/what-is-classpath-for-groovy-console-jdbc-driver-mark –