KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > sql > DataSource

javax.sql
Interface DataSource

See Also:
Top Examples, Source Code

Connection getConnection()
                         throws SQLException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[607]Look up DataSource
By Anonymous on 2004/07/23 17:10:19  Rate
try  {  
     InitialContext c = new InitialContext (  ) ; 
     DataSource jdbcFactory= ( DataSource ) c.lookup ( "java:comp/env/jdbc/DefaultDS" ) ; 
     Connection conn = jdbcFactory.getConnection (  ) ; 
     .... 
  }  
 catch  ( Exception e )   {  
     ... 
  }  
 


Connection getConnection(String username,
                         String password)
                         throws SQLException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[731]Get DB Connection with username and password
By marimuthusamy { at } rediffmail { dot } com on 2005/09/19 21:41:38  Rate
try  {   
     InitialContext c = new InitialContext (  ) ;  
     DataSource jdbcFactory= ( DataSource ) c.lookup ( "java:comp/env/jdbc/DefaultDS" ) ;  
     Connection conn = jdbcFactory.getConnection ( "root","" ) ;  
     ....  
  }   
 catch  ( Exception e )   {   
     ...  
  }  


int getLoginTimeout()
                    throws SQLException
See Also:
setLoginTimeout(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


PrintWriter getLogWriter()
                         throws SQLException
See Also:
setLogWriter(java.io.PrintWriter)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


void setLoginTimeout(int seconds)
                     throws SQLException
See Also:
getLoginTimeout()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


void setLogWriter(PrintWriter out)
                  throws SQLException
See Also:
getLogWriter()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags