This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Machine Learning with R: Expert techniques for predictive modeling and have Brett Lantz on-line!
See this thread for details.
Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Create a Java error message with jOptionPane

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello! I’ve been struggling with creating a Java program which displays a login form.Basically, I want to retreive a database which contains about users and their password. At this moment, I am at the point where I need to display an error message using jOptionPane, but it seems like not working. When I run the file and I click Login button, nothing is displayed.

Here is a part of the code:

                                 
Thank you

 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if I delete them, the result is the same: no dialog is shown. I debugged it, nothing seems wrong
 
Carey Brown
Saloon Keeper
Posts: 6246
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is from the JOptionPane docs:
It uses null for a parent and specifies that it is an error dialog.
 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:This is from the JOptionPane docs:
It uses null for a parent and specifies that it is an error dialog.



I typed it, nothing works. However, if I use the code that you provided me with, on a distinct JForm, clicking the so-called Login button retreives the necessary result. Therefore, it might be a problem with the code that indicates the connection with MySql Database. What do you think?
 
Diane Branco
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out what the problem is: the server cannot connect to the MySql database. Basically, the code is not properly run because of the lack of connection. Well, I try to connect to the database, but I am prompted with the following error (in the attachement). The paths seem to be correct, but still I cannot connect to the DB. What can I do?
error.jpg
[Thumbnail for error.jpg]
 
Marshal
Posts: 65821
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to our databases forum.

Please avoid Screenshots, which can be difficult to read.
 
Sheriff
Posts: 6269
167
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think MySQL has Workbench as its administrator tool.  Try connecting with that, then transfer the properties to your Java program.
 
Rancher
Posts: 4275
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I peer at that screenshot, it shows that it can't find the MySQL JDBC driver.

Do you have the MySQL JDBC jar file in the correct place for you app?
 
Politics is a circus designed to distract you from what is really going on. So is this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!