Re: java connector/J5.1 mysql
Posted by: Filipe Silva
Date: February 12, 2018 12:14PM

Hi Willem,

First of all it is bad practice to put your java files in the JDK bin directory. You should keep your sources in a project directory, usually in your user workspace. If you are building a standalone application you should also place the Connector/J jar file in the same project directory.

Second, you can call javac and java directly with full path or have them in your system path variable.

Third, when compiling and starting your application you should use the -classpath argument and point to the Connector/J jar file.

Finally, you are missing a question mark in your connection string right between the last slash and "user...". The final connection string should look like "jdbc:mysql://localhost:3306/?user=shorty@localhost&password=asdfgh456". Also note that you don't need "@localhost" in the username, MySQL usually picks the one that fits your setup.


Options: ReplyQuote

Written By
February 10, 2018 03:08PM
Re: java connector/J5.1 mysql
February 12, 2018 12:14PM
February 19, 2018 01:16PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.