Connect to MySQL DataBase using DataSource without connection pool
Connect to Mysql-database using datasource
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class UserDAOTest {
MysqlDataSource ds;
public UserDAOTest() {
ds=new MysqlDataSource();
ds.setDatabaseName("csajsp");
ds.setURL("jdbc:mysql://localhost:3306/csajsp");
ds.setPassword("prdc123");
ds.setUser("root");
ds.getConnection();
}
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class UserDAOTest {
MysqlDataSource ds;
public UserDAOTest() {
ds=new MysqlDataSource();
ds.setDatabaseName("csajsp");
ds.setURL("jdbc:mysql://localhost:3306/csajsp");
ds.setPassword("prdc123");
ds.setUser("root");
ds.getConnection();
}
Comments
Post a Comment