Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

I have developed a web application which has get and insert data in database through JPA (MYsql). I have used netbean ide, with glassfish.

I'm new to JPA..

I'm putting here error log entry .Please give any suggestion

Thank you

Error log :---

Timestamp Jan 25, 2008 16:06:59.084
Log Level SEVERE
Logger javax.enterprise.system.container.web
Name-Value Pairs _ThreadID=26;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=6e64ac88-71e5-4f64-a343-dcc84fe3de0c;
Record Number 193
Message ID StandardWrapperValve[Dispatcher Servlet]
Complete Message PWC1406: Servlet.service() for servlet Dispatcher Servlet threw exception Local Exception Stack: Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException Internal Exception: 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) at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:319) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:566) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:452) at oracle.toplink.essentials.threetier.ServerSession.executeCall(ServerSession.java:473) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:228) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:214) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:285) at oracle.toplink.essentials.internal.queryframework.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:615) at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2416) at oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.selectAllReportQueryRows(ExpressionQueryMechanism.java:2382) at oracle.toplink.essentials.queryframework.ReportQuery.executeDatabaseQuery(ReportQuery.java:802) at oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:628) at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:692) at oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:746) at oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2233) at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:952) at oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:924) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:367) at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:478) at com.synapticresearch.core.service.AccountService.findByCredentials(AccountService.java:61) at com.synapticresearch.catalogue.controller.LoginController.isUserAuth(LoginController.java:40) at com.synapticresearch.catalogue.controller.LoginController.processRequest(LoginController.java:27) at com.synapticresearch.framework.servlet.DispatcherServlet.processRequest(DispatcherServlet.java:89) at com.synapticresearch.framework.servlet.DispatcherServlet.service(DispatcherServlet.java:116) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212) at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:361) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: java.sql.SQLException: No database selected at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1467) at com.mysql.jdbc.jdbc2.optional.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:811) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:726) at oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:501) ... 55 more
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Happy",
Please check your private messages.
 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Please check your private messages."

Could you explain this?
 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops.. sorry i understand..
Can any body have some idea on above JPa error?
thanks
 
Edvins Reisons
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently, your application doesn't know what database to connect to.
Most of the time, this is configured in a data source.
 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Edvins.

i have found the problem & fix . i had created a connect pool by sun admin console.
In connection pool Additional Properties.
I had added "URL"="jdbc:mysql://localhost:3306/"
instead of "URL"="jdbc:mysql://localhost:3306/databasename"

so each time show me error database not selected

now it working fine thanks
 
kunal kathrotia
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thnaks you Guys...

the Same Problem i was facing and same solution for that.....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic