Java JDBC MySQL Connection createConnection(String hostname, String port, String database, String username, String password)

Here you can find the source of createConnection(String hostname, String port, String database, String username, String password)

Description

create Connection

License

Open Source License

Declaration

public static Connection createConnection(String hostname, String port, String database, String username,
            String password) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

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

import java.sql.SQLException;

public class Main {
    public static Connection createConnection(String hostname, String port, String database, String username,
            String password) {/*from  ww w.j a v a 2s . c o  m*/
        try {
            return DriverManager.getConnection(
                    "jdbc:mysql://" + hostname + "/" + database + "?user=" + username + "&password=" + password);
        } catch (SQLException e) {
        }
        return null;
    }
}

Related

  1. addItem(int itemId, String itemName, int page, String tradeable)
  2. checkConnection(String dbFile)
  3. computeAverageGeneIdsPerName()
  4. createConnection()
  5. createConnection(String url, String user, String password)
  6. createConnectionUtf8(String connString)
  7. createTable(String dbFile, String tableName, String tableDefinition)
  8. deleteTableData(String tableName)