2017-05-07 23 views
0

jdbc6依存性を持つgrails 3アプリケーションを実行しようとしています。私はストアドプロシージャを呼び出すためにOracleデータベースに接続するはずのGroovyサービスで以下のライブラリをインポートしようとしています。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) 
    } 
} 

起動時に次の3つのエラーが発生します。しかし私はこれらのクラスを私の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` 

これらのクラスが見つからない理由を教えてください。

答えて

0
oracle.jdbc.OracleCallableStatement 

は、使用しているojdbc依存性バージョンでは、もはや適切なクラスではありません。このインポートクラスに更新する必要があります

:ここ

import java.sql.CallableStatement 
CallableStatement callableStmt = null 

はあなたが使用しようとしている他の非推奨クラス(oracle.sql.ARRAYoracle.sql.ArrayDescriptor)を置き換えるために何をする必要があるかを紹介しますリンクです: https://docs.oracle.com/database/121/JAJDB/deprecated-list.html#class

関連する問題