Code example for Connection

Methods: isClosed

0
 
	public void dataAvailable ( String inputStreamName , StreamElement streamElement ) {
		StringBuilder query = Main.getStorage(table_name.toString()).getStatementInsert(table_name, getVirtualSensorConfiguration().getOutputStructure());
		 
		try { 
			Main.getStorage(table_name.toString()).executeInsert(table_name ,getVirtualSensorConfiguration().getOutputStructure(),streamElement,getConnection() );
		} catch (SQLException e) {
			logger.error(e.getMessage(),e);
			logger.error("Insertion failed! ("+ query+")");
		}finally { 
			dataProduced( streamElement );
		} 
		 
	} 
 
 
	public Connection getConnection() throws SQLException {
		if (this.connection==null || this.connection.isClosed())
			this.connection=DriverManager.getConnection(url,user,password);
		return connection;
	} 
 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE