java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
java.net.UnknownHostException
- All Implemented Interfaces:
- Serializable
- See Also:
- Top Examples, Source Code
public UnknownHostException()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1176]JDBC ConnectionManager
By Anonymous on 2004/12/06 19:30:15 Rate
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionManager {
private static ConnectionManager instance;
private Connection connection = null;
private ConnectionManager ( ) throws SQLException {
// load driver
try {
Class.forName ( "com.mysql.jdbc.Driver" ) ;
} catch ( ClassNotFoundException e ) {
throw new RuntimeException ( e ) ;
}
// create connection
connection = DriverManager.getConnection ( "jdbc:mysql://@locallhost/svh" ) ;
}
public synchronized static ConnectionManager getInstance ( ) throws SQLException {
if ( instance == null ) {
instance = new ConnectionManager ( ) ;
}
return instance;
}
public Connection getConnection ( ) {
return connection;
}
}
public UnknownHostException(String host)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples