gpt4 book ai didi

javax.servlet.jsp.JspException : Unable to get connection, 数据源无效 : "java. sql.SQLException:找不到合适的驱动程序

转载 作者:太空宇宙 更新时间:2023-11-04 07:12:46 25 4
gpt4 key购买 nike

在 JSP 文件中定义:

    <sql:setDataSource      
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:microsoft.sqlserver://localhost:1433;databaseName=GP"
user="sa"
password="sa123"
var="dSource"/>

<sql:query dataSource="dSource" var="result">
SELECT * FROM GP.FE_ENROLL_DATA
</sql:query>

堆栈跟踪:

javax.servlet.jsp.JspException: Unable to get connection, DataSource 
invalid: "java.sql.SQLException: No suitable driver found for dSource" at

org.apache.taglibs.standard.tag.common.sql
.QueryTagSupport.getConnection( QueryTagSupport.java:276) at

org.apache.taglibs.standard.tag.common
.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159) at
org.apache.taglibs.standard.tag.el.sql.QueryTag.doStartTag(QueryTag.java:85) at
org.apache.jsp.enrollmentRecord_jsp
._jspx_meth_sql_005fquery_005f0(enrollmentRecord_jsp.java:477) at
org.apache.jsp.enrollmentRecord_jsp._jspService(enrollmentRecord_jsp.java:105) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at
java.lang.Thread.run(Unknown Source)

最佳答案

您的连接 URL 是

url="jdbc:microsoft.sqlserver://localhost:1433;databaseName=GP"         

据我所知,您的网址 should be either

url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=GP"         

对于 SQL Server 2000。请注意 : 而不是 .。它也可以具有以下形式

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]] 

for SQL Server 2012 .

关于javax.servlet.jsp.JspException : Unable to get connection, 数据源无效 : "java. sql.SQLException:找不到合适的驱动程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20405273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com