Here you can find the source of createDataSource()
public static DataSource createDataSource()
//package com.java2s; //License from project: Open Source License import javax.sql.DataSource; import com.mysql.jdbc.jdbc2.optional.MysqlDataSource; public class Main { public static DataSource createDataSource() { MysqlDataSource ds = new MysqlDataSource(); ds.setUser("root"); ds.setPassword("sP6prUCe"); ds.setServerName("localhost"); ds.setDatabaseName("db_patterns"); return ds; }/*w w w. jav a 2 s . c o m*/ }