Java Certification, Programming, JavaBean and Object Oriented Reference Books
Using Mysql in Database Connectivity in Java

To connect to the database, you need to use a JDBC url with the following format


This is described in the Driver documentation. Accordingly, the piece of code you must use is:

try {
  } catch (ClassNotFoundException cnfe)
                System.err.println("Error loading driver:"+cnfe);

             Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Authority?user=root&password=fox123");


  here hostName=localhost
Java Tips by : Karmegam

Quick Links:
Do you have a Java Question?

Best Regards,
Java Programming Hints and Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.