找不到适合 ucanaccess 的驱动程序

No suitable driver found for ucanaccess

我有一个 .mdb 访问文件,我正在将数据索引到我的 solr 核心。我写了这个 java class 来在 solr 核心中索引它们。当我运行将此 java class 作为 java 应用程序时,它工作正常,但当我 运行 宁服务器端时它不工作。

package org.solr;

import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import java.applet.*;
import java.awt.*;

import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.time.format.DateTimeFormatter;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrRequest.METHOD;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.XMLResponseParser;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION;
import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
import org.apache.solr.client.solrj.request.CoreAdminRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.CoreAdminResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CollectionAdminParams;
import org.apache.solr.common.params.CoreAdminParams.CoreAdminAction;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.ContentStreamBase.ByteArrayStream;
import org.apache.solr.handler.dataimport.DateFormatTransformer;
import org.apache.solr.schema.DateValueFieldType;


public class dbJava {


    public void main(String args[]) throws SolrServerException, IOException {
        Statement state;
        Connection connect;
        try {
            connect = DriverManager.getConnection("jdbc:ucanaccess://C:\Users\FTK1187\Desktop/eArchiveMaster.mdb","FTEC198","");
            state = connect.createStatement();  
            ResultSet rs = state.executeQuery("SELECT * FROM TableArchive ORDER BY ID" );

            //System.out.println(count);
            String urlString="http://localhost:8983/solr/archiveCore";
            HttpSolrClient solr=new HttpSolrClient.Builder(urlString).build();
            ((HttpSolrClient) solr).setParser(new XMLResponseParser());
            //SolrInputDocument document=new SolrInputDocument();
            final String contentStream = "extract this text ...";
            final String contentType = "text/csv;charset=UTF-8";
            final ByteArrayStream byteArrayStream = new ByteArrayStream(contentStream.getBytes(StandardCharsets.UTF_8), null);
            byteArrayStream.setContentType(contentType);
            final ModifiableSolrParams modifiableSolrParams = new ModifiableSolrParams();
            modifiableSolrParams.add(CollectionAdminParams.COLLECTION, "archiveCore");
            ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract"); 
            req.addContentStream(byteArrayStream);
            req.setParams(modifiableSolrParams);
            req.setMethod(METHOD.POST);
            solr.deleteByQuery("*");
            solr.commit();
            long startTime=System.nanoTime();
            while(rs.next()){
                req.setParam("literal.id", String.valueOf(rs.getInt("ID")));
                req.setParam("literal.NameAdded", String.valueOf(rs.getString("NameAdded")));
                req.setParam("literal.DateAdded", String.valueOf(rs.getString("DateAdded")));
                req.setParam("literal.NameModified", String.valueOf(rs.getString("NameModified")));
                req.setParam("literal.DateModified", String.valueOf(rs.getString("DateModified")));
                req.setParam("literal.strSO", String.valueOf(rs.getString("strSO")));
                req.setParam("literal.strCust", String.valueOf(rs.getString("strCust")));
                req.setParam("literal.strOperator", String.valueOf(rs.getString("strOperator")));
                req.setParam("literal.PackName", String.valueOf(rs.getString("PackName")));
                req.setParam("literal.DocName", String.valueOf(rs.getString("DocName")));
                req.setParam("literal.DocType", String.valueOf(rs.getString("DocType")));
                req.setParam("literal.extType", String.valueOf(rs.getString("extType")));
                req.setParam("literal.FileName", String.valueOf(rs.getString("FileName")));
                req.setParam("literal.FilePath", String.valueOf(rs.getString("FilePath")));
                req.setParam("literal.NameDeleted", String.valueOf(rs.getString("NameDeleted")));
                req.setParam("literal.DateDeleted", String.valueOf(rs.getString("DateDeleted")));
                req.setParam("literal.intRev", String.valueOf(rs.getString("intRev")));
                solr.request(req);
            }

            long endTime=System.nanoTime();
            long totalTime=endTime-startTime;
            System.out.println("Done...");
            System.out.println(totalTime);
            String urlReload="http://localhost:8983/solr";
            HttpSolrClient solr_reload=new HttpSolrClient.Builder(urlReload).build();
            CoreAdminRequest adminRequest=new CoreAdminRequest();
            adminRequest.setAction(CoreAdminAction.RELOAD);
            adminRequest.setCoreName("archiveCore");
            adminRequest.process(solr_reload);
        } 
        catch(IOException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}

我想 运行 java class 在 my.jsp 页面中使用 jquery。当我点击更新按钮时,出现了这个错误。

java.sql.SQLException: No suitable driver found for jdbc:ucanaccess://C:\Users\FTK1187\Desktop/eArchiveMaster.mdb
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at org.solr.dbJava.main(dbJava.java:60)
    at org.apache.jsp.upload_jsp._jspService(upload_jsp.java:124)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

有没有错误什么的??如何在我的 .jsp 文件中调用 java class?

您必须在 JRE/lib/ext

中移动驱动程序