jdbc连接数据库,查询成功返回数据但是还是报错java.sql.SQLException: Operation not allowed after ResultSet closed 这是怎么回事?

try {
Class.forName("com.mysql.jdbc.Driver");
String ur1="jdbc:mysql://localhost:3306/lingshi";
String username="root";
String password="root";
Connection con=DriverManager.getConnection(ur1,username,password);
Statement stmt=con.createStatement();
String sql1="select * from guogan";
ResultSet rs1=stmt.executeQuery(sql1);

    while(rs1.next()){
        String id=rs1.getString(1);
        System.out.print(id+"\t");
        String name=rs1.getString("name");
        System.out.print(name+"\t");
        String price=rs1.getString(3);
        System.out.print(price+"\t");
        String weight=rs1.getString("weight");
        System.out.print(weight+"\t");
        String birthdate=rs1.getString("birthdate");
        System.out.print(birthdate+"\t");
        String enddate=rs1.getString("enddate");
        System.out.print(enddate+"\t");
        String PD=rs1.getString("PD");
        System.out.print(PD+"\t");

        rs1.close();
        stmt.close();
        con.close();
    }
} catch (ClassNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}catch(SQLException e1){
    e1.printStackTrace();
}
我的结果如下
1   芒果干   13.00   106g    2019.12.29  2020.12.29  12months    java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)

2个回答

    rs1.close();
    stmt.close();
    con.close();

这些写在while循环后面,而不是里面

问题解决的话,请点下采纳

bigdatasyr
syr0407 谢谢您~~
大约 2 个月之前 回复

异常翻译:结果集关闭后不允许执行操作。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
jdbc连接数据库报错,求大神解决,急
jdbc连接数据库报错,测试环境连接没有问题,url username password等也没问题,但是到生产环境就是报异常,生产环境的一个web项目能正常跑,就这个java项目死活启动报错,
jdbc连接数据库,可以加载驱动,数据库内却取不到值(NullPointException)?
我用两种途径连接数据库,一种是:<br> ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572862039_634364.png)<br> 这一种应该没问题 <br><br> 但是在另一种途径遇到了以下问题:<br> ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572862594_438226.jpg)<br><br> //以下是异常信息: 第一次提问,请问还需要什么信息orz <br><br> ----------------- 换了个电脑 代码进行修改之后 项目能够正常运行了 在原来的电脑上仍有以下报错: ```java 数据库驱动加载成功! Exceptionconn java.lang.NullPointerException findall failed at javax.xml.bind.DatatypeConverter.parseHexBinary(DatatypeConverter.java:310) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4061) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3157) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:82) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3121) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7151) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2478) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2026) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1687) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1528) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:866) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:569) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677) at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228) at ch04.utils.BookUtils.getConnection(BookUtils.java:20) at ch04.dao.impl.BookDaoImpl.findByAll(BookDaoImpl.java:88) at ch04.service.impl.BookservicesImpl.findByAll(BookservicesImpl.java:38) at ch04.controller.BookAction.showall(BookAction.java:127) at ch04.controller.BookAction.doPost(BookAction.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:835) java.lang.NullPointerException at ch04.dao.impl.BookDaoImpl.findByAll(BookDaoImpl.java:92) at ch04.service.impl.BookservicesImpl.findByAll(BookservicesImpl.java:38) at ch04.controller.BookAction.showall(BookAction.java:127) at ch04.controller.BookAction.doPost(BookAction.java:46) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:835) [] ```
java连接SqlServer数据库的问题
最近在搞java,想连个SqlServer连不上,可以加载驱动,但是连不上数据库。 数据库版本为SqlServer2017 代码如下: ``` package util; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Connection; import java.sql.Statement; import java.sql.ResultSet; import java.sql.Date; public class DBManager { static int num; static Statement st=null; static ResultSet rs=null; static Connection con=null; static String url="jdbc:sqlserver://LAPTOP-LG07MEUA:1433;DataBaseName=Java_Data"; public static void exec(String s) throws SQLException { String user,passwd; user="sa"; passwd="1234567"; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); System.out.println("数据库驱动加载成功。"); } catch (ClassNotFoundException e) { e.printStackTrace(); } //就是这里,无法链接数据库 con=DriverManager.getConnection(url, user, passwd); System.out.println("10"); st=con.createStatement(); System.out.println("1"); try { if(s.startsWith("select")||s.startsWith("SELECT")) rs=st.executeQuery(s); if(s.startsWith("delete")||s.startsWith("DELETE")) num=st.executeUpdate(s); if(s.startsWith("update")||s.startsWith("UPDATE")) num=st.executeUpdate(s); if(s.startsWith("insert")||s.startsWith("INSERT")) num=st.executeUpdate(s); System.out.println("修改成功!"); } catch(Exception e) { System.out.println("进行数据库修改时失败。"); } finally { try { if(rs!=null) rs.close(); if(st!=null) st.close(); if(con!=null) con.close(); } catch(SQLException e) { e.printStackTrace(); } } } public static void main(String[] args) throws SQLException { int i=0; int[] Resultage=new int [20]; String[] Resultxh=new String [20]; String[] Resultxm=new String [20]; String[] Resultxb=new String [20]; String[] Resultzy=new String [20]; Date[] Resultdate=new Date [20]; String s="SELECT * FROM xsb"; DBManager.exec(s); System.out.println("学号"+""+"姓名"+" "+"性别"+" "+"出生日期"+" "+"专业"+" "+"年龄"); while(rs.next()) { Resultxh[i]=rs.getString("学号"); Resultxm[i]=rs.getString("姓名"); Resultxb[i]=rs.getString("性别"); Resultdate[i]=rs.getDate("出生日期"); Resultzy[i]=rs.getString("专业"); Resultage[i]=rs.getInt("年龄"); System.out.print(Resultxh[i]+" "); System.out.print(Resultxm[i]+" "); System.out.print(Resultxb[i]+" "); System.out.print(Resultdate[i]+" "); System.out.print(Resultzy[i]+" "); System.out.println(Resultage[i]); } } } 报错为: 数据库驱动加载成功。 Exception in thread "main" java.lang.NullPointerException at javax.xml.bind.DatatypeConverter.parseHexBinary(DatatypeConverter.java:310) at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:4098) at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3160) at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43) at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3123) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1981) at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459) at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773) at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at java.sql/java.sql.DriverManager.getConnection(Unknown Source) at util.DBManager.exec(DBManager.java:27) at util.DBManager.main(DBManager.java:72) ``` 求大佬帮忙解答。
jdbc连接远程的oracle数据库报错,Connection refused
通过jdbc连接远程的oracle数据库,报错连接被拒绝: java.sql.SQLRecoverableException: IO 错误: Connection refused at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at com.yzj.taf.Mytest.test(Mytest.java:36) 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:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: oracle.net.ns.NetException: Connection refused at oracle.net.ns.NSProtocol.connect(NSProtocol.java:395) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1102) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:320) ... 30 more 写的测试代码如下: public void test() { Connection conn = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@192.168.1.155:1521:orcl"; String dbUsername = "test"; String dbPassword = "test"; conn = DriverManager.getConnection(url, dbUsername, dbPassword); System.out.println("正常"); } catch (Exception e) { e.printStackTrace(); System.out.println("异常"); } finally { if (conn != null) { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } 用sqlDeverloper工具可以连接,但是写代码就不行,其他的电脑同样的开发工具和代码可以连接,求大神!!!!!
jdbc连接oracle数据库失败
各位大神,这个问题卡好久了,数据库一直连不上,不多说,直接上代码: jdbc.properties文件: ``` jdbc.driverClassName=oracle.jdbc.driver.OracleDriver jdbc.url=jdbc:oracle:thin:@192.168.1.106:1521:orcl jdbc.username=root jdbc.password=root jdbc.maxActive=50 ``` tnsnames.ora文件: ``` ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc) (PRESENTATION = RO) ) ) ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.106)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.254.209.161) ) ) ``` listener.ora文件: ``` SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = CLRExtProc) (ORACLE_HOME = D:\install\Oracle\product\11.2.0\dbhome_1) (PROGRAM = extproc) (ENVS = "EXTPROC_DLLS=ONLY:D:\install\Oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll") ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.106)(PORT = 1521)) ) ) ADR_BASE_LISTENER = D:\install\Oracle ``` 报错信息 ``` org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappedStatementStrategy' defined in file [C:\Users\Max\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\iPlat4j3\WEB-INF\classes\spring\framework\applicationContext-ibatis.xml]: Invocation of init method failed; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection) Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection) Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Io 异常: The Network Adapter could not establish the connection) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:112) at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) at org.springframework.jdbc.core.support.JdbcDaoSupport.getConnection(JdbcDaoSupport.java:119) at com.baosight.iplat4j.core.sqldao.impl.NamedSqlDaoSpringJdbcImpl.getDbConnection(NamedSqlDaoSpringJdbcImpl.java:364) at com.baosight.iplat4j.core.sqldao.impl.NamedSqlDaoDiagnoseImpl.getDbConnection(NamedSqlDaoDiagnoseImpl.java:81) at com.baosight.iplat4j.ep.MappedStatementStrategyWithPreLoadImpl.init(MappedStatementStrategyWithPreLoadImpl.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1122) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1085) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:429) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:250) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:247) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:161) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346) at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441) 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 org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851) ... 34 more ``` **_基本可以确定是数据库问题或者是配置文件问题,因为之前用过是好的,换了一个数据库就不行了,而且plsql可以正常连接数据库_**
使用Mybatis的代码生成器报错java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found.
我在使用mybatis的代码生成器生成代码的时候报错如下 : java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926) at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1093) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5488) at org.mybatis.generator.internal.db.DatabaseIntrospector.getColumns(DatabaseIntrospector.java:619) at org.mybatis.generator.internal.db.DatabaseIntrospector.introspectTables(DatabaseIntrospector.java:221) at org.mybatis.generator.config.Context.introspectTables(Context.java:653) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:257) at org.mybatis.generator.api.MyBatisGenerator.generate(MyBatisGenerator.java:139) at com.Junit.Test.test(Test.java:24) 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.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675) at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74) at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43) at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104) at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229) at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197) at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128) at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70) 这是我生成代码的测试类: package com.Junit; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.internal.DefaultShellCallback; import org.springframework.cglib.core.DefaultGeneratorStrategy; import javax.swing.*; import java.io.File; import java.util.ArrayList; import java.util.List; public class Test { @org.junit.jupiter.api.Test public void test() throws Exception { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("H:\\TestTable\\LAST\\LAST\\PageSystem\\src\\main\\resources\\generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config,callback,warnings); myBatisGenerator.generate(null); } } 这个是配置文件 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 配置全局属性 --> <settings> <!-- 使用jdbc的getGeneratedKeys获取数据库自增主键值 --> <setting name="useGeneratedKeys" value="true" /> <!-- 使用列别名替换列名 默认:true --> <setting name="useColumnLabel" value="true" /> <!-- 开启驼峰命名转换:Table{create_time} -> Entity{createTime} --> <setting name="mapUnderscoreToCamelCase" value="true" /> </settings> <typeAliases> <package name="com.pojo"></package> </typeAliases> <!--<property name="mapperLocations" value="classpath:mapper/*"></property>--> <!--<mappers>--> <!--<mappers>--> <!--<mapper resource="mapper/GetTableDaoMapper.xml"/>--> <!--</mappers>--> <!--</mappers>--> </configuration> 今天学习mybatis想使用代码生成器生成代码,但是一直报这个错,网上也找了一些相关的错误,但是都没能解决问题,这里大神云集,希望问题能被解决,多谢。
JDBC连接数据库内存溢出问题
我用JDBC连接Access数据库时,执行到DriverManager.getConnection时就会报错:java.lang.OutOfMemoryError: GC overhead limit exc ``` public static Connection getConnection(String file){ Connection con=null; String url="jdbc:ucanaccess://"+file; try { Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"); con=DriverManager.getConnection(url);//此处报错 } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } System.out.println("getConnection结束"); return con; } ``` 如果是小的Access文件不会报错,试了个1.2G的就会出现这种情况
jdbc连接数据库连不上
导包 ojdbc6.jar jdk 1.7.0_0.09 oracle版本 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options //jdbc类 public class jdbc { public static void main(String[]args){ Connection conn=null; Statement state=null; try { Class.forName("oracle.jdbc.OracleDriver"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("11"); } try { conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","QMXC_PROJECT","qmxc"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("22"); } try { state=conn.createStatement(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("33"); } try { state.execute("insert into wen values (1,'wen','12','nan'"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); System.out.println("sql语句错误"); } } } //报错 java.sql.SQLException: Undefined Error at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) at java.sql.DriverManager.getConnection(DriverManager.java:579) at java.sql.DriverManager.getConnection(DriverManager.java:221) at jdbc.main(jdbc.java:21) Caused by: oracle.net.ns.NetException: Undefined Error at oracle.net.ns.NSProtocol.connect(NSProtocol.java:385) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301) ... 7 more
javaweb,使用jdbc连接别人的ORACLE数据库,报错Undefined Error
同样的代码,其他人都可以连上,,,但是我会报错。。 错误日志: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: IO 错误: Undefined Error at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:545) at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:537) at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:116) at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72) at com.zf.dbpool.ConnectionManager.connection(ConnectionManager.java:99) at com.zf.dbpool.ConnectionManager.init(ConnectionManager.java:59) at com.zf.statistics.service.impl.StatisticsServiceImpl.saveSzdwXyData(StatisticsServiceImpl.java:67) at com.zf.statistics.service.impl.StatisticsServiceImpl.main(StatisticsServiceImpl.java:209) Caused by: java.sql.SQLRecoverableException: IO 错误: Undefined Error at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:774) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:123) at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:375) at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:204) at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:445) at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:516) ... 6 more Caused by: oracle.net.ns.NetException: Undefined Error at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:271) at oracle.net.ns.NSProtocol.connect(NSProtocol.java:317) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1438) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:518)
JAVA JDBC数据库连接报错,求大神解决
``` package com.es.CH30_jdbc; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class GetXt16 { public void insert(String name, int age, String brithday, String gender, int math, int chinese, int english) { Connection connection=null; //Statement st=null; PreparedStatement pst=null; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql:///test", "root", "123456"); // st = connection.createStatement(); // String sql = "insert into xt16 values (null,'" + name + "','" + age // + "','" + brithday + "','" + gender + "','" + math + "','" // + chinese + "','" + english + "')"; // int i = st.executeUpdate(sql); String sql="insert into xt16 values(?,?,?,?,?,?,?,?)"; pst=connection.prepareStatement(sql); pst.setString(1, null); pst.setString(2,name); pst.setInt(3,age); pst.setString(4, brithday); pst.setString(5, gender); pst.setInt(6, math); pst.setInt(7, chinese); pst.setInt(8, english); int i = pst.executeUpdate(); if(i>0){ System.out.println("添加成功"); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }finally{ try { connection.close(); pst.close(); //st.close(); } catch (SQLException e) { e.printStackTrace(); } } } public void update(String name, int id){ Connection connection = null; PreparedStatement pst = null; try { //加载驱动 Class.forName("com.mysql.jdbc.Driver"); //连接数据库 connection = DriverManager.getConnection("jdbc:mysql:///test", "root", "123456"); //创建prepareStatement对象,进行sql预编译 String sql="update xt16 set name=? where id=?"; pst = connection.prepareStatement(sql); pst.setString(1, name); pst.setInt(2, id); int i = pst.executeUpdate(); if(i > 0){ System.out.println("更新成功"); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }finally{ try { pst.close(); connection.close(); } catch (SQLException e) { e.printStackTrace(); } } } public static void main(String[] args) { GetXt16 gx = new GetXt16(); //gx.xt16(); //gx.insert("baby", 33, "1976-10-22", "女",67, 87, 56); gx.update("周杰伦", 2); } } ``` 警告: Thu Aug 11 16:01:55 CST 2016 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. 换成jdbc:mysql:///test?autoReconnect=true&useSSL=false"后警告没了,但是update SQL还是没被执行。但是insert语句能被执行。 JDBC和mysql都是官网的最新版本
maven新项目连接数据库报错
http://blog.csdn.net/evankaka/article/details/48785513?spm=5176.100239.blogcont28591.10.Ig4ZU0,照着这个播客,新建了个maven项目 做到第四步单元测试时 运行selectUserByIdTest方法报错 java.sql.SQLException: Access denied for user 'root '@'localhost' (using password: YES) 显示连接数据库报错,但是我在这里新建了个jdbc.java测试类,专门用来连接数据库,确是可以连上数据库的,请问一下有可能是什么原因造成的
java连接MYSQL数据库第一次可以,第二次报错
做项目在做一个用户首次登陆输入手机号码,发送随机密码的功能模块,首次点击完全没问题,系统会发送短信(中国移动的短信机的原理是连接它的数据库,插入一条数据即可)问题就出在连接数据库的问题上,再次发送,则后台报错ResultSet is from UPDATE. No Data.。 报错信息如下 ``` 严重: Exception occurred during processing request: ResultSet is from UPDATE. No Data. java.sql.SQLException: ResultSet is from UPDATE. No Data. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927) at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7152) at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3867) at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3404) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2385) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2154) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:792) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:381) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:305) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at DAO.dbconnection2.<init>(dbconnection2.java:16) at action.testsendaction.execute(testsendaction.java:38) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ``` dbconnection2.java 是创建连接,代码如下: ``` package DAO; import java.sql.Connection; import java.sql.DriverManager; public class dbconnection2 { private static final String DRIVER = "com.mysql.jdbc.Driver"; private static final String URL = "jdbc:mysql://*******:3306/mas?useUnicode=true&characterEncoding=gb2312"; private static final String USER = "ywz"; private static final String PASSWORD = "yw690"; private Connection con; public dbconnection2() throws Exception{ Class.forName(DRIVER); this.con = DriverManager.getConnection(URL, USER, PASSWORD); } public Connection getConnection() { return this.con; } public void closecon() throws Exception { if(this.con != null) { try { this.con.close(); } catch(Exception e) { throw e; } } } } ``` action代码: ``` public class testsendaction extends ActionSupport{ private String list; public String getList() { return list; } public void setList(String list) { this.list = list; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } private String content; public String execute() throws Exception{ dbconnection2 dbc2 = new dbconnection2(); Statement s1 = dbc2.getConnection().createStatement(); Random ran = new Random(); String pwd = ""; for(int i=0;i<6;i++) { pwd += ran.nextInt(10)+""; } System.out.println("ranpwd="+pwd); String mess = "本信息来自工资查询系统,用于用户的首次登陆,登陆密码为:"+pwd+" ,登陆成功后,请自行修改密码。"; String send = "insert into api_mt_6(mobiles,content) values('"+list+"','"+mess+"')"; s1.executeUpdate(send); System.out.println("send:"+send); s1.close(); dbc2.closecon(); return SUCCESS; } } ``` 报错是在数据库连接的new语句上。 连接最后也有关闭。但是就是不能进行二次访问数据库。只能重启下tomcat,然后又可以登录一次,第二次也无法连接了。 找了好久都没发现原因,希望大家帮帮忙 ,谢谢了!
练习servlet监听器的时候,使用jdbc连接数据库,总是报错,各位老师,我该怎么解决
数据库连接除了问题,却不知道具体哪里的问题 监听器部分的代码 ``` package com.zh.listener; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; import javax.servlet.annotation.WebListener; @WebListener public class MyListener implements ServletContextListener { public void contextInitialized(ServletContextEvent event) { String jdbcDriver = "com.mysql.jdbc.Driver"; String dbURL = "jdbc:mysql://127.0.0.1/test"; String dbUser = "root"; String password = "root"; try { Class.forName(jdbcDriver); Connection connection = DriverManager. getConnection(dbURL, dbUser, password); ServletContext servletContext = event.getServletContext(); servletContext.setAttribute("mycon", connection); } catch (Exception e) { e.printStackTrace(); } } public void contextDestroyed(ServletContextEvent arg0) { // TODO Auto-generated method stub System.out.println("Servlet has contextDestroyed..."); } } ``` servlet部分的代码 ``` package com.zh.servlet; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class GetDataServlet extends HttpServlet{ /** * */ private static final long serialVersionUID = 1L; @Override![图片说明](https://img-ask.csdn.net/upload/201906/19/1560915422_774394.png) protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setCharacterEncoding("UTF-8"); resp.setContentType("text/html;charset=UTF-8"); PrintWriter out = resp.getWriter(); try { ServletContext servletContext = getServletContext(); Connection con = (Connection)servletContext. getAttribute("mycon"); if (con==null) { System.out.println("数据库连接异常"); } String sql = "select * from emplpyees"; PreparedStatement statement = con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet resultSet = statement.executeQuery(); while (resultSet.next()) { out.print("<br>"+resultSet.getString(0) +" "+resultSet.getString(1) +" "+resultSet.getString(2)); } con.close(); } catch (Exception e) { e.printStackTrace(); } out.close(); } } ``` web.xml部分代码 ``` <servlet> <servlet-name>getDataServlet</servlet-name> <servlet-class>com.zh.servlet.GetDataServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>getDataServlet</servlet-name> <url-pattern>/getDataServlet</url-pattern> </servlet-mapping> ``` ![图片说明](https://img-ask.csdn.net/upload/201906/19/1560915453_417958.png) 错误信息 ``` 2019-06-19 11:20:53.657:INFO:oejs.Server:jetty-8.1.14.v20131031 2019-06-19 11:20:54.041:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 数据库连接异常 java.lang.NullPointerException at com.zh.servlet.GetDataServlet.doGet(GetDataServlet.java:34) at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) at org.eclipse.jetty.server.Server.handle(Server.java:370) at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971) at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) at java.lang.Thread.run(Thread.java:745) ``` 数据库账号密码都是root 这个我试过了 没有错 求助各位大神了 帮帮忙!!!
数据库连接不上,一直报错
各位哥哥姐姐,能帮我一下吗?我java数据库连接不上。 我的是mysql 5.0 java 4.2 数据库是5.1.36 网上说把jar包放在lib,我不知道放哪里? 希望各位能指教一下我新手。谢谢·急!! package denglu; import gongyong.DaoConn; import gongyong.SaveUserInfo; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import com.mysql.jdbc.Connection; import com.mysql.jdbc.ResultSet; import com.mysql.jdbc.Statement; public class loginchuankou extends JFrame{ public DaoConn daoconn=new DaoConn(); private JButton guanbi=new JButton("退出"); private JButton Queding=new JButton("登录"); private JPasswordField mimakuang=new JPasswordField(20); private JTextField yonghumingkuang=new JTextField(20); private JLabel yonghubiaoqian=new JLabel(); private JLabel mimabiaoqian=new JLabel(); public loginchuankou(){ setTitle("系统登录"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(200,200,300,180); // setResizable(false); JPanel dengluchuan=new JPanel(); getContentPane().add(dengluchuan,BorderLayout.CENTER); setVisible(true); yonghubiaoqian.setText("用户名"); dengluchuan.add(yonghubiaoqian); dengluchuan.add(yonghumingkuang); dengluchuan.add(Queding); mimabiaoqian.setText("密码"); dengluchuan.add(mimabiaoqian); dengluchuan.add(yonghumingkuang); dengluchuan.add(mimakuang); dengluchuan.add(guanbi); //键盘 guanbi.addMouseListener(new MouseAdapter(){ public void mouseClicked(final MouseEvent e){ System.exit(0); } }); Queding.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent evt) { Queding(evt); } }); ///// } protected void Queding(ActionEvent evt) { Connection conn = null; //???? Statement st = null; ResultSet rs = null; try { conn =(Connection) daoconn.getConn(); st = (Statement) conn.createStatement(); String user=yonghumingkuang.getText().trim(); String pw=new String(mimakuang.getPassword()).trim(); String sql=" select * from user where username='"+ user + "' and password= '"+ pw + "' "; rs=(ResultSet) st.executeQuery(sql); if(rs.next() && rs.getString("username")!=null){ SaveUserInfo.setuserName(user); SaveUserInfo.setpassword(pw); System.out.print("成功"); }else{ System.out.print("失败"); } } catch (Exception e) { e.printStackTrace(); }finally{ } }//Queding }//gouzao 报错如下: java.lang.ClassNotFoundException: com.mysql.jdbc.Drive at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:195) at gongyong.DaoConn.getConn(DaoConn.java:8) at denglu.loginchuankou.Queding(loginchuankou.java:105) at denglu.loginchuankou$2.actionPerformed(loginchuankou.java:89) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6516) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) at java.awt.Component.processEvent(Component.java:6281) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4872) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:747) at java.awt.EventQueue.access$300(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:706) at java.awt.EventQueue$3.run(EventQueue.java:704) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) at java.awt.EventQueue$4.run(EventQueue.java:720) at java.awt.EventQueue$4.run(EventQueue.java:718) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:717) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
BoneCP 数据库连接池连接报错
请教 Bonecp 连接池经常报 [com.jolbox.bonecp.ConnectionHandle(229)] [ERROR] Failed to acquire connection. Sleeping for 7000ms. Attempts left: 5 java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:387) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414) 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 java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256) at com.jolbox.bonecp.ConnectionHandle.obtainInternalConnection(ConnectionHandle.java:211) at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:170) at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:101) at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) [com.jolbox.bonecp.ConnectionHandle(215)] [INFO ] Successfully re-established connection to DB
JDBC连接不到Mysql数据库
使用JDBC的方法连接不上MySQL,想自己做个练习,然后就出现了一下的错误,希望各位哥哥姐姐帮忙看下!谢谢 Connection connection = null; PreparedStatement preparedStatement = null; ResultSet resultSet = null; try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf-8", "root", "user_xin"); } catch (Exception e) { e.printStackTrace(); if (resultSet != null) { try { resultSet.close(); } catch (SQLException e1) { e1.printStackTrace(); } } if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e1) { e1.printStackTrace(); } } if (connection != null) try { connection.close(); } catch (SQLException e1) { e1.printStackTrace(); } } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { e.printStackTrace(); } } if (preparedStatement != null) { try { preparedStatement.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connection != null) try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } 报错如下 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'mybatis' at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:911) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3953) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1276) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2048) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:723) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at cn.itcast.mybatis.Test.main(Test.java:17)
mysql 5.6 版本的程序跑mysql 8.0 报错如下 ,数据库可以正常连接,连接数据库的驱动等相关jar 也换成了mysql8.0对应版本还是报如下错误
[http-nio-8085-exec-3] INFO com.gdk.jdbc.connection.ConnectionPoolManager - ***** Add ConnectionPoolShutdownHook to JVM hook ***** [MLog-Init-Reporter] INFO com.mchange.v2.log.MLog - MLog clients using slf4j logging. [http-nio-8085-exec-3] INFO com.mchange.v2.c3p0.C3P0Registry - Initializing c3p0-0.9.5 [built 02-January-2015 13:25:04 -0500; debug? true; trace: 10] [http-nio-8085-exec-3] WARN com.mchange.v2.c3p0.cfg.C3P0Config - named-config with name 'mysql' does not exist. Using default-config. [http-nio-8085-exec-3] WARN com.mchange.v2.c3p0.cfg.C3P0Config - named-config with name 'mysql' does not exist. Using default-config extensions. [http-nio-8085-exec-3] INFO com.gdk.jdbc.connection.c3p0.C3P0ConnectionProvider - >>>>>> C3P0ConnectionProvider startup initing with configuration: {"file":"/E:/tomcat/webapps/huajiu/WEB-INF/classes/datasource.xml","id":"mysql.1509899288","name":"mysql","driverClass":"com.mysql.cj.jdbc.Driver","driverUrl":"jdbc:mysql://47.XXX.XXX.229:3306/huajiu?useSSL=true","user":"root","password":"******","connectionProvider":"com.gdk.jdbc.connection.c3p0.C3P0ConnectionProvider","dialect":"com.gdk.jdbc.dialect.MySQLDialect","maxConnectionSize":10,"minConnectionSize":1,"initConnectionSize":1,"availableConnectionSize":1,"acquireIncrementSize":1,"maxConnectionIdletime":3600,"maxConnectionLifetime":14400,"acquireRetryAttempts":30,"acquireRetryDelay":2000,"idleConnectionTestPeriod":3600,"testConnectionCheckout":false,"testConnectionCheckin":false,"connectionTimeout":5000,"showSQL":false,"loadOnStartup":true,"monitorEnable":false,"weight":1,"_xaDataSourceClass":"com.mysql.jdbc.jdbc2.optional.MysqlXADataSource","customize":{}} [http-nio-8085-exec-3] INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 2000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 5000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, contextClassLoaderSource -> caller, dataSourceName -> mysql.1509899288, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.cj.jdbc.Driver, extensions -> {}, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, forceUseNamedDriverClass -> false, identityToken -> 1hgf2m9a61o8yo2f6gh111|79cc61a8, idleConnectionTestPeriod -> 3600, initialPoolSize -> 1, jdbcUrl -> jdbc:mysql://47.XXX.XXX.229:3306/huajiu?useSSL=true, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 14400, maxIdleTime -> 3600, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, numHelperThreads -> 1, preferredTestQuery -> null, privilegeSpawnedThreads -> false, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ] com.gdk.jdbc.connection.ConnectFailedException: Can not get a Master Connection from datasource<mysql>! at com.gdk.jdbc.connection.ConnectionPoolManager.getMasterConnection(ConnectionPoolManager.java:188) at com.gdk.jdbc.JdbcHandlerImpl.getMasterConnection(JdbcHandlerImpl.java:1780) at com.gdk.jdbc.JdbcHandlerImpl.getConnection(JdbcHandlerImpl.java:1767) at com.gdk.jdbc.JdbcHandlerImpl.queryForList(JdbcHandlerImpl.java:1156) at com.gdk.jdbc.JdbcHandlerImpl.queryForList(JdbcHandlerImpl.java:1138) at com.qshl.aqb.sys.dao.PlatformDao.getUserByUname(PlatformDao.java:21) at com.qshl.aqb.sys.service.impl.PlatformServiceImpl.login(PlatformServiceImpl.java:26) at com.qshl.aqb.sys.controller.PlatformController.unameLogin(PlatformController.java:51) 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:497) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1156) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@1c2032db -- timeout at awaitAvailable() at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1461) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:639) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:549) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:756) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:683) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140) at com.gdk.jdbc.connection.c3p0.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:230) at com.gdk.jdbc.connection.ConnectionPoolManager.getMasterConnection(ConnectionPoolManager.java:177) ... 49 more
java web jdbc oci 方式连接oracle报错UnsatisfiedLinkError
环境为AIX Version 5.3! sqlplus sqlldr 可用, java web jdbc oci 方式连接数据库不成功 Connection conn = null; Statement stmt = null; ResultSet rs = null; try { Class.forName("oracle.jdbc.OracleDriver"); conn = DriverManager.getConnection("jdbc:oracle:oci:@bbs", "user", "password"); stmt = conn.createStatement(); rs = stmt.executeQuery("select name from abc"); while (rs.next()) { String s = rs.getString(1); System.out.println(s); } } catch (Exception e) { e.printStackTrace(); } System.out.println(System.getProperties().get("java.library.path"));输出:/oracle11/app/oracle/11.2.0/lib windows上测试成功: -Djava.library.path=E:\oracle\product\10.2.0\client_1\BIN 报错信息 INFO: Server startup in 1286 ms Exception in thread "Timer-0" java.lang.UnsatisfiedLinkError: ocijdbc11 (A file or directory in the path name does not exist.) at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:986) at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:950) at java.lang.System.loadLibrary(System.java:453) at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3516) at java.security.AccessController.doPrivileged(AccessController.java:197) at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3512) at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:266) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536) at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:162) at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at java.sql.DriverManager.getConnection(DriverManager.java:572) at java.sql.DriverManager.getConnection(DriverManager.java:196) at com.gmail.wangchengyong2009.db.OracleETL.getQueryColumnName(OracleETL.java:374)
有个jdbc连接数据库的问题望大家帮一下忙
我是根据教程利用odbc做驱动通过jdbc连接sqlserver2008数据库的,数据表已经建立好,odbc加载驱动是成功的,数据库也连接上了,编写的java代码也没有报错,但是就是不能正常运行添加数据,提示是空异常,纠结了好久没能解决,所以在此拜托各位帮个忙解决一下。在此,表示感谢。以下是代码: 用户类 package odbc; public class User { private int id; private String userName; private String passWord; private int roleId; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassWord() { return passWord; } public void setPassWord(String passWord) { this.passWord = passWord; } public int getRoleId() { return roleId; } public void setRoleId(int roleId) { this.roleId = roleId; } public User(){ } public User(int id, String userName, String passWord, int roleId) { super(); this.id = id; this.userName = userName; this.passWord = passWord; this.roleId = roleId; } @Override public String toString() { return "User [id=" + id + ", userName=" + userName + ", passWord=" + passWord + ", roleId=" + roleId + "]"; } } main主函数 package odbc; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class demo01 { private Connection conn; private Statement stat; public static void main(String[] args) { new demo01().startup(); } private void startup(){ init(); //添加一个用户 User user = new User(1, "zhang", "111", 1); addUser(user); } private void addUser(User user) { String sql = String.format("insert into T_User values('%s','%s',%s)", user.getUserName(), user.getPassWord(), user.getRoleId()); try { stat = conn.createStatement(); int result = stat.executeUpdate(sql); if (result > 0) { System.out.println("添加用户成功!"); } else { System.out.println("添加用户失败!"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { stat.close(); conn.close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } private void init(){ try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); System.out.println("加载驱动成功"); //该语句冒号前面是固定的,冒号后面是自己定义的数据源 String url = "jdbc:odbc:bookshopsource"; Connection conn = DriverManager.getConnection(url); System.out.println("数据库连接成功"); } catch (ClassNotFoundException e) { System.out.println("加载驱动失败"); return; }catch (SQLException e) { System.out.println("数据库连接失败"); return; } } } ![图片说明](https://img-ask.csdn.net/upload/201606/03/1464924595_809555.png)
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式和人才交流群,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸...
8年经验面试官详解 Java 面试秘诀
作者 |胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。 Java程序员准备和投递简历的实...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
MyBatis研习录(01)——MyBatis概述与入门
MyBatis 是一款优秀的持久层框架,它支持定制化 SQL、存储过程以及高级映射。MyBatis原本是apache的一个开源项目iBatis, 2010年该项目由apache software foundation 迁移到了google code并改名为MyBatis 。2013年11月MyBatis又迁移到Github。
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
Python爬虫精简步骤1 获取数据
爬虫,从本质上来说,就是利用程序在网上拿到对我们有价值的数据。 爬虫能做很多事,能做商业分析,也能做生活助手,比如:分析北京近两年二手房成交均价是多少?广州的Python工程师平均薪资是多少?北京哪家餐厅粤菜最好吃?等等。 这是个人利用爬虫所做到的事情,而公司,同样可以利用爬虫来实现巨大的商业价值。比如你所熟悉的搜索引擎——百度和谷歌,它们的核心技术之一也是爬虫,而且是超级爬虫。 从搜索巨头到人工...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
web前端javascript+jquery知识点总结
1.Javascript 语法.用途 javascript 在前端网页中占有非常重要的地位,可以用于验证表单,制作特效等功能,它是一种描述语言,也是一种基于对象(Object)和事件驱动并具有安全性的脚本语言 ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
渗透测试-灰鸽子远控木马
木马概述 灰鸽子( Huigezi),原本该软件适用于公司和家庭管理,其功能十分强大,不但能监视摄像头、键盘记录、监控桌面、文件操作等。还提供了黑客专用功能,如:伪装系统图标、随意更换启动项名称和表述、随意更换端口、运行后自删除、毫无提示安装等,并采用反弹链接这种缺陷设计,使得使用者拥有最高权限,一经破解即无法控制。最终导致被黑客恶意使用。原作者的灰鸽子被定义为是一款集多种控制方式于一体的木马程序...
Python:爬取疫情每日数据
前言 目前每天各大平台,如腾讯、今日头条都会更新疫情每日数据,他们的数据源都是一样的,主要都是通过各地的卫健委官网通报。 以全国、湖北和上海为例,分别为以下三个网站: 国家卫健委官网:http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml 湖北卫健委官网:http://wjw.hubei.gov.cn/bmdt/ztzl/fkxxgzbdgrfyyq/xxfb...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名...
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允许使用这...
作为程序员的我,大学四年一直自学,全靠这些实用工具和学习网站!
我本人因为高中沉迷于爱情,导致学业荒废,后来高考,毫无疑问进入了一所普普通通的大学,实在惭愧???? 我又是那么好强,现在学历不行,没办法改变的事情了,所以,进入大学开始,我就下定决心,一定要让自己掌握更多的技能,尤其选择了计算机这个行业,一定要多学习技术。 在进入大学学习不久后,我就认清了一个现实:我这个大学的整体教学质量和学习风气,真的一言难尽,懂的人自然知道怎么回事? 怎么办?我该如何更好的提升自...
粒子群算法求解物流配送路线问题(python)
1.Matlab实现粒子群算法的程序代码:https://www.cnblogs.com/kexinxin/p/9858664.html matlab代码求解函数最优值:https://blog.csdn.net/zyqblog/article/details/80829043 讲解通俗易懂,有数学实例的博文:https://blog.csdn.net/daaikuaichuan/article/...
教你如何编写第一个简单的爬虫
很多人知道爬虫,也很想利用爬虫去爬取自己想要的数据,那么爬虫到底怎么用呢?今天就教大家编写一个简单的爬虫。 下面以爬取笔者的个人博客网站为例获取第一篇文章的标题名称,教大家学会一个简单的爬虫。 第一步:获取页面 #!/usr/bin/python # coding: utf-8 import requests #引入包requests link = "http://www.santostang....
前端JS初级面试题二 (。•ˇ‸ˇ•。)老铁们!快来瞧瞧自己都会了么
1. 传统事件绑定和符合W3C标准的事件绑定有什么区别? 传统事件绑定 &lt;div onclick=""&gt;123&lt;/div&gt; div1.onclick = function(){}; &lt;button onmouseover=""&gt;&lt;/button&gt; 注意: 如果给同一个元素绑定了两次或多次相同类型的事件,那么后面的绑定会覆盖前面的绑定 (不支持DOM事...
相关热词 c#导入fbx c#中屏蔽键盘某个键 c#正态概率密度 c#和数据库登陆界面设计 c# 高斯消去法 c# codedom c#读取cad文件文本 c# 控制全局鼠标移动 c# temp 目录 bytes初始化 c#
立即提问

相似问题

2
Spring boot 2.1.3启动报错 java.lang.NoClassDefFoundError: org/springframework/util/unit/DataSize
3
jdbc连接远程的oracle数据库报错,Connection refused
3
hibernate+struts连接数据库报错WARN: SQL Error: 102, SQLState: S0001怎么解决?
1
练习servlet监听器的时候,使用jdbc连接数据库,总是报错,各位老师,我该怎么解决
2
使用Mybatis的代码生成器报错java.sql.SQLException: Column 'IS_GENERATEDCOLUMN' not found.
3
使用jdbc链接sqlserver 2008出现Could not get JDBC Connection,项目可以启动,但不能访问数据库
2
java代码连接odbc数据库出现报错
2
jdbc无法连接MySQL数据库
1
运行esclipse的Java程序向Oracel数据库更新数据,运行后报错
1
hive初始化数据库报错
2
数据库登录报错,求解决,急等!
2
救急,SpringMVC非Controller类中使用任务列队操作service无法连接数据库?
1
jdbc连接数据库,可以加载驱动,数据库内却取不到值(NullPointException)?
2
在线等!!!linux服务器连接mysql5.7数据库报错 Could not get JDBC Connection; nested exception is com.alibaba.druid.pool.GetConnectionTimeoutException
4
java连接数据库返回数据为空
6
ssm数据库连接失败,找了几天没有用,有大佬吗?Error querying database. Could not。。。
2
封装连接数据库的代码。
3
jsp连接数据库过程中出现SQL异常!,mysql和Tomcat也确认启动了,但还是一直报错!
1
mysql 5.6 版本的程序跑mysql 8.0 报错如下 ,数据库可以正常连接,连接数据库的驱动等相关jar 也换成了mysql8.0对应版本还是报如下错误
2
java连接SqlServer数据库的问题