dato che ho capito come postare il codice, vi inserisco tutto il codice della mia classe

codice:
package di.uniba.plugin.jmeta.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import di.uniba.plugin.jmeta.eccezioni.applException;

public class DbGateway {
	
	private static final String NOME_DRIVER="com.mysql.jdbc.Driver"; //nome del driver com.mysql.jdbc.Driver
	public String NOME_SERVER; //nome del server
	public String PORTA; //numero della porta del server
	public String NOME_DATABASE; //nome del database
	public String USERNAME; //username
	public String PASSWORD; //password
	
	private String URL; //URL della stringa di connessione
	private String STRINGA_CONNESSIONE; //stringa di connessione
	
	private Connection connessione=null;
	private Statement statement=null;
	private PreparedStatement pstmt=null;
	
	//costruttore
	public DbGateway(){
		this.NOME_SERVER="192.168.0.139";
		this.PORTA=":3306";
		this.NOME_DATABASE="db_eclipse";
		this.USERNAME="root";
		this.PASSWORD="f3btspkd";
		
		this.URL="jdbc:mysql://" + NOME_SERVER + PORTA + "/" + NOME_DATABASE;
		this.STRINGA_CONNESSIONE = URL + "?user=" + USERNAME + "&password=" + PASSWORD;
	}
	
	//connessione del database
	public void ConnessioneDb() throws applException{
		try{
			Class.forName(NOME_DRIVER); //carica il driver JDBC
		}
		catch (ClassNotFoundException e){
			e.printStackTrace();
			throw new applException ("ERRORE nel caricamento del driver JDBC");
		}
		try{
			connessione=DriverManager.getConnection(STRINGA_CONNESSIONE); //connessione al database
		}
		catch (SQLException e){
			throw new applException ("ERRORE nella connessione al database");
		}
	}
	
	public void ErroreRollback() throws applException{
		try{
			connessione.rollback();
		}
		catch (SQLException e){
			throw new applException ("ERRORE nell'operazione di rollback");
		}
	}
	
	public void DisabilitaAutoCommit() throws applException{
		try{
			connessione.setAutoCommit(false);
		}
		catch (SQLException e){
			throw new applException ("ERRORE durante la disabilitazione dell'autocommit");
		}
	}
	
	public void AbilitaAutoCommit() throws applException{
		try{
			connessione.setAutoCommit(true);
		}
		catch (SQLException e){
			throw new applException ("ERRORE durante l'abilitazione dell'autocommit");
		}
	}
	
	//disconnessione del database
	public void DisconnessioneDb() throws applException{
		try{
			connessione.close();
			connessione=null;
		}
		catch (SQLException e){
			throw new applException ("ERRORE nella disconnessione al database");
		}
	}
	
	public void Commit() throws applException{
		try{
			connessione.commit();
		}
		catch (SQLException e){
			throw new applException ("ERRORE nell'operazione di commit");
		}
	}
	
	//impostazione della query
	public PreparedStatement PreparaStatement(String query) throws applException{
		try{
			if ((query!=null) && (query!="")){
				//punto in cui il programma si blocca perchè connessione=null (per risolvere si può aggiungere la connessione)
				//connessione=DriverManager.getConnection(STRINGA_CONNESSIONE);
				ConnessioneDb();
				pstmt=connessione.prepareStatement(query); //imposta la query in pstmt di tipo PreparedStatement
			}
		}
		catch (SQLException e){
			throw new applException ("ERRORE nella fase di preparazione della query");
		}
		return pstmt;
	}
	
	//esecuzione della query
	public ResultSet EsecuzioneQuery (PreparedStatement statement) throws applException{
		ResultSet risultato=null;
		
		try{
			if (statement!=null)
				risultato=statement.executeQuery();
		}
		catch (SQLException e){
			throw new applException ("ERRORE durante l'eliminazione delle tuple dalla tavola");
		}
		return risultato;
	}
	
	public boolean EsecuzioneUpdateQuery (PreparedStatement statement) throws applException{
		boolean risposta=false;
		
		if (statement!=null){
			try{
				if (statement.executeUpdate()>0)
					risposta=true;
				else
					risposta=false;
			}
			catch (SQLException e){
				int codice_errore=1062;
				if (e.getErrorCode()==codice_errore){
					risposta=false;
				}
				else{
					throw new applException ("ERRORE nell'esecuzione della query di update"); 
				}
			}
		}
		return risposta;
	}

}