mbleron / ExcelTable

ExcelTable is an Oracle SQL interface to read Microsoft Excel files (.xlsx, .xlsm, .xlsb, .xls, .xml), ODF spreadsheet files (.ods) and flat files as external tables
MIT License
45 stars 12 forks source link

ORA-29540: class db/office/spreadsheet/ReadContext does not exist #27

Closed mmclaughlin3111 closed 3 years ago

mmclaughlin3111 commented 3 years ago

I am trying to implement this solution for my company. The first test I was trying was with the loadData function

declare

ctx GDRDBA.ExcelTable.DMLContext; nrows integer;

begin dbms_output.put_line( '1'); ctx := GDRDBA.ExcelTable.createDMLContext('T544'); dbms_output.put_line( '2');
GDRDBA.ExcelTable.mapColumnWithDefault(ctx, p_col_name => 'VALID_DATE', p_default => sysdate); GDRDBA.ExcelTable.mapColumn(ctx, p_col_name => 'CURRENCY_CODE', p_col_ref => 'A'); GDRDBA.ExcelTable.mapColumn(ctx, p_col_name => 'CONVERSION_RATE', p_col_ref => 'G'); dbms_output.put_line( '3');
nrows := GDRDBA.ExcelTable.loadData( p_ctx => ctx , p_file => GDRDBA.ExcelTable.getFile('EXCEL_FILE_DIR','FX Rates Feb 2021.xlsx') , p_sheet => 'query (2)' , p_method => GDRDBA.ExcelTable.STREAM_READ , p_dml_type => GDRDBA.ExcelTable.DML_INSERT );

dbms_output.put_line(nrows || ' rows inserted.');

end;

When I run this on my Test database I get the following:

ORA-29540: class db/office/spreadsheet/ReadContext does not exist ORA-06512: at "GDRDBA.EXCELTABLE", line 2026 ORA-06512: at "GDRDBA.EXCELTABLE", line 2754 ORA-06512: at "GDRDBA.EXCELTABLE", line 3157 ORA-06512: at "GDRDBA.EXCELTABLE", line 5019 ORA-06512: at "GDRDBA.EXCELTABLE", line 5043 ORA-06512: at line 14

I checked the install log and see that the ReadContext class was created and I also see this class in the SYS schema.
I had mu Hosting DBA's grant PUBLIC execute on all of these classes as well.

The database I am using is: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production PL/SQL Release 12.1.0.2.0 - Production CORE 12.1.0.2.0 Production TNS for Linux: Version 12.1.0.2.0 - Production NLSRTL Version 12.1.0.2.0 - Production

So I had my Hosting DBA's install exceldbtools-1.6.jar From the README i think this is only jar that needs installed

So I am confused as to why I cannot find the java class when I see it in the database. Any help would be greatly appreciated.

Thanks,

Mike classes on database install log

mmclaughlin3111 commented 3 years ago

This issue was resolved by granting PUBLIC synonyms on each of the java classes

mbleron commented 3 years ago

Hi,

Glad you got this issue sorted. However I would strongly discourage creating anything in the SYS schema directly. It's just asking for trouble IMO. Why not installing the jar in the same schema as the other components (GDRDBA in your example)?