0
嘗試運行符合jdbc6
依賴關係的grails 3應用程序。我試圖在我的groovy服務中導入下面的庫,它應該連接到Oracle數據庫來調用存儲過程。Grails 3無法解析類oracle.sql
import oracle.sql.ARRAY
import oracle.sql.ArrayDescriptor
import oracle.jdbc.OracleCallableStatement
import java.sql.Connection
import groovy.sql.Sql
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.ss.usermodel.WorkbookFactory
import org.apache.poi.ss.usermodel.Sheet
import org.apache.poi.ss.usermodel.Cell
import org.apache.poi.ss.usermodel.Row
import org.apache.poi.ss.usermodel.DataFormatter
import com.wwt.itemuploadapi.rectypes.Rectype
import java.sql.SQLException
class ExcelService {
def dataSource
private static final FILE_HEADERS = [
'First Name': 'firstName',
'Last Name': 'lastName'
]
def callApi(List<Rectype> rectype) {
OracleCallableStatement callableStmt = null
try {
def conn = dataSource.getConnection()
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("TBLTYPE", conn.unwrap(oracle.jdbc.OracleConnection.class))
ARRAY dataElementsArray = new ARRAY(descriptor, conn.unwrap(oracle.jdbc.OracleConnection.class), (Object[])rectype.toArray())
Map map = conn.getTypeMap()
map.put("REC_TYPE", Rectype.class)
callableStmt = (OracleCallableStatement)conn.prepareCall("{call package.procedure_name(?)}")
callableStmt.setArray(1, dataElementsArray);
callableStmt.execute()
}
catch (SQLException ex) {
println(ex)
}
}
啓動時出現以下三個錯誤。但我有我的Gradle: com.oracle:ojdbc6:11.2.0.3
圖書館的這些類。所以我不確定它爲什麼不能識別它們。
`unable to resolve class oracle.sql.ARRAY`
`unable to resolve class oracle.sql.ArrayDescriptor`
`unable to resolve class oracle.jdbc.OracleCallableStatement`
任何建議爲什麼這些類無法找到?