Been trying for the last couple of hours trying to connect to mysql database with no luck. I have the port number right but it is still not connecting. Heres the code:
This then brings up a user screen but when I click log in (no matter what I put in the text fields) I get this
ant -f C:\\Users\\Paul17\\Documents\\NetBeansProjects\\LibraryApplicationProject jfxsa-run
Updating property file: C:\Users\Paul17\Documents\NetBeansProjects\LibraryApplicationProject\build\built-jar.properties
Compiling 1 source file to C:\Users\Paul17\Documents\NetBeansProjects\LibraryApplicationProject\build\classes
Detected JavaFX Ant API version 1.3
Launching <fx:jar> task from C:\Program Files\Java\jdk1.8.0_25\jre\..\lib\ant-javafx.jar
Warning: From JDK7u25 the Codebase manifest attribute should be used to restrict JAR repurposing.
Please set manifest.custom.codebase property to override the current default non-secure value '*'.
Launching <fx:deploy> task from C:\Program Files\Java\jdk1.8.0_25\jre\..\lib\ant-javafx.jar
Copying 12 files to C:\Users\Paul17\Documents\NetBeansProjects\LibraryApplicationProject\dist\run1191448749
Executing C:\Users\Paul17\Documents\NetBeansProjects\LibraryApplicationProject\dist\run1191448749\LibraryApplicationProject.jar using platform C:\Program Files\Java\jdk1.8.0_25\jre/bin/java
SELECT * FROM student WHERE USERID= '' AND PASSWORD= ''
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3307/student
Deleting directory C:\Users\Paul17\Documents\NetBeansProjects\LibraryApplicationProject\dist\run1191448749
BUILD SUCCESSFUL (total time: 6 seconds)
I have added a screen shot of the mysql databases view in netbeans.
Ad from errors you reported, no suitable driver for MySQL is found: probabily required jars are not round in your application classpath. Why don't you try with a simple console-based application before using java FX ?
posted 5 years ago
Yeah you're probably right, a test console application will be easier to establish a connection.
Maybe you are just running some tests, but generally speaking is always better to clean separate data access logic from GUI frontend.So the extra work may be worth.
posted 5 years ago
Switched over to eclipse and adding the jar to the build path and problem has been fixed. Thanks for the advice. Just one more question, when you say separate data access logic from GUI frontend do you mean put anything related to the database into a different package?