Here you can find the source of getConnectionFromDataSource(DataSource ds)
Parameter | Description |
---|---|
ds | Data source containing parameters needed to connect to the database |
Parameter | Description |
---|---|
SQLException | an exception |
public static Connection getConnectionFromDataSource(DataSource ds) throws SQLException
//package com.java2s; //License from project: MIT License import java.sql.Connection; import java.sql.SQLException; import javax.sql.DataSource; public class Main { /**//w ww . j a v a 2s. com * Creates a connection to the database from a Data Source * * @param ds Data source containing parameters needed to connect to the database * @return A connection to the database * @throws SQLException */ public static Connection getConnectionFromDataSource(DataSource ds) throws SQLException { Connection conn = ds.getConnection(); conn.setAutoCommit(false); return conn; } }