1 16 17 package org.springframework.jdbc.datasource.lookup; 18 19 import javax.naming.NamingException ; 20 import javax.sql.DataSource ; 21 22 import org.springframework.jndi.JndiLocatorSupport; 23 24 36 public class JndiDataSourceLookup extends JndiLocatorSupport implements DataSourceLookup { 37 38 public DataSource getDataSource(String dataSourceName) throws DataSourceLookupFailureException { 39 try { 40 return (DataSource ) lookup(dataSourceName, DataSource .class); 41 } 42 catch (NamingException ex) { 43 throw new DataSourceLookupFailureException( 44 "Failed to look up JNDI DataSource with name '" + dataSourceName + "'", ex); 45 } 46 } 47 48 } 49 | Popular Tags |