Java DataSource initDataSource()

Here you can find the source of initDataSource()

Description

init Data Source

License

Mozilla Public License

Exception

Parameter Description
NamingException an exception

Declaration

private static void initDataSource() throws NamingException 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

public class Main {
    /** */// ww w . j av  a 2s. co  m
    private static DataSource dataSource = null;

    /**
     * 
     * @throws NamingException
     */
    private static void initDataSource() throws NamingException {

        Context initContext = new InitialContext();
        Context context = (Context) initContext.lookup("java:comp/env");
        DataSource ds = (javax.sql.DataSource) context.lookup("jdbc/webrod");
        dataSource = ds;
    }
}

Related

  1. getProductAllCount(DataSource ds, String key, String sql_allcount)
  2. getSchemaSeparator(DataSource dataSource)
  3. getTableColumnCount(DataSource dataSource, String selectedTable)
  4. getTables(DataSource datasource)
  5. hasTable(DataSource ds, String table)
  6. initDatasource(String jndiName)
  7. initDb(DataSource ds)
  8. initializeDataSource()
  9. isDataSourceAvailable(String dataSourceName)