Java JDBC MySQL Connection createConnection(String url, String user, String password)

Here you can find the source of createConnection(String url, String user, String password)

Description

create Connection

License

Apache License

Declaration

public static void createConnection(String url, String user, String password) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

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

import java.sql.SQLException;

public class Main {
    public static void createConnection(String url, String user, String password) {
        try {//www. java 2 s.  c  om
            Connection conn = DriverManager.getConnection(url, user, password);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static Connection getConnection(String url, String user, String password) {
        Connection conn = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection(url, user, password);
        } catch (ClassNotFoundException e) {

            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return conn;
    }
}

Related

  1. addItem(int itemId, String itemName, int page, String tradeable)
  2. checkConnection(String dbFile)
  3. computeAverageGeneIdsPerName()
  4. createConnection()
  5. createConnection(String hostname, String port, String database, String username, String password)
  6. createConnectionUtf8(String connString)
  7. createTable(String dbFile, String tableName, String tableDefinition)
  8. deleteTableData(String tableName)
  9. getAllNames()