Below the solution I implemented.
1- Include opencsv.jar in the project
2-
 private boolean criaCsv(String select, long parametro, String nomeArquivoCsv) throws Exception
        {
            try{                
                File arquivoCsv =  new File( caminho + nomeArquivoCsv );
                arquivoCsv.createNewFile();
                CSVWriter writer = new CSVWriter(new FileWriter(arquivoCsv), CSVWriter.DEFAULT_SEPARATOR);
                Boolean includeHeaders = false;
                PreparedStatement ps = getConnection().prepareStatement(select, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
                ps.setFetchSize(FETCH_BD);
                ps.setLong(1, parametro);
                ResultSet resultSet = (ResultSet) ps.executeQuery();
                writer.writeAll(resultSet, includeHeaders);
                writer.flush();
                writer.close();
                return true;
            }
            catch(Exception e){
                log.error("",e);
                return false;
            }
        }
public Connection getConnection()
    {
        try
        {
            if( conn == null || conn.isClosed()){
                conn = dataSource.getConnection();
                conn.setAutoCommit(false);
            }
        } catch (SQLException e)
        {
            log.error("", e);
        }
        return conn;
    }
							
							
						 
The bank is on Android device, can explain how is made to Connection to the bank?
– ramaral
Below how to create connection to the bank on Android. private Sqlitedatabase database; private Context; public Static final String CRIA_TABELA_DIARIO = "create table if not exists TABLE( DATA integer Primary key autoincrement, DESC string )"; public Sqlitedatabase getDatabaseInstance(){ if(database == null) { database = context.openOrCreateDatabase(nameBanco, Context.MODE_PRIVATE, null); database.execSQL(Constantesbanco.CRIA_TABELA_DIARIO); } Return database; }
– criscan
Edit the answer and put that code there. However what I wanted to know is what method is that
getConnection().– ramaral
Any new information that improves the answer should be put in it (editing it) instead of putting it in a comment.
– ramaral
It is an application code that is not Android. public Connection getConnection() { Try { if( Conn == null || Conn.isClosed()){ Conn = datasource.getConnection(); Conn.setAutoCommit(false); } } catch (Sqlexception e) { log.error(", e); } Return Conn; }
– criscan