com.datastax.util.db.ConnUtil Maven / Gradle / Ivy
package com.datastax.util.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
* UserItem: Anders Hong
* Date: 6/14/13
* Time: 3:35 PM
*/
public class ConnUtil {
public static Connection createConnection(String driverClassName,String url,String user,String password) {
Connection conn = null;
try {
Class.forName(driverClassName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
conn = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
}
}