Code example for UnknownHostException

Methods: printStackTrace, toString

0
	public static DB connectToAttachmentsDb() throws ServletException { 
		Mongo m = null;
		try { 
			m = new Mongo( "127.0.0.1" );
		} catch (UnknownHostException e) {
			e.printStackTrace();
			throw new ServletException("Error acessing DB. Err: " + e.toString());
		} catch (MongoException e) {
			e.printStackTrace();
			throw new ServletException("Error acessing DB. Err: " + e.toString());
		} 
		 
		return m.getDB( "mailComposingAttachmentsDb" );
	} 
	 
	public static GridFS getGridFSforAttachmentsFiles(DB db) {
		GridFS gfsFileAttachment = new GridFS(db, "attachmentsFiles");
		return gfsFileAttachment;
	} 
}