请问大神在数据库中可以执行的sql语句,为什么通过java类连接数据库执行报错

报错信息:
java.sql.SQLException: Already closed.

11个回答

这个错误提示并不是SQL语句的错误,而是Java的SQL操作类的连接对象已经关闭了,不能执行SQL而报出的异常。

连接已经关了,当然出错了

数据库为open,先open 在进行相应cmd命令执行。

你的连接关闭了,jdbc去连接数据库啊

这个问题还不是你的sql的错误,在执行的时候或得的数据库的连接已经关闭了,无法对数据库进行操作

这个问题在我用php链接数据库时也碰到过类似的问题,可以将java链接数据库的相关超时配置设置的足够大,再重启java服务试试。

连接不上,是执行不了的,必须先测试数据库是否连接

这个错误很明显吗,说明连接对象已经关闭了,也就是说,在你执行某个sql是打开了连接,但是执行完以后把这个连接关闭了,然后执行其他sql的时候你直接用这个已经关闭的连接

这个问题就是你的数据库连接已经关闭了,你又执行了关闭数据库的操作。

连接的问题,报错已经很明显了 可以尝试debug看看当时的状态 又或者是事务的问题...

共11条数据 1 尾页
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
JAV求代码,实现连接数据库,并执行写在XML中的SQL

最好详细一点,新手小白。 就是按照需求,以后修改SQL都再配置文件中修改而不修改代码。

JAV连接数据库找不到数据库驱动程序

以下是代码 package dbConnection; import java.sql.*; public class JDBCConnection { public Connection connection; public static void main(String[] args) { JDBCConnection dc=new JDBCConnection(); dc.close(); } public JDBCConnection(){ try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("正在建立数据库连接。。。"); connection=DriverManager.getConnection("jdbc:odbc:DSAccess"); System.out.println("数据库连接成功"); } catch(ClassNotFoundException ex){ System.out.println("找不到数据库驱动程序"); } catch(SQLException ex){ System.out.println("不能建立与数据库的连接"); } } public void close(){ try{ System.out.println("正在关闭数据库连接。。。"); connection.close(); System.out.println("数据库连接关闭成功"); } catch(Exception e){ System.out.println("数据库连接关闭失败"); } } } 运行显示不能连接到数据库,哪位大神能帮我看看哪里出了问题

为什么jav用jdbc连接数据库找不到列。

import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class JdbeTest { public static void main(String[] args) throws SQLException{ //1.注册驱动 DriverManager.registerDriver(new com.mysql.jdbc.Driver()); //2.获取连接 Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/Mysql", "root", "362324FJF"); //3.得到代表sql语句的对象 Statement stat = conn.createStatement(); //4.执行语句 ResultSet rs = stat.executeQuery("select * from user"); while(rs.next()){ System.out.println(rs.getObject("id")); System.out.println(rs.getObject("salary")); System.out.println(rs.getObject("age")); } rs.close(); stat.close(); conn.close(); } } ``` 我的数据库有创建user表 select * from user;出来的结果是 id salary age 1 2 3 4 8 6

求助一句sql,关于多条查询的

这样的一张表,我如何做到搜索AB,只得到1,搜索ABC,只得到2,搜索ABCD,得到3呢。拜托大神给个方向。![图片说明](https://img-ask.csdn.net/upload/201705/26/1495807885_522981.png)

javvweb 连接数据库出现问题 求大神指教

下面是程序代码 <%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="gb2312"%> <% 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 'logincheck.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 adminname=request.getParameter("txtname"); String adminpwd=request.getParameter("txtpwd"); String admin_right=""; Connection conn=null; Statement stmt=null; ResultSet rs=null; String sql=""; //操作数据库 //1.加载数据库驱动 try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); //2.连接数据库 conn=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=D:student.mdb","",""); }catch(Exception e){ e.getStackTrace(); } //3.创建数据库操作声明 stmt=conn.createStatement(); //4.查询数据库 try{ sql="select top 1 * from admin where admin_name='" +adminname+ "'"; rs=stmt.executeQuery(sql); }catch(Exception e){ e.getMessage(); } //5.判断密码正确与否 if(rs.next()){ if(adminpwd.equals(rs.getString("admin_password"))){ session.setAttribute("login_admin",adminname); admin_right=rs.getString("admin_right"); session.setAttribute("login_right",admin_right); response.sendRedirect("welcome.jsp"); }else{ response.sendRedirect("adminlogin.jsp?err=1"); } }else { response.sendRedirect("adminlogin.jsp?err=2"); } //6.关闭并释放资源 try{ rs.close(); rs=null; stmt.close(); stmt=null; conn.close(); conn=null; } catch(Exception e){ e.getMessage(); } %> </body> </html> 下面是错误提示 HTTP Status 500 - An exception occurred processing JSP page /dblogincheck.jsp at line 50 -------------------------------------------------------------------------------- type Exception report message An exception occurred processing JSP page /dblogincheck.jsp at line 50 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 /dblogincheck.jsp at line 50 47: e.getStackTrace(); 48: } 49: //3.创建数据库操作声明 50: stmt=conn.createStatement(); 51: //4.查询数据库 52: try{ 53: sql="select top 1 * from admin where admin_name='" +adminname+ "'"; Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430) 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:723) root cause java.lang.NullPointerException org.apache.jsp.dblogincheck_jsp._jspService(dblogincheck_jsp.java:108) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:723) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388) 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:723) note The full stack trace of the root cause is available in the Apache Tomcat/6.0.45 logs.

关于在数据库中转换某个字段时报错

ALTER TABLE T_IPP_INFO_ARTICLE CHANGE ARTICLE_ID ARTICLE_CONTENT VARCHAR(40) CHARACTER SET dbk NOT NULL; 输入这行Sql语句报错: 错误报告 - ORA-01735: 无效的 ALTER TABLE 选项 01735. 00000 - "invalid ALTER TABLE option" *Cause: *Action: 这是什么情况,请指教

dbvisualizer连接虚拟机数据库报错,能ping上但是不能连接,请问大神怎么办?

Product: DbVisualizer Pro 9.2.14 [Build #2495] OS: Windows 7 OS Version: 6.1 OS Arch: x86 Java Version: 1.8.0_60 Java VM: Java HotSpot(TM) Client VM Java Vendor: Oracle Corporation Java Home: d:\dbvisualizer\jre DbVis Home: D:\DbVisualizer User Home: C:\Users\Administrator PrefsDir: C:\Users\Administrator\.dbvis SessionId: 553 BindDir: C:\Users\Administrator\.dbvis\[0] An error occurred while establishing the connection: Details: Type: java.lang.reflect.UndeclaredThrowableException Stack Trace: java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy4.connect(Unknown Source) at com.onseven.dbvis.db.A.G.ň(Z:1777) at com.onseven.dbvis.db.A.G.?(Z:2202) at com.onseven.dbvis.db.A.I.?(Z:2416) at com.onseven.dbvis.db.A.B.execute(Z:2933) at com.onseven.dbvis.K.B.Z.ā(Z:2285) at com.onseven.dbvis.K.B.L.?(Z:1374) at com.onseven.dbvis.K.B.L.doInBackground(Z:1521) at javax.swing.SwingWorker$1.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at javax.swing.SwingWorker.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.Exception: java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/sql/converter/CharacterConverters; at com.onseven.dbvis.h.B.F$A.call(Z:2374) at java.util.concurrent.FutureTask.run(Unknown Source) ... 3 more Caused by: java.lang.NoSuchMethodError: oracle.i18n.text.converter.CharacterConverterOGS.getInstance(I)Loracle/sql/converter/CharacterConverters; at oracle.sql.converter.CharacterConverterFactoryOGS.make(CharacterConverterFactoryOGS.java:48) at oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:92) at oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:123) at oracle.sql.CharacterSet.make(CharacterSet.java:440) at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:145) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:890) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:268) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.onseven.dbvis.h.B.D.ā(Z:1548) at com.onseven.dbvis.h.B.F$A.call(Z:1369) ... 4 more

驱动程序无法使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。

警告: TDSChannel ( ConnectionID:1 TransactionID:0x0000000000000000) SSL handshake failed: java.lang.RuntimeException: Could not generate DH keypair com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误: java.lang.RuntimeException: Could not generate DH keypair。 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSChannel.throwSSLConnectionFailed(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) 一直都用JDK1.8+sqljdbc都能运行,最近几天突然不能运行了

报驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误

项目连接服务器DB正常运作,连接本地DB也没问题,进入项目后部分功能模块正常运行,部分点击会报驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误 at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at com.bstek.bdf2.core.security.filter.PreAuthenticatedProcessingFilter.doFilter(PreAuthenticatedProcessingFilter.java:41) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at com.bstek.bdf2.core.security.filter.ContextFilter.doFilter(ContextFilter.java:36) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 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:175) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:279) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:“java.lang.RuntimeException: Could not generate DH keypair”。 ClientConnectionId:ce0f61f0-020f-4a31-b6a4-e464dd9119c6 at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1667) at com.microsoft.sqlserver.jdbc.TDSChannel.enableSSL(IOBuffer.java:1668) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1323) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148) at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79) at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) at org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider.getConnection(LocalDataSourceConnectionProvider.java:83) 方便远程的话加微信18964366240

kettle执行job成功,Java执行kettle报错,求大神指导

[INFO,DoKettleService,http-bio-8080-exec-5] 执行kettle开始 [INFO,StandardFileSystemManager,http-bio-8080-exec-5] Using "C:\Users\ADMINI~1\AppData\Local\Temp\vfs_cache" as temporary files store. 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 开始执行任务 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 开始项[数据追溯] 2017/03/27 09:28:11 - cetl_001 - ERROR (version 1.0.0, build 1 from 2015-07-31 09.59.35 by chenrh) : 一个数据库错误发生在从资源库文件读取转换时 2017/03/27 09:28:11 - cetl_001 - org.pentaho.di.core.exception.KettlePluginLoaderException: 2017/03/27 09:28:11 - cetl_001 - Unable to load class for step/plugin with id [trace 2017/03/27 09:28:11 - cetl_001 - ]. Check if the plugin is available in the plugins subdirectory of the Kettle distribution. 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - ERROR (version 1.0.0, build 1 from 2015-07-31 09.59.35 by chenrh) : org.pentaho.di.core.exception.KettleException: 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - Unexpected error during transformation metadata load 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 一个数据库错误发生在从资源库文件读取转换时 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - Unable to load class for step/plugin with id [trace 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - ]. Check if the plugin is available in the plugins subdirectory of the Kettle distribution. 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.entries.trans.JobEntryTrans.getTransMeta(JobEntryTrans.java:1208) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.entries.trans.JobEntryTrans.execute(JobEntryTrans.java:648) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.Job.execute(Job.java:716) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.Job.execute(Job.java:859) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.Job.execute(Job.java:532) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.pentaho.di.job.Job.run(Job.java:424) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.quartz.service.DoKettleService.runJob(DoKettleService.java:52) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.quartz.service.DoKettleService$$FastClassBySpringCGLIB$$8a4f9c12.invoke(<generated>) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.quartz.service.DoKettleService$$EnhancerBySpringCGLIB$$3cedfde9.runJob(<generated>) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.udatech.common.taskManage.controller.CollectionTaskController.testDs(CollectionTaskController.java:310) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at java.lang.reflect.Method.invoke(Method.java:483) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.log.AccessLogFilter.doFilter(AccessLogFilter.java:121) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:230) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.security.XssAndSqlFilter.doFilter(XssAndSqlFilter.java:43) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at com.wa.framework.filter.SecurityFilter.doFilter(SecurityFilter.java:106) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 2017/03/27 09:28:11 - JOB_GLOBAL_RUN - at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

JAV类的静态变量在项目启动时初始化,在项目启动后怎么通过接口修改

@RequestMapping("/refreshCacheData.do") public String refreshCacheData() { BasicDataDao basicDataDao = new BasicDataDao(); basicDataDao.load(); return "Refresh cache data success!"; } 通过这个接口去重新调用load()方法,貌似不行。 下面是类的定义: @Repository public class BasicDataDao extends BaseDaoImpl { /** 同步的所有人员信息 */ static List<TSysStaff> users; /** 按code和登录名缓存的人员map数据 */ static Map<Object, TSysStaff> usersMap; /** 同步的所有人员归属部门信息 */ static List<TSysStaffOrg> usersOrg; /** 按人员code缓存的人员归属部门map数据 */ static Map<Object, TSysStaffOrg> usersOrgMap; /** 同步的所有部门机构信息 */ static List<TSysOrg> depts; /** 按code缓存的组织部门信息 */ static Map<Object, TSysOrg> deptsMap; /** 同步的所有SAP过来的日历信息 */ static List<TSysCalendar> calendars; /** 同步的所有cost center的数据 */ static List<TSysCostcenter> costCenters; /** 按code缓存的cost center信息 */ static Map<Object, TSysCostcenter> costcenterMap; /** 同步的所有wbs的数据 */ static List<TSysWbs> wbss; /** 按code缓存的wbs信息 */ static Map<Object, TSysWbs> wbsMap; /** 同步的所有国家的数据 */ static List<TSysCountry> countries; /** 按code缓存的国家信息 */ static Map<Object, TSysCountry> countryMap; /** 同步的所有币种信息 */ static List<TSysCurrency> currencies; /** 按code缓存的币种信息 */ static Map<Object, TSysCurrency> currenciesMap; /** 同步的所有省份信息 */ static List<TSysProvince> provinces; /** 按code缓存的省份信息 */ static Map<Object, TSysProvince> provinceMap; /** 查询用户的SQL */ @Value("${basicdata.sql.users}") private String usersSql; /** 查询用户归属部门的SQL */ @Value("${basicdata.sql.users.org}") private String usersOrgSql; /** 查询部门的SQL */ @Value("${basicdata.sql.depts}") private String deptsSql; /** 查询日历的SQL */ @Value("${basicdata.sql.calendars}") private String calendarsSql; /** 查询cost center的SQL */ @Value("${basicdata.sql.costCenter}") private String costCenterSql; /** 查询wbs的SQL */ @Value("${basicdata.sql.wbs}") private String wbsSql; /** 查询国家的SQL */ @Value("${basicdata.sql.country}") private String countrySql; /** 查询省份的SQL */ @Value("${basicdata.sql.province}") private String provinceSql; /** 查询币种的SQL */ @Value("${basicdata.sql.currencies}") private String currenciesSql; /** 读取所有需要缓存到本地的基础数据 */ @PostConstruct public void load() { users = this.query(usersSql, TSysStaff.class); usersMap = this.listToMap(users, "pkId", "staffCode", "staffEnName", "staffDisName"); usersOrg = this.query(usersOrgSql, TSysStaffOrg.class); usersOrgMap = this.listToMap(usersOrg, "pkId", "staffCode"); calendars = this.query(calendarsSql, TSysCalendar.class); costCenters = this.query(costCenterSql, TSysCostcenter.class); costcenterMap = this.listToMap(costCenters, "pkId", "costcenterCode"); wbss = this.query(wbsSql, TSysWbs.class); wbsMap = this.listToMap(wbss, "pkId", "wbsCode"); countries = this.query(countrySql, TSysCountry.class); countryMap = this.listToMap(countries, "pkId", "countryCode"); provinces = this.query(provinceSql, TSysProvince.class); provinceMap = this.listToMap(provinces, "pkId", "provinceCode"); depts = this.query(deptsSql, TSysOrg.class); deptsMap = this.listToMap(depts, "pkId", "orgCode"); currencies = this.query(currenciesSql, TSysCurrency.class); currenciesMap = this.listToMap(currencies, "pkId", "currencyCode"); } /** * 根据sql读取实体对象entityClass的列表,这个方法有可能不通过web访问,所以opensession. * * @param sql 查询SQL * @param entityClass 实体类 * @param args 查询参数 * @return */ @SuppressWarnings("unchecked") public <T> List<T> query(final String sql, final Class<T> entityClass, final Object... args) { return getHibernateTemplate().execute(new HibernateCallback<List<T>>() { @Override public List<T> doInHibernate(Session session) throws HibernateException { SQLQuery query = session.createSQLQuery(sql); query.setResultTransformer(ColumnsToBeanResultTransformer.columnsToBean(entityClass)); if (args != null && args.length > 0) { for (int i = 0, l = args.length; i < l; i++) { query.setParameter(i, args[i]); } } List<T> list = query.list(); return list; } }); } /** * 将实体列表转换为map,key为每个实体对象的propertyNames属性的值 * * @param list 实体对象列表 * @param propertyNames 作为map的key的属性名.每个对象会使用其对应的属性名作为map的key * @return */ public <T> Map<Object, T> listToMap(List<T> list, String... propertyNames) { Map<Object, T> map = new LinkedHashMap<Object, T>(); for (T e : list) { for (String propertyName : propertyNames) { map.put(BeanHelper.getPropertyValue(e, propertyName), e); } } return map; } /** * 所有人员数据. * * @return 所有员工基础数据 */ public static List<TSysStaff> getUsers() { return users; } /** * 根据人员代码或登录名读取人员数据 * * @param code 人员代码或登录名 * @return 代码或登录名为code的人员 */ public static TSysStaff getUser(String code) { return usersMap.get(code); } /** * 根据人员代码或登录名读取人员数据 * * @param disName 人员显示名字 * @return 显示名字为disName的人员 */ public static TSysStaff getUserByDisName(String disName) { return usersMap.get(disName); } //模糊查询 public static List<TSysStaff> getUserLikeSearchWithDisName(String disName) { List<TSysStaff> tSysStaffs = new ArrayList<>(); for(TSysStaff tSysStaff : users){ if(!StringUtils.isEmpty(tSysStaff.getStaffDisName()) && tSysStaff.getStaffDisName().contains(disName)){ tSysStaffs.add(tSysStaff); } } return tSysStaffs; } /** * 根据人员代码读取人员归属机构数据 * * @param code 人员代码 * @return 人员归属机构数据 */ public static TSysStaffOrg getUserOrg(String code) { return usersOrgMap.get(code); } /** * 根据人员代码读取人员归属机构数据 * * @param code 人员代码 * @return 人员归属机构数据 */ public static List<TSysCalendar> getTSysCalendar() { return calendars; } /** * 所有组织部门数据 * * @return 所有组织部门数据 */ public static List<TSysOrg> getDepts() { return depts; } /** * 根据部门代码读取数据 * * @param code 部门代码 * @return 代码为code的部门 */ public static TSysOrg getDept(String code) { return deptsMap.get(code); } /** * 所有cost center数据 * * @return 所有cost center数据 */ public static List<TSysCostcenter> getTSysCostcenters() { return costCenters; } /** * 根据cost center代码读取数据 * * @param code cost center代码 * @return 代码为code的cost center */ public static TSysCostcenter getTSysCostcenter(String code) { return costcenterMap.get(code); } /** * 所有WBS数据 * * @return 所有WBS数据 */ public static List<TSysWbs> getTSysWbss() { return wbss; } /** * 根据wbs代码读取数据 * * @param code wbs代码 * @return 代码为code的wbs */ public static TSysWbs getTSysWbs(String code) { return wbsMap.get(code); } /** * 所有国家数据 * * @return 所有国家数据 */ public static List<TSysCountry> getTSysCountries() { return countries; } /** * 根据国家代码读取数据 * * @param code 国家代码 * @return 代码为code的国家 */ public static TSysCountry getTSysCountry(String code) { return countryMap.get(code); } /** * 所有省份数据 * * @return 所有省份数据 */ public static List<TSysProvince> getTSysProvinces() { return provinces; } /** * 根据省份代码读取数据 * * @param code 省份代码 * @return 代码为code的省份 */ public static TSysProvince getTSysProvince(String code) { return provinceMap.get(code); } /** * 所有币种数据 * * @return 所有组织部门数据 */ public static List<TSysCurrency> getCurrencies() { return currencies; } /** * 根据币种代码得到币种数据 * * @param code 币种代码 * @return 代码为code的币种数据 */ public static TSysCurrency getCurrency(String code) { return currenciesMap.get(code); } 但是通过schedule却可以调用成功: <bean id="refreshDBCache" class="com.*.common.dao.BasicDataDao"></bean> <task:scheduled-tasks> <task:scheduled ref="refreshDBCache" method="load" cron="0 0 0,12 * * ?" /> </task:scheduled-tasks>

萌新java连接MySQL数据库出现java.lang.NullPointerException错误是为什么,求大佬看一下代码解答

package Stu; import java.util.*; public class StuManage { public void menu(){ connectSQL s=new connectSQL(); int xuhao; String b1 = null,c1=null,b111=null; int a = 0,a1=0,b11=0,c11=0; Scanner scanner=new Scanner(System.in); System.out.println("欢迎来到学生信息管理系统"); System.out.println("1.新增学生"); System.out.println("2.修改学生"); System.out.println("3.删除学生"); System.out.println("4.查询学生"); System.out.println("5.显示所有学生信息"); System.out.println("6.退出该系统"); System.out.println("请选择(1-5):"); xuhao=scanner.nextInt(); switch (xuhao) { case 1: s.open(); stuadd(); s.down(); break; case 2: update(); break; case 3: studel(); s.open(); s.shanchu(a); s.down(); break; case 4: stuList(); s.open(); s.chaxun(b11); s.down(); break; case 5: xianshi(); s.open(); s.xianshi(); s.down(); break; case 6: System.exit(0); break; default: System.out.println("输入有误:程序自动退出,请重启程序"); break; } } public void stuadd(){ connectSQL x=new connectSQL(); Scanner s=new Scanner(System.in); String select,jieshou,name=null; int no=0,phone=0; System.out.println("====新增学生===="); System.out.println("学号:"); no=s.nextInt(); jieshou=s.nextLine(); System.out.println("姓名:"); name=s.nextLine(); System.out.println("手机号:"); phone=s.nextInt(); System.out.println("您输入的信息为:学号:"+no+" "+"姓名:"+name+" "+"手机号:"+phone); System.out.println("是否保存?y/n"); jieshou=s.nextLine(); select=s.nextLine(); if(select.equals("y")){ x.tianjia(no,name,phone); System.out.println("保存成功!"); } else if(select.equals("n")){ System.out.println("请重新输入"); } } package Stu; import java.sql.*; public class connectSQL { Connection con=null; PreparedStatement st=null; ResultSet rs=null; public void open(){ try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String uri="jdbc:mysql://localhost:3306/qinyewei?user=root&password=123456&userSSL=ture"; try{ con=DriverManager.getConnection(uri); } catch(SQLException e){ System.out.println(e); } } public void down(){ try { con.close(); } catch (SQLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } void xianshi(){ try{ st=con.prepareStatement("select * from stu"); rs=st.executeQuery(); while(rs.next()) { String a=rs.getString(1); String b=rs.getString(2); String c=rs.getString(3); System.out.printf("%s\t",a); System.out.printf("%5s\t",b); System.out.println(c); } } catch (SQLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } void tianjia(int a1,String b1,int c1) { try { System.out.println(a1); System.out.println(b1); System.out.println(c1); st=con.prepareStatement("insert stu values(?,?,?)"); st.setInt(1,a1); st.setString(2,b1); st.setInt(3,c1); int i=st.executeUpdate(); System.out.println("添加了"+i+"条记录"); this.xianshi(); } catch (Exception e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } } 运行后输入1、学号、姓名、手机号以后出现错误是为什么呢? 欢迎来到学生信息管理系统 1.新增学生 2.修改学生 3.删除学生 4.查询学生 5.显示所有学生信息 6.退出该系统 请选择(1-5): 1 ====新增学生==== 学号: 123123 姓名: weqwe 手机号: 123123 您输入的信息为:学号:123123 姓名:weqwe 手机号:123123 是否保存?y/n y 123123 weqwe 123123 java.lang.NullPointerException保存成功! at Stu.connectSQL.tianjia(connectSQL.java:56) at Stu.StuManage.stuadd(StuManage.java:72) at Stu.StuManage.menu(StuManage.java:22) at Stu.Main.main(Main.java:7) 第56行代码是 st=con.prepareStatement("insert stu values(?,?,?)");

javs中阻塞方法和break语句的区别和联系是什么

javs中阻塞方法和break语句的区别和联系是什么 阻塞方法要接受到相应的数据才会继续运行 那如何理解break语句呢

jsp分页运行执行到链接数据库时出现这种问题,求解决

2016-9-22 10:16:03 com.microsoft.sqlserver.jdbc.SQLServerConnection Prelogin 警告: ConnectionID:4 Prelogin error: host localhost port 1434 Error reading prelogin response: at com.microso ft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnectio n .java:1368) at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection .java:1355) at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1532) at com.micro soft.sqlserver.jdbc.SQLServerConnection.Prelogin(SQLServerConnection. java:1133) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnec tion.java:1054) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.jav a:833) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection. j ava:716) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.Driv erManager.getConnection(DriverManager.java:185) at cn.jbit.easyb uy.dao.BaseDao.getConnection(BaseDao.java:29) at cn.jbit.easybuy .dao.impl.easybuy_commenDaoImpl.getPageCommentInfo(easybuy_comm enDaoImpl.java:19) at cn.jbit.easybuy.biz.impl.easybuy_commentBizImpl.getPageCommentInfo(easybuy_com mentBizImpl.java:17) at cn.jbit.easybuy.wed.PageServlet.doGet(PageServlet.java:106) at javax.servlet. http.HttpServlet.service(HttpServlet.java:620) at javax.servlet .http.HttpServlet.service(HttpServlet.java:727) at org.apache.ca talina.core.ApplicationFilterChain.internalDoFilter(ApplicationFi lterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChai n.java:208) at cn.jbit.easybuy.util.EncodeFilter.doFilter(EncodeFilter.java:23) at org.apach e.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFi lterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChai n.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.j ava:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:1 16) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) a t org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Process or.java:1040) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractP rotocol.java:607) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:31 5) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java :886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908

mybatis调用mysql存储过程时报错

<parameterMap type="java.util.Map" id="callMap"> <parameter property="pId" jdbcType="VARCHAR" mode="IN"/> <parameter property="colName" jdbcType="VARCHAR" mode="IN"/> <parameter property="colPname" jdbcType="VARCHAR" mode="IN"/> <parameter property="tName" jdbcType="VARCHAR" mode="IN"/> <parameter property="outColName" jdbcType="VARCHAR" mode="IN"/> <parameter property="retVal" jdbcType="VARCHAR" mode="OUT"/> <parameter property="userCount" jdbcType="INTEGER" mode="OUT"/> </parameterMap> <select id="getChildDeptAndCountByParentId" parameterMap="callMap" statementType="CALLABLE" > {CALL pro_getChildList( #{pId,jdbcType=VARCHAR,mode=IN}, #{colName,jdbcType=VARCHAR,mode=IN}, #{colPname,jdbcType=VARCHAR,mode=IN}, #{tName,jdbcType=VARCHAR,mode=IN}, #{outColName,jdbcType=VARCHAR,mode=IN}, #{retVal,jdbcType=VARCHAR,mode=OUT}, #{userCount,jdbcType=INTEGER,mode=OUT} )} </select> 在本机跟测试mysql 5.6.36中可以正常运行,但放到生产环境中,mysql版本为5.6.44时会抛出错误 std [0523 14:45:27 ERROR: druid.sql.Statement - {conn-10020, cstmt-20014} execute error. {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} 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.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:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) 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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) std [0523 14:45:27 ERROR: com.alibaba.dubbo.rpc.filter.ExceptionFilter - [DUBBO] Got unchecked and undeclared exception which called by 172.21.4.80. service: com.concom.yunzq.service.user.IDepartmentService, method: queryChildDeptAndCountByParentId, exception: org.springframework.jdbc.BadSqlGrammarException: ### Error querying 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 ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### 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 ; bad SQL grammar []; nested exception is 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, dubbo version: 2.8.4, current host: 172.21.4.80 org.springframework.jdbc.BadSqlGrammarException: ### Error querying 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 ')' at line 1 ### The error may exist in file [D:\ouyang\tomcat\branch\apache-tomcat-8.5.39\webapps\METRO_YUNZQ_SERVICE_IMPL\WEB-INF\classes\config\mybatis\mappers\user\Department_mapper.xml] ### The error may involve com.concom.yunzq.impl.dao.user.DepartmentDao.callMap ### The error occurred while setting parameters ### SQL: {CALL pro_getChildList( ?, ?, ?, ?, ?, ?, ? )} ### 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 ; bad SQL grammar []; nested exception is 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 org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:447) at com.sun.proxy.$Proxy38.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:167) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53) at com.sun.proxy.$Proxy74.getChildDeptAndCountByParentId(Unknown Source) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl.queryChildDeptAndCountByParentId(DepartmentServiceImpl.java:846) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$FastClassBySpringCGLIB$$5153dd20.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:652) at com.concom.yunzq.impl.service.user.DepartmentServiceImpl$$EnhancerBySpringCGLIB$$adbc1137.queryChildDeptAndCountByParentId(<generated>) at com.alibaba.dubbo.common.bytecode.Wrapper77.invokeMethod(Wrapper77.java) at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:46) at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:72) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:64) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.concom.yunzq.dubbo.BaseFilter.invoke(BaseFilter.java:85) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:70) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:132) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:113) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:84) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:170) at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:52) at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:82) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 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 ')' at line 1 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:407) at com.mysql.jdbc.Util.getInstance(Util.java:382) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1052) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3603) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3535) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1989) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2150) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362) at com.mysql.jdbc.CallableStatement.execute(CallableStatement.java:908) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440) at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929) at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:118) at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493) at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:67) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at sun.reflect.GeneratedMethodAccessor257.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy224.query(Unknown Source) at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77) 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.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:434) ... 40 more

hibernate注解开发时遇到异常

求助: 我在使用Hibernate的注解开发时遇到了这个异常:'hibernate.dialect' must be set when no Connection avalable。上百度搜了一下,说是数据库的问题,可是我的数据库是连接得上的。就是我又两个类Student和Teacher,Student使用mapping.xml的方法映射,Teacher用注解,单独用Student测试时是好好的,可以向数据库加东西。加了Teacher后,测试Teacher就抛出'hibernate.dialect' must be set when no Connection avalable,这时如果再测试Student就抛出An AnnotationConfiguration instance is required to use <mapping class="com.model.Teacher"/> 我的项目架构如下: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720076_685133.png) teacher类: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720206_972939.png) 配置文件: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720213_522423.png) 数据库: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720274_582112.png) 加入注解的teacher后的异常: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720370_963990.png) 测试代码: ![图片说明](https://img-ask.csdn.net/upload/201604/15/1460720417_90141.png)

jav怎么设置环境,我加设置页游

我用jav怎么设置呢????请告诉我好几个人也有这个问题,你们呢我不知道再说吧!gg

用cmd命令执行java程序后,无响应,无报错

如图,回车执行后,无响应,简单问题,新手诚心提问,望不吝赐教。 ![图片说明](https://img-ask.csdn.net/upload/201508/24/1440387031_710814.png)

jav实现两张图片相似度的对比并得出分数

声明 图片是两张毛笔字图片, 一张是电脑制作的 一张是手写的图片,我在网上也搜了几个方法,不过效果不太好,是利用的直方图的概念比较的,不过这个方法比较的分数太低,这个技术是根据颜色值对比吧,我也不太理解; 图片处理这方面的技术没了解过,我想先把图片灰度化 然后再利用直方图概念对比,这种方法会不会好点呢,希望有大神可以给点意见,第一次来这提问,还望理解 下面有图 ![图片说明](https://img-ask.csdn.net/upload/201706/08/1496907843_932606.png) ![图片说明](https://img-ask.csdn.net/upload/201706/08/1496907858_961183.jpg)

Android 数据库查询报错

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.database.Cursor android.database.sqlite.SQLiteDatabase.rawQuery(java.lang.String, java.lang.String[])' on a null object reference 报错行代码:Cursor cursor = mSQLiteDatabase.rawQuery("select * from users",null);

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解!

CSDN:因博主近期注重写专栏文章(已超过150篇),订阅博主专栏人数在突增,近期很有可能提高专栏价格(已订阅的不受影响),提前声明,敬请理解! 目录 博客声明 大数据了解博主粉丝 博主的粉丝群体画像 粉丝群体性别比例、年龄分布 粉丝群体学历分布、职业分布、行业分布 国内、国外粉丝群体地域分布 博主的近期访问每日增量、粉丝每日增量 博客声明 因近期博主写专栏的文章越来越多,也越来越精细,逐步优化文章。因此,最近一段时间,订阅博主专栏的人数增长也非常快,并且专栏价

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

培训班出来的人后来都怎么样了?(二)

接着上回说,培训班学习生涯结束了。后面每天就是无休止的背面试题,不是没有头脑的背,培训公司还是有方法的,现在回想当时背的面试题好像都用上了,也被问到了。回头找找面试题,当时都是打印下来天天看,天天背。 不理解呢也要背,面试造飞机,上班拧螺丝。班里的同学开始四处投简历面试了,很快就有面试成功的,刚开始一个,然后越来越多。不知道是什么原因,尝到胜利果实的童鞋,不满足于自己通过的公司,嫌薪水要少了,选择...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

工作八年,月薪60K,裸辞两个月,投简历投到怀疑人生!

近日,有网友在某职场社交平台吐槽,自己裸辞两个月了,但是找工作却让自己的心态都要崩溃了,全部无果,不是已查看无回音,就是已查看不符合。 “工作八年,两年一跳,裸辞两个月了,之前月薪60K,最近找工作找的心态崩了!所有招聘工具都用了,全部无果,不是已查看无回音,就是已查看不符合。进头条,滴滴之类的大厂很难吗???!!!投简历投的开始怀疑人生了!希望 可以收到大厂offer” 先来看看网...

97年世界黑客编程大赛冠军作品(大小仅为16KB),惊艳世界的编程巨作

这是世界编程大赛第一名作品(97年Mekka ’97 4K Intro比赛)汇编语言所写。 整个文件只有4095个字节, 大小仅仅为16KB! 不仅实现了3D动画的效果!还有一段震撼人心的背景音乐!!! 内容无法以言语形容,实在太强大! 下面是代码,具体操作看最后! @echo off more +1 %~s0|debug e100 33 f6 bf 0 20 b5 10 f3 a5...

不要再到处使用 === 了

我们知道现在的开发人员都使用 === 来代替 ==,为什么呢?我在网上看到的大多数教程都认为,要预测 JavaScript 强制转换是如何工作这太复杂了,因此建议总是使用===。这些都...

什么是a站、b站、c站、d站、e站、f站、g站、h站、i站、j站、k站、l站、m站、n站?00后的世界我不懂!

A站 AcFun弹幕视频网,简称“A站”,成立于2007年6月,取意于Anime Comic Fun,是中国大陆第一家弹幕视频网站。A站以视频为载体,逐步发展出基于原生内容二次创作的完整生态,拥有高质量互动弹幕,是中国弹幕文化的发源地;拥有大量超粘性的用户群体,产生输出了金坷垃、鬼畜全明星、我的滑板鞋、小苹果等大量网络流行文化,也是中国二次元文化的发源地。 B站 全称“哔哩哔哩(bilibili...

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

MySQL性能优化(五):为什么查询速度这么慢

前期回顾: MySQL性能优化(一):MySQL架构与核心问题 MySQL性能优化(二):选择优化的数据类型 MySQL性能优化(三):深入理解索引的这点事 MySQL性能优化(四):如何高效正确的使用索引 前面章节我们介绍了如何选择优化的数据类型、如何高效的使用索引,这些对于高性能的MySQL来说是必不可少的。但这些还完全不够,还需要合理的设计查询。如果查询写的很糟糕,即使表结构再合理、索引再...

用了这个 IDE 插件,5分钟解决前后端联调!

点击上方蓝色“程序猿DD”,选择“设为星标”回复“资源”获取独家整理的学习资料!作者 |李海庆我是一个 Web 开发前端工程师,受到疫情影响,今天是我在家办公的第78天。开发了两周,...

大厂的 404 页面都长啥样?最后一个笑了...

每天浏览各大网站,难免会碰到404页面啊。你注意过404页面么?猿妹搜罗来了下面这些知名网站的404页面,以供大家欣赏,看看哪个网站更有创意: 正在上传…重新上传取消 腾讯 正在上传…重新上传取消 网易 淘宝 百度 新浪微博 正在上传…重新上传取消 新浪 京东 优酷 腾讯视频 搜...

【高并发】高并发秒杀系统架构解密,不是所有的秒杀都是秒杀!

网上很多的文章和帖子中在介绍秒杀系统时,说是在下单时使用异步削峰来进行一些限流操作,那都是在扯淡! 因为下单操作在整个秒杀系统的流程中属于比较靠后的操作了,限流操作一定要前置处理,在秒杀业务后面的流程中做限流操作是没啥卵用的。

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

Java14 新特性解读

Java14 已于 2020 年 3 月 17 号发布,官方特性解读在这里:https://openjdk.java.net/projects/jdk/14/以下是个人对于特性的中文式...

爬虫(101)爬点重口味的

小弟最近在学校无聊的很哪,浏览网页突然看到一张图片,都快流鼻血。。。然后小弟冥思苦想,得干一点有趣的事情python 爬虫库安装https://s.taobao.com/api?_ks...

疫情后北上广深租房价格跌了吗? | Alfred数据室

去年3月份我们发布了《北上广深租房图鉴》(点击阅读),细数了北上广深租房的各种因素对租房价格的影响。一年过去了,在面临新冠疫情的后续影响、城市尚未完全恢复正常运转、学校还没开学等情况下...

面试官给我挖坑:a[i][j] 和 a[j][i] 有什么区别?

点击上方“朱小厮的博客”,选择“设为星标”后台回复&#34;1024&#34;领取公众号专属资料本文以一个简单的程序开头——数组赋值:int LEN = 10000; int[][] ...

又一起程序员被抓事件

就在昨天互联网又发生一起让人心酸的程序员犯罪事件,著名的百度不限速下载软件 Pandownload PC 版作者被警方抓获。案件大致是这样的:软件的作者不仅非法盗取用户数据,还在QQ群进...

应聘3万的职位,有必要这么刁难我么。。。沙雕。。。

又一次被面试官带到坑里面了。面试官:springmvc用过么?我:用过啊,经常用呢面试官:springmvc中为什么需要用父子容器?我:嗯。。。没听明白你说的什么。面试官:就是contr...

太狠了,疫情期间面试,一个问题砍了我5000!

疫情期间找工作确实有点难度,想拿到满意的薪资,确实要点实力啊!面试官:Spring中的@Value用过么,介绍一下我:@Value可以标注在字段上面,可以将外部配置文件中的数据,比如可以...

Intellij IDEA 美化指南

经常有人问我,你的 IDEA 配色哪里搞的,我会告诉他我自己改的。作为生产力工具,不但要顺手而且更要顺眼。这样才能快乐编码,甚至降低 BUG 率。上次分享了一些 IDEA 有用的插件,反...

【相亲】96年程序员小哥第一次相亲,还没开始就结束了

颜值有点高,条件有点好

太厉害了,终于有人能把TCP/IP 协议讲的明明白白了

一图看完本文 一、 计算机网络体系结构分层 计算机网络体系结构分层 计算机网络体系结构分层 不难看出,TCP/IP 与 OSI 在分层模块上稍有区别。OSI 参考模型注重“通信协议必要的功能是什么”,而 TCP/IP 则更强调“在计算机上实现协议应该开发哪种程序”。 二、 TCP/IP 基础 1. TCP/IP 的具体含义 从字面意义上讲,有人可能会认为...

腾讯面试题: 百度搜索为什么那么快?

我还记得去年面腾讯时,面试官最后一个问题是:百度/google的搜索为什么那么快? 这个问题我懵了,我从来没想过,搜素引擎的原理是什么 然后我回答:百度爬取了各个网站的信息,然后进行排序,当输入关键词的时候进行文档比对……巴拉巴拉 面试官:这不是我想要的答案 我内心 这个问题我一直耿耿于怀,终于今天,我把他写出来,以后再问,我直接把这篇文章甩给他!!! 两个字:倒排,将贯穿整篇文章,也是面试官...

相关热词 c# 局部 截图 页面 c#实现简单的文件管理器 c# where c# 取文件夹路径 c# 对比 当天 c# fir 滤波器 c# 和站 队列 c# txt 去空格 c#移除其他类事件 c# 自动截屏
立即提问