Sunday, December 23, 2012

Creating connection to the MySQL database

import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
  public static void main(String[] argvthrows Exception {
    String driverName = "";

    String serverName = "localhost";
    String mydatabase = "mydatabase";
    String url = "jdbc:mysql :// " + serverName + "/" + mydatabase; 
    String username = "username";
    String password = "password";
    Connection connection = DriverManager.getConnection(url, username, password);

IT Certification Category (English)640x480

Partner Sites

Top Online Courses From ProgrammingKnowledge

Python Course
Java Course
Bash Course
Linux Course
C Course
C++ Course
PHP Course
Android Course
C# Course
JavaFx Course
NodeJs Course
Jenkins Course
Scala Course
Bootstrap Course
MongoDB Course
QT C++ GUI Course