Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"java.sql.SQLException: No database selected"

Status
Not open for further replies.

teryhox

Programmer
Dec 6, 2007
3
0
0
ZW
Hie there hope I'll get a solution here.

I have an enterprise project on Netbeans 6.0 that compiling well. But the moment you try to retrieve data from the database(using MySQL) for display on the forms it gives the following error:

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, DTYPE, SYSCODE, SYSDESCRIPTION FROM SYS_MAIN WHERE (DTYPE = ?)
bind => [SYS_CodeMain]
Query: ReportQuery(zw.co.ecb.ethics.sys.SYS_CodeMain)

This is just part of the display in the log.

Is it something wrong with the IDE or Glashfish?
 
Please check where do you store the connection string.
I think your connection string does not contain the database name.
Connection string is usually stored in xml or configuration file. There is little chance that it is coded in Java file.

 
Post the code, please.

Try checking the connection string. Pay atention to details, such as port number, and server and database names
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top