java.sql.SQLException: No database selected

Stack Overflow | Artem Radzivon | 8 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    JPA:- java.sql.SQLException : No database selected Error Code: 1046

    Coderanch | 9 years ago | shyam shridhar
    java.sql.SQLException: No database selected Error Code: 1046 Call: SELECT ID, COSTCENTRE, DEPARTMENT, VPBALANCE, UDF1, PASSWORD, UDF2, SURNAME, UDF3, ACCOUNTCLOSED, UDF4, EMPLOYEENUMBER, UDF5, TELEPHONE2, UDF6, DATEREGISTERED, FIRSTNAME, DATELASTACCESSED, SALUTATION, FORCEPASSWORD, EMAIL, CUSTOMERKEY, EMAILPERMISSION, DATEOFBIRTH, USERNAME, TELEPHONE, CLIENT_ID FROM ACCOUNTS WHERE (((USERNAME = ?) AND (PASSWORD = ?)) AND (ACCOUNTCLOSED = ?)) bind => [13499, wS4B8qE/9Vh+Hp5K7bgkLQ==, false] Query: ReportQuery(com.synapticresearch.core.entity.AccountEntity)
  2. 0

    CMP Entity Beans and MySQL

    Google Groups | 1 decade ago | Lukasz Szelag
    java.sql.SQLException: Syntax error or access violation, message from server: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '"ID", q1."RATING", q1."COMMENT1", q1."DATE1", q1."GUESTBOOK"
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    java.sql.SQLException: No value specified for parameter 1解决办法_IT知识问答_希赛网

    educity.cn | 2 years ago
    java.sql.SQLException: No value specified for parameter 1 代码如下 public boolean login(UserInfo user)throws Exception{ //用户登录 boolean flag=false; int userNo=Integer.parseInt(user.getUserNo()); String password=user.getPassword(); //测试是否从现在的user对象中取到了值 System.out.println(userNo+"我是USER对象的userNo"); System.out.println(password+"我是USER对象的password"); DatabaseConnection dbc=new DatabaseConnection();//取得数据库连接和关闭对象; try{ String sql="SELECT userNo FROM userInfo where userNo= and password= "; this.conn=dbc.getConnection(); this.pst=conn.prepareStatement(sql); //this.pst.setInt(1, userNo);//给sql中参数赋值 this.pst.setLong(1, userNo); this.pst.setString(2, password); ResultSet rs=pst.executeQuery(); if(rs.next()){//传入用户账号和对应的密码都存在时为真 flag=true; System.out.println(rs.getString(userNo)+"我是从数据库里取出来的"); System.out.print(flag+"测试flag");//测试flag,看是否进入了if里面,true则进入了 rs.close(); } }catch(Exception e){ e.printStackTrace(); }finally{ if(this.pst!=null){ this.pst.close(); } this.conn.close(); } return flag; } 报的错误信息如:
  5. 0

    java.sql.SQLException: No suitable driver - Toolbox for IT Groups

    ittoolbox.com | 9 months ago
    java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager .java:545) at java.sql.DriverManager.getConnection(DriverManager .java:171) at com.stc.sql.framework.jdbc.DBConnectionFactory.cre ateConnection(DBConnectionFactory.java:372) at com.stc.sql.framework.jdbc.DBConnectionFactory.get Connection(DBConnectionFactory.java:281) at com.stc.etl.engine.impl.SimpleTask.getConnection(S impleTask.java:254) at com.stc.etl.engine.impl.Extractor.getSelectData(Ex tractor.java:376) at com.stc.etl.engine.impl.Extractor.process(Extracto r.java:190) at com.stc.etl.engine.impl.ETLTaskThread.run(ETLTaskT hread.java:147)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.sql.SQLException

      No database selected

      at com.mysql.jdbc.SQLError.createSQLException()
    2. MySQL jdbc
      PreparedStatementWrapper.executeQuery
      1. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
      2. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
      3. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
      4. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
      5. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
      6. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
      7. com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
      8. com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
      9. com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:530)
      9 frames
    3. Embedded GlassFish Web
      PreparedStatementWrapper40.executeQuery
      1. com.sun.gjc.spi.jdbc40.PreparedStatementWrapper40.executeQuery(PreparedStatementWrapper40.java:642)
      1 frame
    4. Hibernate
      CriteriaImpl.list
      1. org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
      2. org.hibernate.loader.Loader.getResultSet(Loader.java:2123)
      3. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1911)
      4. org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1887)
      5. org.hibernate.loader.Loader.doQuery(Loader.java:932)
      6. org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:349)
      7. org.hibernate.loader.Loader.doList(Loader.java:2615)
      8. org.hibernate.loader.Loader.doList(Loader.java:2598)
      9. org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2430)
      10. org.hibernate.loader.Loader.list(Loader.java:2425)
      11. org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
      12. org.hibernate.internal.SessionImpl.list(SessionImpl.java:1863)
      13. org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:365)
      13 frames
    5. com.sombra.test
      BookDAOImpl.getBooks
      1. com.sombra.test.training.dao.impl.BookDAOImpl.getBooks(BookDAOImpl.java:30)
      1 frame
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    7. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      3 frames
    8. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
      3 frames
    9. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
      2 frames
    10. com.sun.proxy
      $Proxy280.getBooks
      1. com.sun.proxy.$Proxy280.getBooks(Unknown Source)
      1 frame
    11. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:497)
      4 frames
    12. Spring Expression Language (SpEL)
      SpelExpression.getValue
      1. org.springframework.expression.spel.support.ReflectivePropertyAccessor$OptimalPropertyAccessor.read(ReflectivePropertyAccessor.java:628)
      2. org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:213)
      3. org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:93)
      4. org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:46)
      5. org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:372)
      6. org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
      7. org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
      8. org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
      8 frames
    13. Spring Binding
      SpringELExpression.getValue
      1. org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
      1 frame
    14. Spring Web Flow
      FlowHandlerAdapter.handle
      1. org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
      2. org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
      3. org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
      4. org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
      5. org.springframework.webflow.engine.ActionList.execute(ActionList.java:154)
      6. org.springframework.webflow.engine.ViewState.render(ViewState.java:291)
      7. org.springframework.webflow.engine.ViewState.refresh(ViewState.java:242)
      8. org.springframework.webflow.engine.ViewState.resume(ViewState.java:220)
      9. org.springframework.webflow.engine.Flow.resume(Flow.java:537)
      10. org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:259)
      11. org.springframework.webflow.executor.FlowExecutorImpl.resumeExecution(FlowExecutorImpl.java:169)
      12. org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(FlowHandlerAdapter.java:228)
      12 frames
    15. org.springframework.faces
      JsfFlowHandlerAdapter.handle
      1. org.springframework.faces.webflow.JsfFlowHandlerAdapter.handle(JsfFlowHandlerAdapter.java:57)
      1 frame
    16. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
      2. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
      3. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
      4. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
      4 frames
    17. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
      1 frame
    18. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
      1 frame
    19. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      1 frame
    20. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
      2. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:344)
      3. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      3 frames
    21. Tyrus Servlet Bundle
      TyrusServletFilter.doFilter
      1. org.glassfish.tyrus.servlet.TyrusServletFilter.doFilter(TyrusServletFilter.java:295)
      1 frame
    22. Glassfish Core
      StandardPipeline.invoke
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:316)
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
      5. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
      6. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
      6 frames
    23. Glassfish
      WebPipeline.invoke
      1. com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
      1 frame
    24. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
      2. org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:415)
      3. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:282)
      3 frames
    25. Kernel Classes
      ContainerMapper.service
      1. com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
      2. com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
      2 frames
    26. Grizzly Server
      HttpServerFilter.handleRead
      1. org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
      2. org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
      3. org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
      3 frames
    27. Grizzly
      AbstractThreadPool$Worker.run
      1. org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      2. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
      3. org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
      4. org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
      5. org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
      6. org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      7. org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561)
      8. org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
      9. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
      10. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
      11. org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
      12. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
      13. org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
      13 frames
    28. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)
      1 frame