Hugh Van Der Vaal

Greenhorn
+ Follow
since Feb 05, 2020
Hugh likes ...
MySQL Database Java
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
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hugh Van Der Vaal

Thank you everyone for your help and advice and modifications to the project.

Sorry for the lateness of the reply . I suddenly got swamped with work out of nowhere, and now it is the end of the day I am very tired, with more work tomorrow. So won't have much time test everything out, though I will let you know when I do and if any problems arise. Though I now hopeful that there will be no problems that I can't handle going forward thanks to your help.

1 year ago
I run the application with the RunProject option after using the clean and build project option.

When I run it I do get these messages in amongst the log.

No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.


When I made the Project, I made it with the JavaFXApplication option of Java with Ant. When given the option(the only one) I used SDK 1.8.(I am on Java Version 19 though I do have other java versions available ) . So suppose that I am using the JavaFx version included with Java jdk1.8.0_221. Though I did try to make JavaFx 19 work with my IDE'S.

When I made the project this way. It did not generate with app.css file or an fxml file. I made the files through other means and added them to the project. I initial used Java Eclipse to try to make the project but was unable to get JavaFX tooling working with it.(It asked that I make Eclipse  make the Java 8 the version that Eclipse run on, which I despite my best efforts, I was unable to do). I did  make the app.css.file named in it, though it is only has a generated comment. And I had to make the blank fxml file myself to.

here is the contents of the app.css



1 year ago
There is aslo a problem with the right field where the field does react until put in second number, When does react, the first number "disappears" and I think it fills itself with a conversion result. No reaction from the left field

Example.
1 year ago
Thank you Stephan.

Sorry the lateness of this reply

The problem seems to be to my program(at least on my end) does not output in the way I want it to, either requiring extra counterintuitive steps, not working at all, or getting "confused"

Since it seems to work fine on your end.  I think the might be something wrong with how my Netbeans complies the program. My I post the log for when the program first complies? Is there online IDE that anyone can suggest that I can use to write and test the program just so test whether or not the program failing might be in part due to my Netbeans IDE?

In the meantime here are screenshots of some of the problems.
1 year ago

FootConverter.java



LengthConverter.java



MeterConverter.Java



Thank you very much for any help provided.
1 year ago
App package

Controller.fxml




Main.class



Controller.java



App.Converters Package
BaseUnitConverter.java




UnitTypeConverter.java


1 year ago
Hello Everyone.

So I have been refreshing myself on Java. To do this, I have been doing a self-assigned Java project which is a GUI unit converter program using Netbeans, Java8, and JavaFX.  A had some tutorial help. Some road bumps, but I managed to solve them.

So far, I have aiming to convert to basic length units.(Meters and Feet) with two text fields that have combo boxes that allow to choose between the two units(in future, more)  with another combo box that will allows one to choose between types of units(length, weight, volume.) that will change that unit the below combo boxes

So it seems to me that I have got everything in order to test my first basic unit conversion.

In case in becomes relevant(I suspect it is part of problem) . How the unit converter works is by using a base unit(meter in the case of length) and convert all queries to that unit before converting from that unit to the desired unit. I.E To convert inches to feet, inches is first converted to meters, then then result in meters is converted to feet.

So it seems to me that I have got everything in order to test my first basic unit conversion.

I type in 1 and 1 appears in the left text field(meters to feet for now), but the right text field(feet) does not fill with a conversion result. I type in another 1 into the left text field, making the number appear to be 11. The right text field finally spits out an answer. But instead of being the correct result(11 meters = 36,089 feet) the result is (1 meter = 3,2808) which means that the logic code ignores the first number.

I figured out that the field only outputs the correct results when I type a .full stop. at the end of the number I.E to make sure that ‘114’ is not only accepted as ‘14’ you have type in  ‘114.’ I can also then remove the full stop and the right field will not change, but to have more number added to query, you have to add them then type in a full stop again.  I have been using BigDecimal, so that might be part of the problem

There is also the problems that if I type in the right  (there is supposed to be a two way conversion system) then it still ignores the first number, but when I also type more numbers in right text field, then only the right text field fills with numbers, like the result is being outputted to the same  field it being typed in.

Another problem is in the if-else statement where the code that wipes both sides when the text field is cleared[isEmpty] is triggered into action by just typing in the text field. Though it just triggers the systems printout part of the statement and not the wiping of the text fields.

Any help will be appreciated.

Please find the code attached to post below
1 year ago
Sorry about the coloured text and the MySQL/MS-SQL misunderstanding. I did indeed means MS-SQL. I will try avoid such mistakes in the future. Thank you for the advice.
4 years ago
Thanks you very much Kristina. I now decided that will handle the query only asking for the passwords that match the username and then comparing them to the inputted password. No more double confirmation. The problems seems to be  MySql exceptions which then leads to EOFExceptions, in other words, My client is not getting any results from server because the server is not getting any results from the database. The database I am using has three columns
and one row. The columns are userId, username, and passwords
Here are the two versions of the query and respective MySQL errors that I get in the error report

I used the old query again because when I googled for solutions to the exception I saw someone saying that the query must go like my old query and I figured that only ignore the username and only compare the password

"SELECT * FROM tablename WHERE username='"+UserNameTextField.getText()+"' AND passwords = '"+PasswordField.getText()+"'";

It still did not help

com.microsoft.sqlserver.jdbc.SQLServerException: The index 4 is out of range.

and here is the one that I am hope to use.

SELECT passwords FROM table WHERE username='"+UserNameTextField.getText()+"'";

No dice

com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range.

I have run SOUT's one the relevant variables  to see if the put anything out, but so far no luck.
I ran the queries  on MS-SQL directly with the User Name and/or Password and they work their perfectly there so I do not understand why I am getting these exceptions when I use them in my client-server program. I also checked that my libraries that I have the correct drivers.
4 years ago
Programming newbie here in need of some assistance.  This is a bit of a rehash of my first question so sorry for any repetition
(This is all using localhost)
I have made a GUI Client program (with Java 8 and NetBeans) that queries a MS-SQL database directly. Whether the query is inserting data into the database or requesting data to fill the applications table.

I have now made a Server program that is able to take a request a to  fill a table  data from the client, query the database on behalf of the client and the send back the data to the client which then parses the data and fill the table.

Now I have made a  login window that queries the database directly . The username and password are stored in the database and the Login windows compares the information received from the  database and compares them to the input in the username and password text fields. If they match, A window locked behind the Login window opens. If the do not match, a warning message pops up. Now want to make a login window that  does not query the database directly but puts the request through the server program.

But so far how I have not found the right way to compare the results to the input of the  username and password text fields.
What I did was try to modify the code that used to fill the table to turn it into a password verification system. I feel that that this not really the right way to go but did not know another way
Please take not that this is all taking place on one computer has I am testing the waters before doing anything with making different machines communicate with each other.
I left the catch side of the try catch statements. out  Just wanted to main body of the problems  present. Sorry in advance.
Also sorry for any wrong naming conventions in advance.

Here is the code the for the client side(An action event)




               
And here is the Server side code



Syntax? Concepts? Advice?
           
4 years ago
Programming newbie here in need of some assistance.
(This is all using localhost)
I have made a Client program (with Java 8 and NetBeans) that queries a MySQL database directly. Whether the query is inserting data into the database or requesting data to fill the applications tables. I have tested to program multiple times and it seems to working just fine.
Now I want to put a middleman between the Client program and database by making a Server program that takes requests from the Client Program and in turn queries the MySQL database. If the request is to insert data. Then the server must help insert the data into the database. If the request is for data. Then the server must help pass data from the database to the client.
I did practice with servers and client programs. I made a client that sends messages to the server program which in turn sends the messages back to the client. The server can handle multiple instances of the Client program. I just have trouble applying it to the third part of the question, which is queries and databases
What direction must I now take? Syntax? Concepts? Advice?
4 years ago