Daniel Graham

Greenhorn
+ Follow
since Dec 14, 2017
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Graham

Hi. I have a form in my java inventory software that permits a shop manager to create new sales agents accounts.

It has 6 fields : firstNameField, lastNameField, dateOfBirthField, phoneNumberField, agentIDField, and agentPasswordField.
It also have a button called Add

This form stores its values in an SQLite database table called: sales_agents
Here's its schema:



My goal is, when the manager clicks the Add button -- which is linked to a method called agentCreateBtnActionPerformed(), the following code should check that no field has been left blank,
before inserting anything to the database.
In case, there is an empty field, it prints out this message:

Please you are required to enter something in every empty field to carry out this operation!

in
a JOptionPane.

Here's the code:



My Problem.
1) The above code keeps inserting empty strings when there are empty fields. And I've also realized that, when I insert something in the  agentPasswordField, and don't insert anything in the
agentIDField, and vice versa, it inserts both non-empty field values and empty field values to the database without popping up an error message.
Whereas, failing to insert into the agentIDField, and agentPasswordField generates an error message in JOptionPane that says:

A primary key constraint failed (UNIQUE constraint failed: sales_agents.userID, sales_agents.userPassword)



2) I added a check constraint to the userPasswordField thinking it would generate an SQLException, but it still did not work.

I've made a lot of research on this issue online but couldn't find something that helped.

Please, any help will be welcome.
regards
It's Okay! I've found another solution.

After some intensive research in some other forums, I discovered that it looks best to develop java desktop application that uses a database, with SQLite.

So I've currently switched my database from mysql to sqlite.

Thanks for your good will of help.
Hi everyone. I'm having some troubles in creating and installer for my java app which uses the MySQL database.

The build path of the java app has "mysql-connector-java-5.1.44-bin.jar".

I've used before creating any connection to the database.

I'm using "laun4j.jar" in Ubuntu to create the executable. When it finishes creating the .exe file it pops up an error message that says

com.mysql.jdbc.Driver



The next thing I did was using exe4j in windows. After creating the .exe file, when I launched the app's executable I still got the same message.
So no way to launch the app and see it working.

I read and read posts online, but no solution was helpful to me after trying them.

Please if anyone could help, that will be highly appreciated.
Okay, so that's the strategy. I appreciate that.

So how do we go about that?

I just came to know about the "UndoManager" class. Do you think this class can help me undo all textfields, lists, colors, selections, database, files, etc in my app?
6 years ago
Yeah. That's the name: I meant the undo and redo functionalities..
6 years ago
Hello. I'm on the point of getting some experiences in Java Desktop applications.

But I've got one challenge right now.

I wish  to know how I could add a backward/forward functionality to the app I'm currently building.

So please, is there any java class or any external java source code that I could use to add to my application?


Please any help shall be mostly appreciated.
6 years ago