用jsp+jdbc+sql server来实现登陆2

http://ask.csdn.net/questions/247737还是这个问题 没有解决

//定义jdbc的连接驱动
String url="jdbc:sqlserver://192.28.1.177,11008;DatabaseName=LD";
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();
Connection conn = DriverManager.getConnection(url, dbname, dbpass);

    是什么情况啊?  我sqljdbc也删干净了

2个回答

在线网上书店(JSP+JDBC+SQL Server2000)
elipse+tomcat插件+jsp通过jdbc链接sql server
Java/JSP中使用JDBC连接SQL Server 2005~
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

数据库配置的问题,或者连接字符串有问题

配置有问题 啊 , 是不是哪里填写错了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
用jsp+jdbc+sql server来实现登陆2
http://ask.csdn.net/questions/247737还是这个问题 没有解决 //定义jdbc的连接驱动 String url="jdbc:sqlserver://192.28.1.177,11008;DatabaseName=LD"; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); Connection conn = DriverManager.getConnection(url, dbname, dbpass); 是什么情况啊? 我sqljdbc也删干净了
用jsp+jdbc+sql server来实现登陆
![图片说明](https://img-ask.csdn.net/upload/201604/06/1459929609_292693.png) 出现如上图的错误。求大神指点 本人小白 代码参照http://blog.csdn.net/jesse526/article/details/4377707、 用的是sql server2005
jsp使用jdbc技术连接SQL Server2014时出现了一个问题,怎么解决?无法连接数据库
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
jsp中使用JDBC连接SQL Server数据库出现异常
![图片说明](https://img-ask.csdn.net/upload/201610/16/1476596966_480922.png) 数据库连接正常,包也导入了,然后我就不知道问题住在哪里了?
JSP菜鸟问连接SQL SERVER 2008的问题
JSP代码 <%@ page contentType="text/html;charset=utf-8"%> <%@ page import="java.sql.*"%> <html> <body> <% Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); String url="jdbc:sqlserver://localhost:1433;DatabaseName=DbTest"; String username="sa"; String password="123456"; Connection conn= DriverManager.getConnection(url,username,password); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql="select * from Test"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) {%> 您的第一个字段内容为:<%=rs.getString(1)%> 您的第二个字段内容为:<%=rs.getString(2)%> <%}%> <%out.println("数据库操作成功,恭喜你");%> <%rs.close(); stmt.close(); conn.close(); %> </body> </html> 出现问题如下: HTTP Status 500 - type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /WebRoot/test.jsp at line 6 3: <html> 4: <body> 5: <% 6: Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance(); 7: String url="jdbc:sqlserver://localhost:1433;DatabaseName=DbTest"; 8: 9: String username="sa"; Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause javax.servlet.ServletException: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840) org.apache.jsp.WebRoot.test_jsp._jspService(test_jsp.java:110) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) root cause java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:126) org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63) java.lang.Class.forName0(Native Method) java.lang.Class.forName(Unknown Source) org.apache.jsp.WebRoot.test_jsp._jspService(test_jsp.java:68) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs. Apache Tomcat/7.0.27 求解,各位高手,请赐教!郁闷到想自杀,搞了好久就是不通。
jsp jdbc方式连接SQL sever 操作数据库时没有返回的数据
<%@page language="java" import="java.util.*" import="java.sql.*" pageEncoding="UTF-8" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>连接SQL Server数据库</title> </head> <body> <% Connection conn = null; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Hsjy1"; String user = "sa"; String password = "12345678"; conn = DriverManager.getConnection(url,user,password); Statement st = conn.createStatement(); out.println("取得连接"); out.println("测试1"); out.println(conn.toString()); ResultSet rs = st.executeQuery("SELECT * FROM Hsjy1.dbo.dibu"); out.println("测试2"); while(rs.next()){ out.println("测试3"); out.println(rs.getString("Tel")+rs.getString("Fax")+rs.getString("beian")); } out.println("测试4"); rs.close(); conn.close(); out.println("测试5"); %> </body> </html>
jsp+jdbc登录模块问题
登录页面: <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSP 'login.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <h1>用户登录</h1> <hr> <form action="dologin.jsp" method="post"> <table> <tr> <td>用户名</td> <td><input type="text" name="username" /></td> <td>密码</td> <td><input type="password" name="password" /></td> </tr> <tr> <td colspan="2"><input type="submit" value="登陆"></td> <td> <input type="button" value="注册" onclick="window.location.href='register.jsp';"/> </td> </table> </form> </body> </html> 检查页面: <%@ page language="java" import="java.util.*" page contentType="text/html; charset=GB2312"%> <%@page import="java.sql.*" %> <%@page import="java.io.*" %> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JSP_JDBC_DEMO</title> </head> <body> <% Connection conn=null; Statement stmt=null; ResultSet res=null; boolean flag=false;//通过数据库匹配标识 String name_checked=null;//检查通过的用户名 %> <% try{ Class.forName("com.mysql.jdbc.Driver"); //加载驱动器 DriverManager.registerDriver(new com.mysql.jdbc.Driver()); //注册mysql驱动器 String dbURL="jdbc:mysql://localhost:3306/test"; String dbUser="root"; String dbPwd="5438027"; conn=java.sql.DriverManager.getConnection(dbURL,dbUser,dbPwd); //建立数据库连接 stmt=conn.createStatement(); String u=request.getParameter("username"); //从上级页面获得用户名 String p=request.getParameter("userpassword"); //从上级页面获得密码 String sql="SELECT name FROM pass WHERE ACCOUNT=u AND PASSWORD=p";//组装sql语句 System.out.println(sql);//执行上述sql语句 res=stmt.executeQuery(sql); if(true==res.next())//只有查询得到结果才可进入循环 { flag=true; name_checked=res.getString(1);//获得查询出的用户 %> <h3>Debug_数据库查询结果<%=name_checked %></h3> <% } }catch(Exception e){ System.out.println(e); }finally{ //关闭连接 try{ /* res.close();//依次关闭 stmt.close(); conn.close(); */ /* res.close(); stmt.close(); conn.close(); */ }catch(Exception e) { } } %> <!-- 根据状态跳转 --> <% if(true==flag)//登陆成功 { %> <jsp:forward page="loginsucess.jsp"> <% } else//登陆失败 { %> <jsp:forward page="loginfail.jsp"> <% } %> </body> </html> 数据库里定义的是ACCOUNT 和PASSWORD 每次运行都会出现如下结果 HTTP Status 500 - /dologin.jsp (line: 1, column: 53) equal symbol expected type Exception report message /dologin.jsp (line: 1, column: 53) equal symbol expected description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: /dologin.jsp (line: 1, column: 53) equal symbol expected org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89) org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:217) org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:162) org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:183) org.apache.jasper.compiler.ParserController.getPageEncodingForJspSyntax(ParserController.java:479) org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:420) org.apache.jasper.compiler.ParserController.doParse(ParserController.java:190) org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:119) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:193) org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722
Jsp+JavaBean+MySql实现登陆及增删改查出错。The value for the useBean class attribute bean.Sql
Jsp+JavaBean+MySql实现登陆及增删改查出错。The value for the useBean class attribute bean.SqlConn is invalid. 运行环境:Tomcat6.0+jdk1.6+MyEclipse6.0 报错信息: type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: /ADMS/WebRoot/add.jsp(2,0) The value for the useBean class attribute bean.SqlConn is invalid. org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1200) org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1155) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2386) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2392) org.apache.jasper.compiler.Node$Root.accept(Node.java:489) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2336) org.apache.jasper.compiler.Generator.generate(Generator.java:3394) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:210) org.apache.jasper.compiler.Compiler.compile(Compiler.java:306) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:273) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.10 logs. 我的代码 1.SqlConn.java package bean; import java.sql.*; public class SqlConn { private String url = "jdbc:mysql://localhost:3036/adms"; private String user = "root"; private String password = "root"; private Connection conn = null; private Statement stmt = null; private ResultSet rs = null; public SqlConn(){ try{ Class.forName("com.mysql.jdbc.Driver"); } catch(java.lang.ClassNotFoundException e){ System.err.println("SqlConn():"+e.getMessage()); } } public ResultSet executeQuery(String sql){ try{ conn = DriverManager.getConnection(url,user,password); stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(sql); }catch(SQLException ex){ System.err.println("SqlConn.executeQuery:"+ex.getMessage()); } return rs; } public void executeUpdate(String sql){ try{ conn = DriverManager.getConnection(url,user,password); stmt = conn.createStatement(); stmt.executeUpdate(sql); stmt.close(); conn.close(); }catch(SQLException ex){ System.err.println("SqlConn.executeUpdate:"+ex.getMessage()); } } public void closeStmt(){ try{ stmt.close(); }catch(SQLException e){ e.printStackTrace(); } } public void closeConn(){ try{ conn.close(); }catch(SQLException e){ e.printStackTrace(); } } public static void main(String[] args) { // TODO Auto-generated method stub } } 2.login.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%--使用SqlConn.class--%> <jsp:useBean id="sqlbean" scope="page" class="bean.SqlConn"/> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'login.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <form name="form1" action="loginto.jsp" method="post"> <table width="225" border="1" align="center"> <tbody> <tr> <td>用户名</td> <td><input type="text" name="username"> </td> </tr> <tr> <td>密码 </td> <td><input type="password" name="password"></td> </tr> <tr> <td colspan="2" align="center"> <input type="radio" checked="checked" value="1" name="role">用户 &nbsp;&nbsp;&nbsp; <input type="radio" value="0" name="role">管理员 </td> </tr> <tr> <td>&nbsp;</td> <td><input type="submit" value="登陆" name="login"> &nbsp;&nbsp; <input type="reset" value="重置" name="reset"> </td> </tr> </tbody> </table> </form> </body> </html> 3.loginto.jsp <%@ page language="java" import="java.sql.*" pageEncoding="UTF-8"%> <jsp:useBean id="sqlbean" scope="page" class="bean.SqlConn"/> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>My JSP 'loginto.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <% String username = request.getParameter("username").trim(); String password = request.getParameter("password").trim(); String role = request.getParameter("role").trim(); try{ if(role.equals("0")) { String sql = "select * from admin where admin_id='"+username+"'and admin_psw='"+password+"'"; ResultSet rs = sqlbean.executeQuery(sql); if(rs.next()) response.sendRedirect("adms.jsp"); else out.println("错误的用户名或密码!"); } else if(role.equals("1")) { String sql = "select * from user where user_id='"+username+"'and user_psw='"+password+"'"; ResultSet rs = sqlbean.executeQuery(sql); if(rs.next()) out.println("您好,"+username); else out.println("错误的用户名或密码!"); } }catch(Exception ee){ ee.printStackTrace(); } %> </body> </html> 还有添加,删除,修改,查找等jsp页面。 我用JSP页面直接连接就能运行,没有错。只要是有JavaBean,就会报错。希望大家多多指教。 这个问题出现好久了,不仅这一个项目有这样的问题,所有的导入和新建的web project 只要有JavaBean都会有这样的错误。 搞不清是什么原因。数据库是SQLServer2000的时候也是这样的错误。
sql-server问题
在用jsp和sql-server实现用户登录验证的时候,验证的代码为 <% String username=request.getParameter("username"); String password=request.getParameter("password"); try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); Connection conn= DriverManager.getConnection("jdbc.microsoft:sqlserver://localhost:1433;DatabaseName=luntan","sa","123"); Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); String sql="select * from t_users where username='"+username+"'and password='"+password+"'"; ResultSet rs=stmt.executeQuery(sql); if(rs.next()) { response.sendRedirect("success.jsp"); } else { out.println("your password or userid is false"); response.sendRedirect("login.jsp"); } conn.close(); }catch(Exception e) { out.print(e); }; %> 登录的时候报这样的错误,数据库连接包三个全部放在tomcat的lib目录下面了,报错如下 java.sql.SQLException: No suitable driver found for jdbc.microsoft:sqlserver://localhost:1433;DatabaseName=luntan 是什么原因 [b]问题补充:[/b] 谢谢你的关注,不过我的问题已经写得很清楚了吧,三个jar包都已经放好了,问题已经解决了,是把 com.microsoft:sqlserver://localhost:1433;DatabaseName=luntan 换成jdbc:sqlserver//localhost。。。。 不过依然感谢你的提醒。。。。
通过写个类测试连接sqlserver2008数据库成功,在写jsp练习中失败
最简单的连接数据库,在写练习jsp登陆页面时,输入正确的用户名密码,跳转到失败页面。整个项目有一个警告是 Description Resource Path Location Type Classpath entry E:/ware/sqldrivers_for_vc/Microsoft SQL Server JDBC Driver 2.0/sqljdbc_2.0/chs/sqljdbc4.jar will not be exported or published. Runtime ClassNotFoundExceptions may result. AboutSql P/AboutSql Classpath Dependency Validator Message 控制台提示:java.lang.ClassNotFoundException: com.micsoft.sqlserver.jdbc.SQLServerDriver 我之前在一个类里测试了能连接数据库加载驱动。还没入门的菜鸟求教,真心累
[Microsoft][ODBC SQL Server Driver][SQL Server]?ַ? '??)' ?????Ų?????
2014-2-22 15:01:44 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/pro6] threw exception [An exception occurred processing JSP page /insert1.jsp at line 15 12: Connection conn=DriverManager.getConnection("jdbc:odbc:JSPDATA","sa","123"); 13: Statement stat=conn.createStatement(); 14: String sql="INSERT INTO T_STUDENT(STUNO,STUNAME,STUSEX) VALUES('0032','刘明','男')"; 15: out.println(stat.executeUpdate(sql)); 16: stat.close(); 17: conn.close(); 18: %> Stacktrace:] with root cause java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]?ַ? '??)' ?????Ų????? at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6957) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:288) at org.apache.jsp.insert1_jsp._jspService(insert1_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 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:722) 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:224) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619)
sqlserver2012无法通过jdbc连接MyElicpse 求个大神
使用sqljdbc.jar连接jdbc时: 通过端口 1433 连接到主机 127.0.0.1 的 TCP/IP 连接失败。错误:“Connection refused: connect。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。 代码如下: String driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";//驱动器 String url = "jdbc:sqlserver://127.0.0.1:1433;DatabaseName=xxxx"; String user = "sa";//用户名 String password = "sa";//密码 try { Class.forName(driver); // 加载数据库驱动 // 构建连接 Connection conn = DriverManager.getConnection(url, user, password); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); 防火墙已经关闭 没有阻止接口 telnet localhost 1433是通的 但是127.0.0.1 1433就提示连接端口:1433 失败 ping 127.0.0.1是没问题的 C盘etc/hosts中的对应localhost与127.0.0.1的内容为: # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost Sqlserver配置器已经打开 IIPALL的固定端口是1433 一直保持侦听状态 只有一个实例MSSQLSERVER windows事件日志上的错误是:服务器无法在 'any' <ipv4> 1434 上侦听。错误: 0x277a。若要继续,请通知您的系统管理员。 查看sqlserver 2012日志错误如下: Server failed to listen on 'any' <ipv4> 1434. Error: 0x277a. To proceed, notify your system administrator 错误: 26024,严重性: 16,状态: 1。 电脑已经重装成win7了 还是这个问题 sql可以和visual studio 2012连接 但是无法和MyElicpse连接 在cmd中执行netstat -ano 只有TCP [::]:1433接口在监听 找不到0.0.0.0:1433和127.0.0.1:1433这两个接口 1434只有UDP [::]:1434和0.0.0.0:1434 执行tasklist|findstr 2448(1433端口PID) 显示进程为sqlservr.exe 1433没有被占用 使用的jar包是sqljdbc4.jar ![图片说明](https://img-ask.csdn.net/upload/201610/01/1475290507_428583.png) ![图片说明](https://img-ask.csdn.net/upload/201610/01/1475290521_744595.png) ![图片说明](https://img-ask.csdn.net/upload/201610/01/1475290568_511606.png) ![图片说明](https://img-ask.csdn.net/upload/201610/01/1475290580_258520.png) ![图片说明](https://img-ask.csdn.net/upload/201610/01/1475290588_54854.png) 在之前使用win8的时候 有段时间是可以连接的 当时没有加入tomcat 大约有2到3个月没有使用这个jdbc 再拿出来学习jsp的时候 就一直提示这个错误 因为我要使用tomcat做jsp 要连接jdbc 所以这个问题很急 求大神解决一下啊 重装了好几次系统了 要崩溃了
eclipse Java链接SQL server 驱动加载成功但数据库无法连接
![图片说明](https://img-ask.csdn.net/upload/201901/09/1547039291_230290.png) import java.sql.*; public class Main { public static void main(String [] args) { String driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"; String dbURL="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=jsp"; String userName="sa"; String userPwd="1234"; try { Class.forName(driverName); System.out.println("加载驱动成功!"); }catch(Exception e){ e.printStackTrace(); System.out.println("加载驱动失败!"); } try{ Connection dbConn=DriverManager.getConnection(dbURL,userName,userPwd); System.out.println("连接数据库成功!"); }catch(Exception e) { e.printStackTrace(); System.out.print("SQL Server连接失败!"); } } } ``` 网上给出的检测代码 ```
sql server 的 for xml path查询出错
java web项目中 有代码如下 ``` String sql = "select a.dStareDate from JXZX_EAT_RECORD a where a.iState=1 and a.cCardNickNo='AA0005' for xml path('a')"; List ll = entityManager.createNativeQuery(sql).getResultList(); ``` 结果报出如下错误,在sql server 数据库中可以成功用这段sql查询。 Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not prepare statement at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763) at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677) at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:458) at sun.reflect.GeneratedMethodAccessor216.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:375) at com.sun.proxy.$Proxy163.getResultList(Unknown Source) at eiis.app.jxzx.servlet.JXZXCardManageService.getMainInfo(JXZXCardManageService.java:120) at eiis.app.jxzx.servlet.JXZXCardManageService$$FastClassBySpringCGLIB$$ec286876.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:667) at eiis.app.jxzx.servlet.JXZXCardManageService$$EnhancerBySpringCGLIB$$2f59bc87.getMainInfo(<generated>) at org.apache.jsp.app.jxzx.cardmanage.action_jsp$Action.getMain(action_jsp.java:306) at sun.reflect.GeneratedMethodAccessor258.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at eiis.util.Reflections.invokeMethod(Reflections.java:102) ... 104 more Caused by: org.hibernate.exception.GenericJDBCException: could not prepare statement at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:196) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:160) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1885) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1862) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1839) at org.hibernate.loader.Loader.doQuery(Loader.java:910) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355) at org.hibernate.loader.Loader.doList(Loader.java:2554) at org.hibernate.loader.Loader.doList(Loader.java:2540) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370) at org.hibernate.loader.Loader.list(Loader.java:2365) at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:353) at org.hibernate.internal.SessionImpl.listCustomQuery(SessionImpl.java:1909) at org.hibernate.internal.AbstractSessionImpl.list(AbstractSessionImpl.java:311) at org.hibernate.internal.SQLQueryImpl.list(SQLQueryImpl.java:141) at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573) at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449) ... 119 more Caused by: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :' xml path('a')',expect IDENTIFIER, actual IDENTIFIER path : select a.dStareDate from JXZX_EAT_RECORD a where a.iState=1 and a.cCardNickNo='AA0005' for xml path('a') at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:726) at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:254) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448) at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:928) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448) at com.alibaba.druid.filter.FilterAdapter.connection_prepareStatement(FilterAdapter.java:928) at com.alibaba.druid.filter.FilterEventAdapter.connection_prepareStatement(FilterEventAdapter.java:122) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:448) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:331) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:162) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:186) ... 135 more Caused by: com.alibaba.druid.sql.parser.ParserException: syntax error, error in :' xml path('a')',expect IDENTIFIER, actual IDENTIFIER path at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:232) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:407) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:145) at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:620) at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:574) at com.alibaba.druid.wall.WallFilter.check(WallFilter.java:713) ... 147 more
jsp连接mysql时运行sql语句失败
四月 01, 2016 12:51:30 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/Test] threw exception [An exception occurred processing JSP page /register.jsp at line 49 46: 47: Connection conn = DriverManager.getConnection(url); 48: Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); 49: ResultSet rs = stmt.executeQuery(sql); 50: 51: out.print("房间号"); 52: out.print("|"); Stacktrace:] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '???' at line 1 at sun.reflect.GeneratedConstructorAccessor13.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.Util.getInstance(Util.java:387) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2547) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2505) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1370) at org.apache.jsp.register_jsp._jspService(register_jsp.java:132) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
JSP里连接数据库实现数据插入出错 求帮助。
[color=red]首先有两个页面insert.jsp和insert-success.jsp, 在insert.jsp里面连接数据库dbs,把表stu中的数据输出,然后添加一条记录,添加之后,跳转到insert_success.jsp 输出添加之后的stu里的所有记录。[/color] [u][color=green]表结构如下:[/color][/u] [img]http://dl.iteye.com/upload/attachment/298878/abc47b80-1a07-3f4a-8f57-678f0f13059d.jpg[/img] [u][color=green]insert.jsp源码[/color][/u][code="java"]<%@ page language="java" import="java.util.*" pageEncoding="GBK"%> <%@ page import="java.sql.*"%> <html> <head> <title>Insert Record Test...</title> </head> <body> <p> <font color=green>data inserting test........</font> </p> <hr color="brown"> <form action="insert_success.jsp" method="post"> <table > <tr><td>input StuID</td> <td><input type=text name="no"></td></tr> <tr><td>input StuName</td> <td><input type=text name="name"></td></tr> <tr><td>input ChineseScore</td> <td><input type=text name="chiscore"></td></tr> <tr><td>input MathScore</td> <td><input type=text name="mathscore"></td></tr> <tr><td>input EngScore</td> <td><input type=text name="engscore"></td></tr> </table> <br> <input type="submit" value="click to add record"/> </form> <hr color="brown"> <br> <p> <font color=green>添加之前的数据记录:</font></p> <% try{ Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e){} String ConStr = "jdbc:oracle:thin:@" ; String ServerName = "localhost"; String url =ConStr+ServerName+":1521:dbs"; String SqlQuery = "SELECT * FROM stu"; Connection con = DriverManager.getConnection(url,"soo","qq"); Statement sql=con.createStatement(); ResultSet rs = sql.executeQuery(SqlQuery); out.print("<table >"); out.print("<TH>学号"); out.print("<TH>姓名"); out.print("<TH>语文"); out.print("<TH>数学"); out.print("<TH>英语"); while (rs.next()) { out.print("<tr>"); out.print("<td>"+rs.getInt("no")+"</td>"); out.print("<td>"+rs.getString("name")+"</td>"); out.print("<td>"+rs.getInt("chinese")+"</td>"); out.print("<td>"+rs.getInt("math")+"</td>"); out.print("<td>"+rs.getInt("english")+"</td>"); out.print("</tr>"); } out.print("</table>"); rs.close(); sql.close(); con.close(); %> </body> </html>[/code] [u][color=green]insert_success.jsp源码[/color][/u][code="java"]<%@ page language="java" import="java.util.*" pageEncoding="gbk"%> <%@ page import="java.sql.*" %> <html> <head> <title>New Records!</title> </head> <body> <br> <% try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (ClassNotFoundException e){} String name = request.getParameter("name"); String no=request.getParameter("no"); String chiscore = request.getParameter("chiscore"); String mathscore = request.getParameter("mathscore"); String engscore = request.getParameter("engscore"); out.print("<table border>"); out.print("<TH>StuID"); out.print("<TH>StuName"); out.print("<TH>ChineseScore"); out.print("<TH>MathScore"); out.print("<TH>EnglishScore"); String ConStr = "jdbc:oracle:thin:@"; String ServerName = "localhost"; String url = ConStr+ServerName+":1521:dbs"; Connection con = DriverManager.getConnection(url,"soo","qq"); Statement sql = con.createStatement(); String SQLQuery = "INSERT INTO stu VALUES("+no+",'"+name+"',"+chiscore+","+mathscore+","+engscore+")"; out.print(SQLQuery); ResultSet rs = sql.executeQuery(SQLQuery); while(rs.next()){ out.print("<tr>"); out.print("<td>"+rs.getInt("no")+"</td>"); out.print("<td>"+rs.getString("name")+"</td>"); out.print("<td>"+rs.getInt("chinese")+"</td>"); out.print("<td>"+rs.getInt("math")+"</td>"); out.print("<td>"+rs.getInt("english")+"</td>"); out.print("</tr>"); } out.print("</table>"); rs.close(); con.close(); sql.close(); %> </body> </html>[/code] insert.jsp [img]http://dl.iteye.com/upload/attachment/298880/f80fcc0b-2eb4-3049-b682-4b02a73cf0f3.jpg[/img] [u][color=green]点击 click to add record之后出现如下错误:[/color][/u] [code="java"]HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: An exception occurred processing JSP page /insert_success.jsp at line 38 35: ResultSet rs = sql.executeQuery(SQLQuery); 36: while(rs.next()){ 37: out.print("<tr>"); 38: out.print("<td>"+rs.getInt("no")+"</td>"); 39: out.print("<td>"+rs.getString("name")+"</td>"); 40: out.print("<td>"+rs.getInt("chinese")+"</td>"); 41: out.print("<td>"+rs.getInt("math")+"</td>"); Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:401) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause javax.servlet.ServletException: java.sql.SQLException: ORA-00900: 无效 SQL 语句 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.insert_005fsuccess_jsp._jspService(insert_005fsuccess_jsp.java:113) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) root cause java.sql.SQLException: ORA-00900: 无效 SQL 语句 oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283) oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278) oracle.jdbc.driver.T4C8Odscrarr.receive(T4C8Odscrarr.java:214) oracle.jdbc.driver.T4CStatement.doDescribe(T4CStatement.java:723) oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3276) oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:1914) oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:1563) org.apache.jsp.insert_005fsuccess_jsp._jspService(insert_005fsuccess_jsp.java:92) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.29 logs. -------------------------------------------------------------------------------- Apache Tomcat/6.0.29[/code] 实在不知道哪里错了。。希望路过的大家帮忙看下。
驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。
兄弟们帮帮忙吧 com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“java.lang.RuntimeException: Could not generate DH keypair”。 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1368) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1412) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1058) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.sun.news.util.DBManager.getConnection(DBManager.java:18) at com.sun.news.dao.impl.UsersDaoImpl.queryUserByUsernameAndUserpwd(UsersDaoImpl.java:108) at org.apache.jsp.admin.index_005faction_jsp._jspService(index_005faction_jsp.java:99) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2522) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2511) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:619) Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException: Could not generate DH keypair at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1611) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1574) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1557) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1146) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1123) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1379) ... 33 more Caused by: java.lang.RuntimeException: Could not generate DH keypair at com.sun.net.ssl.internal.ssl.DHCrypt.<init>(DHCrypt.java:106) at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverKeyExchange(ClientHandshaker.java:446) at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:171) at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:516) at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:454) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:884) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1112) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1139) ... 35 more Caused by: java.security.InvalidAlgorithmParameterException: Prime size must be multiple of 64, and can only range from 512 to 1024 (inclusive) at com.sun.crypto.provider.DHKeyPairGenerator.initialize(DashoA13*..) at java.security.KeyPairGenerator$Delegate.initialize(KeyPairGenerator.java:627) at com.sun.net.ssl.internal.ssl.DHCrypt.<init>(DHCrypt.java:100) ... 42 more java.lang.NullPointerException at com.sun.news.dao.impl.UsersDaoImpl.queryUserByUsernameAndUserpwd(UsersDaoImpl.java:110) at org.apache.jsp.admin.index_005faction_jsp._jspService(index_005faction_jsp.java:99) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2522) at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2511) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:619)
新手,做一个动态网页,一些问题请大佬回答
用eclipse通过jdbc连接SQL server已成功 但是如何在jsp中查询修改删除数据库表的内容 例如,数据库item表格,列名product,number。将这两列的内容进行增删改查,主要查询显示怎么做,搜了好多但是就是找不到怎么做,太笨了,请给详细代码演示.谢谢啦,新年快乐!
javaweb小项目,写添加功能时出错了检查了几遍sql没找到错误,但从报错信息来看是sql写错了?
在写emp这张表的添加功能时遇到错误了,但是找不到解决的办法。。。。 sql语句检查好几遍了,也找不到是哪里错了。 下面是图和错误信息。 ![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894627_921952.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894635_586062.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894640_845708.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894648_593949.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894656_691023.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894666_634817.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894683_320059.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894687_712206.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894695_287559.png)![图片说明](https://img-ask.csdn.net/upload/201912/09/1575894700_310688.png) 错误信息:在表单页面点击立即提交就报错 ``` [2019-12-09 08:10:13,721] Artifact 人事工资管理系统(psms):war exploded: Artifact is being deployed, please wait... 09-Dec-2019 20:10:14.925 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 [2019-12-09 08:10:15,033] Artifact 人事工资管理系统(psms):war exploded: Artifact is deployed successfully [2019-12-09 08:10:15,033] Artifact 人事工资管理系统(psms):war exploded: Deploy took 1,312 milliseconds DEBUG [http-nio-555-exec-5] - Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - PooledDataSource forcefully closed/removed all connections. DEBUG [http-nio-555-exec-5] - Opening JDBC Connection DEBUG [http-nio-555-exec-5] - Created connection 1428244206. DEBUG [http-nio-555-exec-5] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - ==> Preparing: select * from emp where username=? and password=? DEBUG [http-nio-555-exec-5] - ==> Parameters: root(String), aias(String) DEBUG [http-nio-555-exec-5] - <== Total: 1 DEBUG [http-nio-555-exec-5] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-5] - Returned connection 1428244206 to pool. 09-Dec-2019 20:10:23.398 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [C:\apache-tomcat-9.0.27-windows-x64\apache-tomcat-9.0.27\webapps\manager] 09-Dec-2019 20:10:23.482 信息 [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [C:\apache-tomcat-9.0.27-windows-x64\apache-tomcat-9.0.27\webapps\manager] has finished in [83] ms DEBUG [http-nio-555-exec-10] - Opening JDBC Connection DEBUG [http-nio-555-exec-10] - Checked out connection 1428244206 from pool. DEBUG [http-nio-555-exec-10] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - ==> Preparing: select max(id) from emp DEBUG [http-nio-555-exec-10] - ==> Parameters: DEBUG [http-nio-555-exec-10] - <== Total: 1 DEBUG [http-nio-555-exec-10] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Returned connection 1428244206 to pool. DEBUG [http-nio-555-exec-10] - Opening JDBC Connection DEBUG [http-nio-555-exec-10] - Checked out connection 1428244206 from pool. DEBUG [http-nio-555-exec-10] - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - ==> Preparing: insert into emp(id,empno,username,password,ename,sex,birthday,email,call,pname,deptno,state,permissions) values (?,?,?,?,?,?,?,?,?,?,?,?,?) DEBUG [http-nio-555-exec-10] - ==> Parameters: 28(Integer), 028(String), test(String), test(String), 测试(String), 男(String), 2019-12-09(String), 777777777@qq.com(String), 11111111111(String), 接待员(String), 001(String), 在职(String), 普通员工(String) java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) DEBUG [http-nio-555-exec-10] - Rolling back JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] at java.lang.reflect.Method.invoke(Method.java:498) DEBUG [http-nio-555-exec-10] - Resetting autocommit to true on JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] DEBUG [http-nio-555-exec-10] - Closing JDBC Connection [com.mysql.jdbc.JDBC4Connection@552146ee] at com.cdx.psms.utils.TransactionInvocationHandler.invoke(TransactionInvocationHandler.java:30) DEBUG [http-nio-555-exec-10] - Returned connection 1428244206 to pool. at com.sun.proxy.$Proxy5.add(Unknown Source) at com.cdx.psms.controller.Emp_InsertAddServlet.doPost(Emp_InsertAddServlet.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) 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:53) 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:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1579) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 ### The error may exist in com/cdx/psms/mapper/EmpMapper.xml ### The error may involve emp.add-Inline ### The error occurred while setting parameters ### SQL: insert into emp(id,empno,username,password,ename,sex,birthday,email,call,pname,deptno,state,permissions) values (?,?,?,?,?,?,?,?,?,?,?,?,?) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) at com.cdx.psms.dao.EmpDaoImpl.add(EmpDaoImpl.java:42) at com.cdx.psms.service.EmpServiceImpl.add(EmpServiceImpl.java:26) ... 31 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'call,pname,deptno,state,permissions) values (28,'028','test','te' at line 2 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1251) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59) at com.sun.proxy.$Proxy7.execute(Unknown Source) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ... 34 more ```
JSP对数据库进行信息添加及关键字查询出现错误,怎么解决
org.apache.jasper.JasperException: An exception occurred processing JSP page /emp_list.jsp at line 18 15: if(keyWord==null){ 16: keyWord=""; 17: } 18: List<Emp> all=DAOFactory.getIEmpDAOInstance().findAll(keyWord); 19: Iterator<Emp> iter=all.iterator(); 20: %> 21: <center> Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:916) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:845) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:141) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1118) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause java.net.UnknownHostException: locahost java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:866) java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1258) java.net.InetAddress.getAllByName0(InetAddress.java:1211) java.net.InetAddress.getAllByName(InetAddress.java:1127) java.net.InetAddress.getAllByName(InetAddress.java:1063) com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:246) com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:292) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122) com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774) com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49) sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:525) com.mysql.jdbc.Util.handleNewInstance(Util.java:409) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289) java.sql.DriverManager.getConnection(DriverManager.java:579) java.sql.DriverManager.getConnection(DriverManager.java:221) com.wgh.dbc.DatabaseConnection.<init>(DatabaseConnection.java:13) com.wgh.dao.proxy.EmpDAOProxy.<init>(EmpDAOProxy.java:13) com.wgh.factory.DAOFactory.getIEmpDAOInstance(DAOFactory.java:7) org.apache.jsp.emp_005flist_jsp._jspService(emp_005flist_jsp.java:82) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) note The full stack trace of the root cause is available in the Apache Tomcat/7.0.57 logs.
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
MyBatis研习录(01)——MyBatis概述与入门
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis原本是apache的一个开源项目iBatis, 2010年该项目由apache software foundation 迁移到了google code并改名为MyBatis 。2013年11月MyBatis又迁移到Github。
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
Python爬虫精简步骤1 获取数据
爬虫,从本质上来说,就是利用程序在网上拿到对我们有价值的数据。 爬虫能做很多事,能做商业分析,也能做生活助手,比如:分析北京近两年二手房成交均价是多少?广州的Python工程师平均薪资是多少?北京哪家餐厅粤菜最好吃?等等。 这是个人利用爬虫所做到的事情,而公司,同样可以利用爬虫来实现巨大的商业价值。比如你所熟悉的搜索引擎——百度和谷歌,它们的核心技术之一也是爬虫,而且是超级爬虫。 从搜索巨头到人工...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
web前端javascript+jquery知识点总结
1.Javascript 语法.用途 javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序...
Python:爬取疫情每日数据
前言 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 以全国、湖北和上海为例,分别为以下三个网站: 国家卫健委官网:http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml 湖北卫健委官网:http://wjw.hubei.gov.cn/bmdt/ztzl/fkxxgzbdgrfyyq/xxfb...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧???? 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升自...
粒子群算法求解物流配送路线问题(python)
1.Matlab实现粒子群算法的程序代码:https://www.cnblogs.com/kexinxin/p/9858664.html matlab代码求解函数最优值:https://blog.csdn.net/zyqblog/article/details/80829043 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/...
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang....
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c# 识别回车 c#生成条形码ean13 c#子控制器调用父控制器 c# 写大文件 c# 浏览pdf c#获取桌面图标的句柄 c# list反射 c# 句柄 进程 c# 倒计时 线程 c# 窗体背景色
立即提问