连接mysql 报错Keyring migration failed. 5C

如题。
通过源码新安装的mysql
图片说明

1个回答

http://www.jb51.net/article/53312.htm
解决的办法是编辑/usr/bin/mysql-workbench,

将# WB_NO_GNOME_KEYRING=1改成export WB_NO_GNOME_KEYRING=1,

保存并重新运行mysql-workbench,就可以保存密码并连接数据库了。

luoxiangyu1
罗向宇 没找见bin目录下的 mysql-workbench
6 个月之前 回复
qq_31112281
爬行的程序猿 我没装workbench啊
大约一年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
django Migration报错解决办法
Django在使用migrete命令时由于自己的误操作报了以下错误,django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency users.0001_initial on database 'default'....
MySQL Migration Toolkit 数据迁移
MySQL Migration Toolkit 数据迁移
MySQL Migration Toolkit v2.1
mysql与oracle数据库互转工具,oracle转mysql,mysql转oracle,DBF转mysql,Access与mysql互转,excel与mysql互转
MySQL Migration Toolkit 1.0
MySQL Migration Toolkit 1.0
MySql migration to Oracle Tool
好用的工具可將MySQL DB完整移植到Oracle DB
mysql migration to oracle
提供mysql移植到oracle的方案 实践过程描述
MySQL Migration Toolkit的使用
MySQL Migration Toolkit的使用
mysql migration toolkit 启动报错
mysql migration toolkit 启动报错 an error occurred during the initialization of the runtime system.Please make sure you have the Java Runtime Environment(JRE)5.0 Update 8 or newer instralled.rnrnJRE也多次将了8版本的,javac -version 可见为javac 1.8.0_25rn环境变量也设置了的JAVA_HOME =C:\Program Files\Java\jdk1.8.0rnrn请高手指点!rn
MySQL Migration Toolkit Manual
Abstract This is the MySQL Migration Toolkit Manual. Document generated on: 2008-12-09 (revision: 12851)
MySQL Migration Toolkit
使用MySQL Migration Toolkit快速将Oracle数据,SQL Server中的数据等各种数据源导入MySQL数据库
水晶报表报错:CrystalDecisions.CrystalReports.EngineLoad crpe32.dll failed.
CrystalDecisions.CrystalReports.EngineLoad crpe32.dll failed.rnrn用vs.net 2003,crystal report 9.0 cn 版,开发的asp.net程序,在本机没问题,安装到另外一台机器也没问题。安装到第三台机器,一运行有报表的页面就出这个错误。在这台机器上安装个crystal report 9.0 cn 版可以解决,但我不想拿到客户那里也这样去解决。rnrn我用vs.net 2003做的安装程序,已经把crystal report 的merge文件DotNetCrystalReports.msm打包进去了。
jsp 连接mysql报错
myeclipse报错rnrn严重: A web application registered the JBDC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.rn2010-5-20 14:35:20 org.apache.catalina.loader.WebappClassLoader clearReferencesStopTimerThreadrn严重: A web application appears to have started a TimerThread named [MySQL Statement Cancellation Timer] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.rnrnrn请问这是怎么回事?但是我能够正常存取数据库rnrnrnrn我用的代码为:rn[code=Java]rnpublic class Dbunit rnrn private static Connection conn = null;rn private static Statement state = null;rn private static ResultSet rst = null;rnrn rn public static void addunit(Testunit t) rn try rn conn = getConnection();rn state = conn.createStatement();rn String sql = "insert into _unit values("+t.getNum()+",'"+t.getName()+"','"+t.getAdd()+"'," +rn "'"+t.getGetdate()+"','"+t.getSenddate()rn +"',"+t.getCost()+",'"+t.getAcceptor()+"','"+t.getAcceptdate()+"')";rn //System.out.println(sql);rn state.executeUpdate(sql);rn catch (Exception e) rn e.printStackTrace();rn finally rn try rn state.close();rn conn.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn rnrn public static ArrayList lookforTestunits(String sql) rnrn ArrayList a = new ArrayList();rnrn try rnrn conn = getConnection();rn state = conn.createStatement();rn // String o="select * from person where pname like '%"+s+"%'";rn rst = state.executeQuery(sql);rn //System.out.println(sql);rnrn while (rst.next()) rn Testunit p = new Testunit();rn p.setAcceptdate(rst.getString("acceptdate"));rn p.setAcceptor(rst.getString("acceptor"));rn p.setAdd(rst.getString("unitadd"));rn p.setCost(rst.getFloat("testcost"));rn p.setGetdate(rst.getString("date0"));rn p.setName(rst.getString("unitname"));rn p.setNum(rst.getInt("unitcardno"));rn p.setSenddate(rst.getString("date1"));rn rn a.add(p);rn // System.out.println(p.getTitle() + " " + p.getCont());rn rnrn rnrn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn finally rn try rn rst.close();rn state.close();rn conn.close();rn catch (SQLException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rnrn rnrn return a;rnrn rnpublic static Connection getConnection() rn Connection conn = null;rn String driverName = "com.mysql.jdbc.Driver";rn String userName = "root";rn String userPasswd = "mysql";rn String dbName = "sampletest";rn // String tableName="person";rn String port = "3306";rn String url = "jdbc:mysql://localhost:" + port + "/" + dbName + "?user="rn + userName + "&password=" + userPasswdrn + "&useUnicode=true&characterEncoding=utf-8";//rn try rn Class.forName("com.mysql.jdbc.Driver").newInstance();rn conn = DriverManager.getConnection(url);rn catch (Exception e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn return conn;rn rnrnrn[/code]rnrnrn
mysql 连接报错
MySQL 8.0.11 error connect to caching_sha2_password the specified module could not be found ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpassword';
eclipse连接mysql报错
在连接数据库的测试过程中报错,不知道该怎么解决?rn错误: 找不到或无法加载主类 jdbc.sqltest
MySQL 连接报错
错误信息:rnERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)rnrn
连接mysql报错
2010-9-17 14:41:17 org.apache.catalina.core.AprLifecycleListener initrn信息: The APR based Apache Tomcat Native library which allows optimal performancrne in production environments was not found on the java.library.path: D:\tomcat6jrndk6mysql51\tomcat6jdk6mysql5\tomcat-6.0.16-asso\jdk1.6\jre\bin;.;C:\WINDOWS\Sun\rnJava\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\tomcat6jdk6mysql51\tomcat6jdk6mysql5\rntomcat-6.0.16-asso\jdk1.6\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32rn\Wbemrn2010-9-17 14:41:17 org.apache.coyote.http11.Http11Protocol initrn信息: Initializing Coyote HTTP/1.1 on http-8081rn2010-9-17 14:41:17 org.apache.catalina.startup.Catalina loadrn信息: Initialization processed in 715 msrn2010-9-17 14:41:18 org.apache.catalina.core.StandardService startrn信息: Starting service Catalinarn2010-9-17 14:41:18 org.apache.catalina.core.StandardEngine startrn信息: Starting Servlet Engine: Apache Tomcat/6.0.16rnlog4j:WARN No appenders could be found for logger (consult.util.HibernateThreadFrnilter).rnlog4j:WARN Please initialize the log4j system properly.rnlog4j:WARN No appenders could be found for logger (consult.util.HibernateThreadFrnilter).rnlog4j:WARN Please initialize the log4j system properly.rnnull邮件服务启动失败.rn2010-9-17 14:41:34 org.apache.catalina.core.StandardContext addApplicationListenrnerrn信息: The listener "org.springframework.web.context.ContextLoaderListener" is alrnready configured for this context. The duplicate definition has been ignored.rn2010-9-17 14:41:41 org.apache.coyote.http11.Http11Protocol startrn信息: Starting Coyote HTTP/1.1 on http-8081rn2010-9-17 14:41:41 org.apache.jk.common.ChannelSocket initrn信息: JK: ajp13 listening on /0.0.0.0:8018rn2010-9-17 14:41:41 org.apache.jk.server.JkMain startrn信息: Jk running ID=0 time=0/31 config=nullrn2010-9-17 14:41:41 org.apache.catalina.startup.Catalina startrn信息: Server startup in 23163 msrnselect distinct(a.userid),a.userno,username,a.pwd from sys_users a where usernrno='admin'rncom.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown character setrn: 'macce'rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rnrn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructrnorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCrnonstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)rn at com.mysql.jdbc.Util.getInstance(Util.java:381)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)rn at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)rn at com.mysql.jdbc.ConnectionImpl.configureClientCharacterSet(ConnectionIrnmpl.java:1751)rn at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImprnl.java:3425)rn at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2045)rn at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:718)rn at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rnrn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructrnorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCrnonstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)rn at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)rn at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.javarn:282)rn at java.sql.DriverManager.getConnection(DriverManager.java:582)rn at java.sql.DriverManager.getConnection(DriverManager.java:185)rn at com.Hwsoft.oa.util.DbUtil.openConnection(DbUtil.java:19)rn at com.Hwsoft.oa.util.BaseDao.queryOne(BaseDao.java:116)rn at com.Hwsoft.oa.dao.impl.sys.UserDaoImpl.checkLogin(UserDaoImpl.java:10rn1)rn at com.Hwsoft.oa.servlet.Login.doPost(Login.java:75)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplrnicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFrnilterChain.java:206)rn at com.Hwsoft.oa.filter.EncodingFilter.doFilter(EncodingFilter.java:25)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplrnicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFrnilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVrnalve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextVrnalve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jrnava:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jrnava:102)rn at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:rn568)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValrnve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.javrna:286)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.javarn:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.procernss(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:44rn7)rn at java.lang.Thread.run(Thread.java:619)rnrn这是我连接mysql数据库用户名密码登陆时报的错,请问是什么原因我是用ssh做的
EF连接MYSQL报错
我调了半天 实在调不出来了rn[img=https://img-bbs.csdn.net/upload/201411/04/1415115556_27129.png][/img]rnContext出错rnrn[code=html]rnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrn rn rn rn rn rn[/code]
hive连接mysql报错
今天遇到一个问题,执行hive无法连接mysql。纠结好久,各种查找无果。后来发现mysql没有启动!!! service mysqld status mysqld is stopped 启动mysql 成功连接 [root@min1 ~]# service mysqld start Starting mysqld: ...
asp连接mysql 报错
下面的一段代码报如下错误,望高人指点迷津rnrnMicrosoft VBScript 编译器错误 error '800a0409' rnrn未结束的字符串常量 rnrn/kwj/connmysql.asp, line 9rnrnrnrnrnrn  MySQL连接测试rn  rnrnrn  rn <% rn strconnection="dsn=mysqltest;rn  Driver=MySQL ODBC 5.1 Driver;rn  server=localhost;uid=root;pwd=root;database=test"rn rn rn  set conn = server.createobject("adodb.connection") rn  conn.open strconnectionrn  sql = "select * from user"rn  set rs = conn.execute(sql) rn  if not rs.bof then rnrn %>rnrn  rn  rn   namern   sexrn  rn <% rn  do while not rs.eof rn %> rn  rn   <%=rs("name")%> rn   <%=rs("sex")%> rn  rn <% rn   rs.movenext rn  loop rn %> rn  rnrn <% rn  else rn   response.write("sorry, no data found.") rn  end if rn  rs.close rn  conn.close rn  set conn = nothing rn  set rs = nothing rn %>rnrnrn
Navicat连接MySQL报错
Navicat连接MySQL报错:client does not support authentication protocol requested by server;consider upgrading MySQL client.的解决记录: 1、打开 2、输入命令如下: 第一步:输入use mysql; 第二步:输入alter user 'root'@'localhost' iden...
hibernate连接mysql报错
环境hibernate4.1.2,mysql5.0.8rnrn我的mysql地址是没有错的,我简单的用JDBC测试过地址,但是配到hibernate.cfg.xml一运行就说我地址错误,请各位大侠帮忙解决问题谢谢..rnrnhibernate.cfg.xml配置rnrnrnrn rn rn com.mysql.jdbc.Driverrn jdbc:mysql://localhost/hibernatern rootrn rootrnrn rn 1rnrn rn org.hibernate.dialect.MySQLDialectrnrn rn rn org.hibernate.cache.internal.NoCacheProviderrnrn rn truernrn rn rnrnrnrnrn错误信息:rnERROR: No suitable driver found for jdbc:mysql://localhost/hibernaternException in thread "main" org.hibernate.exception.JDBCConnectionException: Could not open connectionrn at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)rn at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)rn at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)rn at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)rn at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)rn at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)rn at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)rn at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)rn at org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1363)rn at Test.main(Test.java:23)rnCaused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/hibernatern at java.sql.DriverManager.getConnection(DriverManager.java:602)rn at java.sql.DriverManager.getConnection(DriverManager.java:154)rn at org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:192)rn at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:278)rn at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)rn ... 5 morern
Hibernate连接Mysql报错
21:18:11,781 ERROR DriverManagerConnectionProvider:88 - JDBC Driver class not found: com.mysql.jdbc.jdbcDriverrnjava.lang.ClassNotFoundException: com.mysql.jdbc.jdbcDriverrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Class.java:169)rn at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192)rn at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:84)rn at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:137)rn at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:79)rn at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:425)rn at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:89)rn at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)rn at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115)rn at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339)rn at com.lyc.sql.LoginSQl.login(LoginSQl.java:18)rn at com.lyc.Action.LoginAction.execute(LoginAction.java:26)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)rn at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)rn at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)rn at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:142)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:166)rn at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)rn at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)rn at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)rn at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:485)rn at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)rn at java.lang.Thread.run(Thread.java:619)rn21:18:11,796 INFO DriverManagerConnectionProvider:170 - cleaning up connection pool: nullrnrn 我已经倒入驱动包 驱动包用JDBC连接数据库 无问题!rn
navicat连接mysql报错
转载请标明出处:https://blog.csdn.net/weixin_41965979/article/details/80819740 本文出自付付讶的博客 解决办法; 1:进入mysql的client-Unicode 2:输入你安装mysql时配置的密码 3:然后输入ALTER USER fu@localhost IDENTIFIED WITH mysql_native_p...
Java连接Mysql报错
Java连接Mysql报错集锦 一.错误: 1.Error:java.lang.ClassNotFoundException: com.mysql.jdbc.Driver 2.Cause:数据库连接的jar包没有正确的导入: 3.Solution: 1、没有导入包 2、导入的包的路径是不对的 就是将mysql的jar包放到你的lib目录下就可以了,可以通过build ...
druid连接mysql报错
Wed Mar 28 09:36:31 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.rn三月 28, 2018 9:36:31 上午 com.alibaba.druid.pool.DruidDataSource errorrn严重: create connection SQLException, url: jdbc:mysql://localhost:3306/blog, errorCode 1045, state 28000rnjava.sql.SQLException: Access denied for user '13760'@'localhost' (using password: YES)rn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)rn at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710)rn at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)rn at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2205)rn at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2236)rn at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2035)rn at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:790)rn at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)rn at sun.reflect.GeneratedConstructorAccessor18.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)rn at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)rn at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)rn at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1513)rn at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1578)rn at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2466)
连接远程mysql报错
10060:远程防火墙未关闭 临时关闭防火墙:serviceiptablesstop serviceip6tablesstop 永久关闭防火墙:chkconfigiptablesoff ...
qt 连接mysql报错
我用QSQLITE驱动连接mysql时,报错下面的错,但是我用terminal时候却是ok的(最下面)。rnrnnear "SHOW":syntax error Unable to execute statement.rnrn------------------------------------ 程序 ---------------------------------------rn[code=C/C++]rn QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");rnrnrn db.setHostName("incam1");rn db.setDatabaseName("film_log");rn db.setPort(3306);rn db.setUserName("foundercam");rn db.setPassword("incam1");rn if(!db.open())rn rn QMessageBox::critical(this,tr("database error"),db.lastError().text(),QMessageBox::Ok);rn return;rn rnqDebug() << db.isValid();rn qDebug() << db.database();rnrn QSqlQuery query;rn//query.exec("SELECT job_name FROM 2010ldi");rn query.exec("SHOW DATABASES");rnrn if(!query.isActive())rn rn QMessageBox::critical(this,tr("database error"),query.lastError().text(),QMessageBox::Ok);rn return;rn rnrn while(query.next())rn rn QString line = query.value(1).toString();rn qDebug() << "line" << line;rn rn[/code]--------------------------------------------------------------------------rn------------------------- terminal -------------------------------rnWelcome to the MySQL monitor. Commands end with ; or \g.rnYour MySQL connection id is 28rnServer version: 5.0.45 Source distributionrnrnCopyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.rnThis software comes with ABSOLUTELY NO WARRANTY. This is free software,rnand you are welcome to modify and redistribute it under the GPL v2 licensernrnType 'help;' or '\h' for help. Type '\c' to clear the current input statement.rnrnmysql> show databases;rn+--------------------+rn| Database |rn+--------------------+rn| information_schema |rn| film_log |rn| mysql |rn| test_db |rn+--------------------+rn4 rows in set (0.00 sec)rnrnmysql> rn
连接MySql报错
[img=https://img-bbs.csdn.net/upload/201905/15/1557908895_541693.jpg][/img]
linux 连接mysql报错
各位大侠救救我哦,搞了一天了,火大!rn报错:rn/tmp/ccKxvD8n.o(.text+0x22): In function `main':rn: undefined reference to `mysql_init'rn/tmp/ccKxvD8n.o(.text+0x6f): In function `main':rn: undefined reference to `mysql_real_connect'rn/tmp/ccKxvD8n.o(.text+0xa8): In function `main':rn: undefined reference to `mysql_close'rncollect2: ld returned 1 exit statusrn网上查了下,感觉都对的,不知道为何,我的编译命令如下rn gcc -o testMysql -lmysqlclient -lz -I /usr/include/mysql/ -L /usr/lib/mysql/ testMysql.crn用的是mysql 5.0.22 server,clent 和develrn程序是exc用户的rnmysql是root用户下的rn我将程序改成root用户的运行编译还是不行rn对应的目录均安装正确我已检查过了rn程序如下:rnrn#include rn#include rn#include rnint main(int argc,char * argv[])rn MYSQL * conn_ptr;rn conn_ptr=mysql_init(NULL);rn if(!conn_ptr)rn fprintf(stderr,"mysql_init failed\n");rn return EXIT_FAILURE;rn rn conn_ptr=mysql_real_connect(conn_ptr,"192.168.240.101","tianjin","tianjin","tjdb2",0,NULL,0);rn if(conn_ptr)rn printf("connection success\n");rn elsern printf("connection failed\n");rn rn mysql_close(conn_ptr);rn return EXIT_SUCCESS;rnrn rn rnrnrn
【mysql】连接报错
mysql运行报The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone 解决方法: 运行语句:set GLOBAL time_zone='+8:00';
web工程下连接mysql 报错!!!!!!
环境: rn MyEclipse6.0,Tomcat6.0,MySQL5.0 自己测试东西,客户端和服务端都在本机 数据库也在本机rn我的web工程发布后,页面不能操作数据库,注意是连接正常,是不能做操作。我在程序里添加了一个main方法后在控制台运行 没有任何问题。rnrn我的语句:rn         conn = DBUtil.getConnection();rnrn String sql = "select * from student";rn System.out.println(sql);rn try rn PreparedStatement pstmt = conn.prepareCall(sql);  ///////这里出错了rn // set valuesrn pstmt.setString(1, username);rn pstmt.setString(2, password);rnrn ResultSet rs = pstmt.executeQuery();rnrn // 判断rn if (rs.next()) rn login = true;rn rnrn pstmt.close();rn catch (SQLException e) rn e.printStackTrace();rn //System.out.println(e.getMessage());rn finally // set nothingrn if (conn != null) rn try rn conn.close();rn catch (SQLException e) rn e.printStackTrace();rn rn rn rnrnweb访问时报的错误是:   (如果我是查询就 报: "table.student" does not exist )rnrn   com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: FUNCTION * does not existrn at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)rn at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)rn at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)rn at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)rn at com.mysql.jdbc.Connection.execSQL(Connection.java:3118)rn at com.mysql.jdbc.Connection.execSQL(Connection.java:3047)rn at com.mysql.jdbc.Statement.executeQuery(Statement.java:1166)rn at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1269)rn at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3668)rn at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:638)rn at com.mysql.jdbc.CallableStatement.(CallableStatement.java:453)rn at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4365)rn at com.mysql.jdbc.Connection.prepareCall(Connection.java:4439)rn at com.mysql.jdbc.Connection.prepareCall(Connection.java:4413)rn at com.bobo.student.dao.StudentManager.checkUser(StudentManager.java:28)rn at com.bobo.student.web.LoginCheck.doPost(LoginCheck.java:28)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)rn at java.lang.Thread.run(Unknown Source)rnrn我在main中测试 :DBUtil.getConnection().createStatement().execute("select * from student");  rn没有任何问题!!!!所以我觉得应该不时驱动问题!! 我坛子里也逛了 好像说是什么MYSQL权限问题!!!rn
连接 mysql 报错
连接mysql报错如下:rnrnMySQLDriverCS.MySQLException: MySQLDriverCS Exception: rnMySQLDriverCS Error: can't connect.Access denied for user: 'ODBC@localhost' (Using password: NO)rnrnapp.cofig:rn[code=C#]rnrnrn rn rn rn rn rn rnrn[/code]rnrn本机使用 url 测试过localhost 和127.0.0.1 都报错。rnrn程序中的调用如下:rn[code=C#]rnstring url = System.Configuration.ConfigurationManager.AppSettings["url"];rn string database = System.Configuration.ConfigurationManager.AppSettings["database"];rn string uname = System.Configuration.ConfigurationManager.AppSettings["uname"];rn string psd = System.Configuration.ConfigurationManager.AppSettings["psd"];rnrnSqlConnection conn = new SqlConnection(@"data source= rn " + url + ";uid=" + uname + ";pwd=" + psd + ";database=" + database);rn conn.Open();rn[/code]rn
DBlinq 连接MySql 报错!
UserSystem us1 = new UserSystem();rn us1.UsID = 4;rn us1.UsName = "呵呵呵额";rn ticket.UserSystem.InsertOnSubmit(us1);rn ticket.SubmitChanges();rn rnrn这只是一个测试用的数据,但是当执行到:ticket.SubmitChanges();时 报错rnrnrn无法将类型为“MySql.Data.MySqlClient.MySqlTransaction”的对象强制转换为类型“System.Data.Common.DbTransaction”rnrn怎样解决,问题很急
JSP连接mysql报错
代码如下rn<%@ page language="java" contentType="text/html; charset=GB2312"rn pageEncoding="ISO-8859-1"%>rnrn<%@ page import="java.io.*" %>rn<%@ page import="java.util.*" %>rn<%@ page import="java.sql.DriverManager" %>rn<%@ page import="java.sql.*" %>rn<%@ page import="com.mysql.jdbc.Driver" %>rnrnrnrn rn dbaccess.jsprnrnrn<%rntryrn Connection con;rn Statement stmt;rn ResultSet rs;rn Class.forName("com.mysql.jdbc.Driver");rn DrvierManager.registerDriver(new com.mysql.jdbc.Drvier());rn String dbUrl=rn "jdbc:mysql://localhost:3306/bookdb?userUnicode=true&characterEncoding=GB2312";rn String dbUser="root";rn String dbPwd="123456";rn con = java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPwd);rn //创建一个SQL声明rn stmt = con.createStatement();rn //增加新记录rn stmt.executeUpdate("insert into BOOKS (ID,NAME,TITLE,PRICE) values('999','Tom','Tomcat Bible',44.5)");rn rn //查询记录rn rs = stmt.executeQuery("select ID,NAME,TITLE,PRICE from BOOKS");rn //输出查询结果rn out.println(" ");rn while (rs.next())rn String col1 = rs.getString(1);rn String col2 = rs.getString(2);rn String col3 = rs.getString(3);rn float col4 = rs.getFloat(4);rn //打印所显示的数据rn out.println(" "+col1+" "+col2+" "+col3+" "+col4+"");rn rn out.println("");rnrn //删除新增加的记录rn stmt.executeUpdate("delete from BOOKS where ID='999'");rnrn //关闭数据库连接rn rs.close();rn stmt.close();rn con.close();rn catch(Exception e)out.println(e.getMessage());rnrn %>rn rn rnrn运行报如下错误rnmessage Unable to compile class for JSP: rnrndescription The server encountered an internal error that prevented it from fulfilling this request.rnrnexception rnrnorg.apache.jasper.JasperException: Unable to compile class for JSP: rnrnAn error occurred at line: 22 in the jsp file: /dbaccess.jsprnDrvierManager cannot be resolvedrn19: Statement stmt;rn20: ResultSet rs;rn21: Class.forName("com.mysql.jdbc.Driver");rn22: DrvierManager.registerDriver(new com.mysql.jdbc.Drvier());rn23: String dbUrl=rn24: "jdbc:mysql://localhost:3306/bookdb?userUnicode=true&characterEncoding=GB2312";rn25: String dbUser="root";rnrnWEB-INF lib 下已经有驱动,求大神帮忙rn[img=https://img-bbs.csdn.net/upload/201608/21/1471783626_478281.jpg][/img]rn
连接mySQL报错的问题
[img=https://img-bbs.csdn.net/upload/201407/30/1406699876_135688.jpg][/img]rnrn“Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message:Access denied for user 'root'@'localhost' (using password:YES)”rnrn前提:使用的系统是xp 2002 64位,非管理员用户。rnrn这个具体是什么原因造成的?怎么解决?
MySQL Migration Toolkit免安装版
支持**数据库迁移数据到MySQL
【报错总结】Hive连接MySQL报错
Hive连接MySQL数据库时的报错及解决方案。
连接mysql报错1251解决方案
首先登陆mysql数据库,改变加密方式 mysql&gt; ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.10 sec) 更改用户密码这里以root为例 mysql&gt; ALTER USER 'root'@'localhost...
连接mysql报错#1251解决方案
真的是很激动,修改了好几天mysql与其使用工具的连接问题,终于修改成功 错误问题是本地的mysql服务加密方式有问题,在使用工具上会报错#1251的错误 修改方法: 1. 建议将之前的mysql服务删除掉,具体删除方法网上很全 2.安装好新的mysql后,cd 命令进入mysql安装的bin目录下 3.输入密码(初始化mysql会有默认密码,注意捕获) 2018-10-06T02:58:06....
java连接mysql,有时会报错!
连接MySQL数据库的类:rn[code=Java]package com.www.utils;rnrnimport java.sql.Connection;rnimport java.sql.DriverManager;rnimport java.sql.PreparedStatement;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnrnpublic final class DBUtil rn private static String dbComName;rn private static String className;rn private static String dbHost;rn private static int dbPort;rn private static String dbName;rn private static String dbUser;rn private static String dbPswd;rn private static String dbURL;rn /*****/rn static rn dbComName = "MySQL";rn className = "com.mysql.jdbc.Driver";rn dbHost = "localhost";rn dbPort = 3306;rn dbName = "test";rn dbUser = "root";rn dbPswd = "toor";rn dbURL = "jdbc:mysql://"+ dbHost +":"+ dbPort +"/"+ dbName +"?useUnicode=true&characterEncoding=utf-8";rn rn /**rn * 获取数据库连接,默认:MySQLrn * @return Connectionrn */rn public static Connection getConn()rn // System.out.println("connecting "+ dbComName +" server...");rn tryrn Class.forName(className);rn return DriverManager.getConnection(dbURL, dbUser, dbPswd);rn rn catch(ClassNotFoundException e)rn System.out.println("Error: "+ dbComName +" Database Class Not Found.");rn rn catch(Exception e)rn System.out.println("Error: connect "+ dbComName +" server.");rn e.printStackTrace();rn rn return null;rn rn /**rn * 获取其它数据库连接rn * @param db:数据库["oracle":Oracle;"db2":DB2;"sqlServer":SQL Server;else:MySQL]rn * @return Connectionrn */rn public static Connection getConn(String db) rn if ("oracle".equals(db))rn dbComName = "Oracle";rn rn else if("sqlServer".equals(db))rn dbComName = "SQL Server";rn className = "com.microsoft.sqlserver.jdbc.SQLServerDriver";rn dbHost = "localhost";rn dbPort = 1433;rn dbName = "test";rn dbUser = "sa";rn dbPswd = "as";rn dbURL = "jdbc:sqlserver://"+ dbHost +":"+ dbPort +";DatabaseName="+ dbName +"";rn rn else if("db2".equals(db))rn dbComName = "DB2";rn rn return getConn();rn rn public static void close()rn /**rn * 关闭数据库连接rn * @param conn:数据库连接 Connectionrn */rn public static void close(Connection conn)rn tryrn if(null!=conn)rn conn.close();rn catch(Exception e)rn rn /**rn * 插入数据库记录,并返回自动生成的值rn * @param sql:执行的SQL插入语句:insertrn * @return String:字符串,自动生成的值rn */rn public static String sqlInsert(String sql)rn Connection conn = getConn();rn try rn PreparedStatement pst = conn.prepareStatement(sql,Statement.RETURN_GENERATED_KEYS);rn pst.executeUpdate(sql);rn ResultSet rs = pst.getGeneratedKeys();rn if(rs.next())rn return rs.getString(1);rn catch (SQLException e) rn e.printStackTrace();rn finally rn close(conn);rn rn return null;rn rn /**rn * 更新数据库记录rn * @param sql:执行的SQL语句:insert、update、deletern * @return int:影响的记录条数rn */rn public static int sqlUpdate(String sql)rn Connection conn = getConn();rn try rn PreparedStatement pst = conn.prepareStatement(sql);rn return pst.executeUpdate();rn catch (SQLException e) rn e.printStackTrace();rn finally rn close(conn);rn rn return 0;rn rn /**rn * 查询数据库记录rn * @param sql:执行的SQL查询语句:selectrn * @return ResultSet:查询结果集rn */rn public static ResultSet sqlQuery(String sql)rn [color=#0000FF]Connection conn = getConn();[/color][color=#FF0000]//这一行有时会报错[/color]rn try rn Statement st = conn.createStatement();rn return st.executeQuery(sql);rn catch (SQLException e) rn e.printStackTrace();rn finally rn [color=#008000]// close(conn);//关闭连接后,将无法使用返回的结果集。那么,这个连接该如何关闭呢?[/color]rn rn return null;rn rn[/code]rnrn应用的例子1:rn[code=Java]package com.www.beans;rnrnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport com.www.classes.AdminUserClass;rnimport com.www.services.AdminUserService;rnimport com.www.utils.DBUtil;rnrnpublic class AdminUserBean implements AdminUserService rn @Overridern public AdminUserClass checkLogin(String userName, String userPswd) rn final String sql = "select * from admin where userName='"+ userName +"' and userPswd='"+ userPswd +"'";rn try rn ResultSet rs = DBUtil.sqlQuery(sql);rn if(rs.next())rn return getFromRs(rs);rn rs.close();rn catch (SQLException e) rn e.printStackTrace();rn rn return null;rn rn /*****/rn private AdminUserClass getFromRs(ResultSet rs) throws SQLException rn AdminUserClass auc = new AdminUserClass();rn auc.setAdminID(rs.getInt("adminID"));rn auc.setUserName(rs.getString("userName"));rn auc.setUserPswd(rs.getString("userPswd"));rn return auc;rn rn[/code]rnrn应用的例子2:rn[code=Java]package com.www.beans;rnrnimport java.sql.Connection;rnimport java.sql.ResultSet;rnimport java.sql.SQLException;rnimport java.sql.Statement;rnimport com.www.classes.AdminUserClass;rnimport com.www.services.AdminUserService;rnimport com.www.utils.DBUtil;rnrnpublic class AdminUserBean implements AdminUserService rnrn @Overridern public AdminUserClass checkLogin(String userName, String userPswd) rn final String sql = "select * from admin where userName='"+ userName +"' and userPswd='"+ userPswd +"'";rn [color=#0000FF]Connection conn = DBUtil.getConn();[/color][color=#FF0000]//这一行有时会报错[/color]rn try rn Statement st = conn.createStatement();rn ResultSet rs = st.executeQuery(sql);rn if(rs.next())rn return getFromRs(rs);rn catch (SQLException e) rn e.printStackTrace();rn finally rn DBUtil.close(conn);rn rn return null;rn rn /*****/rn private AdminUserClass getFromRs(ResultSet rs) throws SQLException rn AdminUserClass auc = new AdminUserClass();rn auc.setAdminID(rs.getInt("adminID"));rn auc.setUserName(rs.getString("userName"));rn auc.setUserPswd(rs.getString("userPswd"));rn return auc;rn rn[/code]rnrn报错的行已经使用蓝色标注,也就是连接数据库的地方,报:conn 值为Null,这个错误并不是每次都有的,但是很频繁。(本地测试时,从没出现过,上传到服务器后,就出现这个错误了。)rnrn请指点一下,问题出在哪里?多谢!
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview