Using Mysql
in Database Connectivity in Java
To connect to the database, you need to use a JDBC url with the following format jdbc:mysql://[hostname][:port]/[dbname][?param1=value1][¶m2=value2]..... This is described in the Driver documentation. Accordingly, the piece of code you must use is: try {
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/Authority?user=root&password=fox123"); } here hostName=localhost
Java Tips by : Karmegam
Related:
Java Certification, Programming, JavaBean and Object Oriented Reference Books Return to : Java Programming Hints and Tips All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|