IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Servlets/JSP Java Discussion :

Exporter table SQL dans un fichier CSV


Sujet :

Servlets/JSP Java

  1. #1
    Membre à l'essai
    Inscrit en
    Février 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 21
    Points : 20
    Points
    20
    Par défaut Exporter table SQL dans un fichier CSV
    Bonjour,
    Je dois transférer le contenu d'une table SQL dans un fichier CSV en Java. Tout fonctionne bien saut que mon fichier n'est pas complet (il est meme coupé en plein milieu d'un enregistrement du resultSet). Le fichier a une taille de 8Kb et je pense que c'est la taille maximum pour ce type d'importation. Est ce que vous savez comment modifier cette valeur max.
    Merci d'avance

    P.s : Je travaille avec Tomcat 5.5

  2. #2
    Membre à l'essai
    Inscrit en
    Février 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 21
    Points : 20
    Points
    20
    Par défaut
    Je mets mon code si ca peut aider :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    public CsvWriter traiterRapport1() throws SQLException, IOException {
     
            String strSQL = "SELECT * FROM rubriqueml";
            Statement stmt = null;
            CsvWriter writer = new CsvWriter("C:\\Temp\\rapport.txt");
            writer.setDelimiter('|');
     
            stmt = DatabaseManager.execute(strSQL);
            System.out.println("*****stmt*******"+stmt);
            ResultSet result = stmt.getResultSet();
     
            result.last(); // Positionne le curseur à la fin du resultSet
            int nb = result.getRow(); // Récupère le nombre de records
            result.beforeFirst(); // Repositionne le curseur AVANT le 1er record
            System.out.println("*****nb*******"+nb);
            int i = 0;
     
            while (result.next()){                 
                String info1 = result.getString(1);
                String info2 = result.getString(2);
                String info3 = result.getString(3);
                String info4 = result.getString(4);
                String info5 = result.getString(5);
                String info6 = result.getString(6);            
     
                String[] record = {info1, info2, info3, info4, info5, info6};
                System.out.println("*****info1***"+i+"****"+info1);
                writer.writeRecord(record);            
                i++;
     
        }
            DatabaseManager.endRequest(stmt, true);
            return writer;
      }
    et dans l'output :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    *****stmt*******com.mysql.jdbc.PreparedStatement@d6466f: SELECT * FROM rubriqueml
    *****nb*******416
    Il y a bien 416 enregistrements dans le resultset, mais seulement 306 dans le fichier de sortie !!

  3. #3
    Membre confirmé Avatar de djsnipe
    Inscrit en
    Mai 2008
    Messages
    440
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 440
    Points : 493
    Points
    493
    Par défaut
    On dirait que c'est un problème de flush lors de l'écriture de ton fichier par le CsvWriter. Si c'est le cas, tu dois voir dans ta console les 416 fois la trace du " "*****info1***"+i+"****"+info1)" et pas dans le fichier CSV.
    Poste le code du CsvWriter pour vérifier

  4. #4
    Membre à l'essai
    Inscrit en
    Février 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 21
    Points : 20
    Points
    20
    Par défaut
    j'ai bien 416 fois la trace du " "*****info1***"+i+"****"+info1 mais je n'ai que 306 enregistrements dans le csv généré (et encore le dernier est coupé).

    Voila le code du CsvWriter (trouvé sur sourceforge.net):

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    package com.csvreader;
     
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.OutputStreamWriter;
    import java.io.PrintWriter;
    import java.io.Writer;
    import java.nio.charset.Charset;
     
    /**
     * A stream based writer for writing delimited text data to a file or a stream.
     */
    public class CsvWriter {
    	private PrintWriter outputStream = null;
     
    	private String fileName = null;
     
    	private boolean firstColumn = true;
     
    	private boolean useCustomRecordDelimiter = false;
     
    	private Charset charset = null;
     
    	// this holds all the values for switches that the user is allowed to set
    	private UserSettings userSettings = new UserSettings();
     
    	private boolean initialized = false;
     
    	private boolean closed = false;
     
    	/**
    	 * Double up the text qualifier to represent an occurance of the text
    	 * qualifier.
    	 */
    	public static final int ESCAPE_MODE_DOUBLED = 1;
     
    	/**
    	 * Use a backslash character before the text qualifier to represent an
    	 * occurance of the text qualifier.
    	 */
    	public static final int ESCAPE_MODE_BACKSLASH = 2;
     
    	/**
    	 * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using a file
    	 * as the data destination.
    	 * 
    	 * @param fileName
    	 *            The path to the file to output the data.
    	 * @param delimiter
    	 *            The character to use as the column delimiter.
    	 * @param charset
    	 *            The {@link java.nio.charset.Charset Charset} to use while
    	 *            writing the data.
    	 */
    	public CsvWriter(String fileName, char delimiter, Charset charset) {
    		if (fileName == null) {
    			throw new IllegalArgumentException("Parameter fileName can not be null.");
    		}
     
    		if (charset == null) {
    			throw new IllegalArgumentException("Parameter charset can not be null.");
    		}
     
    		this.fileName = fileName;
    		userSettings.Delimiter = delimiter;
    		this.charset = charset;
    	}
     
    	/**
    	 * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using a file
    	 * as the data destination. Uses a comma as the column delimiter and
    	 * ISO-8859-1 as the {@link java.nio.charset.Charset Charset}.
    	 * 
    	 * @param fileName
    	 *            The path to the file to output the data.
    	 */
    	public CsvWriter(String fileName) {
    		this(fileName, Letters.COMMA, Charset.forName("ISO-8859-1"));
    	}
     
    	/**
    	 * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using a Writer
    	 * to write data to.
    	 * 
    	 * @param outputStream
    	 *            The stream to write the column delimited data to.
    	 * @param delimiter
    	 *            The character to use as the column delimiter.
    	 */
    	public CsvWriter(Writer outputStream, char delimiter) {
    		if (outputStream == null) {
    			throw new IllegalArgumentException("Parameter outputStream can not be null.");
    		}
     
    		this.outputStream = new PrintWriter(outputStream);
    		userSettings.Delimiter = delimiter;
    		initialized = true;
    	}
     
    	/**
    	 * Creates a {@link com.csvreader.CsvWriter CsvWriter} object using an
    	 * OutputStream to write data to.
    	 * 
    	 * @param outputStream
    	 *            The stream to write the column delimited data to.
    	 * @param delimiter
    	 *            The character to use as the column delimiter.
    	 * @param charset
    	 *            The {@link java.nio.charset.Charset Charset} to use while
    	 *            writing the data.
    	 */
    	public CsvWriter(OutputStream outputStream, char delimiter, Charset charset) {
    		this(new OutputStreamWriter(outputStream, charset), delimiter);
    	}
     
    	/**
    	 * Gets the character being used as the column delimiter.
    	 * 
    	 * @return The character being used as the column delimiter.
    	 */
    	public char getDelimiter() {
    		return userSettings.Delimiter;
    	}
     
    	/**
    	 * Sets the character to use as the column delimiter.
    	 * 
    	 * @param delimiter
    	 *            The character to use as the column delimiter.
    	 */
    	public void setDelimiter(char delimiter) {
    		userSettings.Delimiter = delimiter;
    	}
     
    	public char getRecordDelimiter() {
    		return userSettings.RecordDelimiter;
    	}
     
    	/**
    	 * Sets the character to use as the record delimiter.
    	 * 
    	 * @param recordDelimiter
    	 *            The character to use as the record delimiter. Default is
    	 *            combination of standard end of line characters for Windows,
    	 *            Unix, or Mac.
    	 */
    	public void setRecordDelimiter(char recordDelimiter) {
    		useCustomRecordDelimiter = true;
    		userSettings.RecordDelimiter = recordDelimiter;
    	}
     
    	/**
    	 * Gets the character to use as a text qualifier in the data.
    	 * 
    	 * @return The character to use as a text qualifier in the data.
    	 */
    	public char getTextQualifier() {
    		return userSettings.TextQualifier;
    	}
     
    	/**
    	 * Sets the character to use as a text qualifier in the data.
    	 * 
    	 * @param textQualifier
    	 *            The character to use as a text qualifier in the data.
    	 */
    	public void setTextQualifier(char textQualifier) {
    		userSettings.TextQualifier = textQualifier;
    	}
     
    	/**
    	 * Whether text qualifiers will be used while writing data or not.
    	 * 
    	 * @return Whether text qualifiers will be used while writing data or not.
    	 */
    	public boolean getUseTextQualifier() {
    		return userSettings.UseTextQualifier;
    	}
     
    	/**
    	 * Sets whether text qualifiers will be used while writing data or not.
    	 * 
    	 * @param useTextQualifier
    	 *            Whether to use a text qualifier while writing data or not.
    	 */
    	public void setUseTextQualifier(boolean useTextQualifier) {
    		userSettings.UseTextQualifier = useTextQualifier;
    	}
     
    	public int getEscapeMode() {
    		return userSettings.EscapeMode;
    	}
     
    	public void setEscapeMode(int escapeMode) {
    		userSettings.EscapeMode = escapeMode;
    	}
     
    	public void setComment(char comment) {
    		userSettings.Comment = comment;
    	}
     
    	public char getComment() {
    		return userSettings.Comment;
    	}
     
    	/**
    	 * Whether fields will be surrounded by the text qualifier even if the
    	 * qualifier is not necessarily needed to escape this field.
    	 * 
    	 * @return Whether fields will be forced to be qualified or not.
    	 */
    	public boolean getForceQualifier() {
    		return userSettings.ForceQualifier;
    	}
     
    	/**
    	 * Use this to force all fields to be surrounded by the text qualifier even
    	 * if the qualifier is not necessarily needed to escape this field. Default
    	 * is false.
    	 * 
    	 * @param forceQualifier
    	 *            Whether to force the fields to be qualified or not.
    	 */
    	public void setForceQualifier(boolean forceQualifier) {
    		userSettings.ForceQualifier = forceQualifier;
    	}
     
    	/**
    	 * Writes another column of data to this record.
    	 * 
    	 * @param content
    	 *            The data for the new column.
    	 * @param preserveSpaces
    	 *            Whether to preserve leading and trailing whitespace in this
    	 *            column of data.
    	 * @exception IOException
    	 *                Thrown if an error occurs while writing data to the
    	 *                destination stream.
    	 */
    	public void write(String content, boolean preserveSpaces)
    			throws IOException {
    		checkClosed();
     
    		checkInit();
     
    		if (content == null) {
    			content = "";
    		}
     
    		if (!firstColumn) {
    			outputStream.write(userSettings.Delimiter);
    		}
     
    		boolean textQualify = userSettings.ForceQualifier;
     
    		if (!preserveSpaces && content.length() > 0) {
    			content = content.trim();
    		}
     
    		if (!textQualify
    				&& userSettings.UseTextQualifier
    				&& (content.indexOf(userSettings.TextQualifier) > -1
    						|| content.indexOf(userSettings.Delimiter) > -1
    						|| (!useCustomRecordDelimiter && (content
    								.indexOf(Letters.LF) > -1 || content
    								.indexOf(Letters.CR) > -1))
    						|| (useCustomRecordDelimiter && content
    								.indexOf(userSettings.RecordDelimiter) > -1)
    						|| (firstColumn && content.length() > 0 && content
    								.charAt(0) == userSettings.Comment) ||
    				// check for empty first column, which if on its own line must
    				// be qualified or the line will be skipped
    				(firstColumn && content.length() == 0))) {
    			textQualify = true;
    		}
     
    		if (userSettings.UseTextQualifier && !textQualify
    				&& content.length() > 0 && preserveSpaces) {
    			char firstLetter = content.charAt(0);
     
    			if (firstLetter == Letters.SPACE || firstLetter == Letters.TAB) {
    				textQualify = true;
    			}
     
    			if (!textQualify && content.length() > 1) {
    				char lastLetter = content.charAt(content.length() - 1);
     
    				if (lastLetter == Letters.SPACE || lastLetter == Letters.TAB) {
    					textQualify = true;
    				}
    			}
    		}
     
    		if (textQualify) {
    			outputStream.write(userSettings.TextQualifier);
     
    			if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH) {
    				content = replace(content, "" + Letters.BACKSLASH, ""
    						+ Letters.BACKSLASH + Letters.BACKSLASH);
    				content = replace(content, "" + userSettings.TextQualifier, ""
    						+ Letters.BACKSLASH + userSettings.TextQualifier);
    			} else {
    				content = replace(content, "" + userSettings.TextQualifier, ""
    						+ userSettings.TextQualifier
    						+ userSettings.TextQualifier);
    			}
    		} else if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH) {
    			content = replace(content, "" + Letters.BACKSLASH, ""
    					+ Letters.BACKSLASH + Letters.BACKSLASH);
    			content = replace(content, "" + userSettings.Delimiter, ""
    					+ Letters.BACKSLASH + userSettings.Delimiter);
     
    			if (useCustomRecordDelimiter) {
    				content = replace(content, "" + userSettings.RecordDelimiter,
    						"" + Letters.BACKSLASH + userSettings.RecordDelimiter);
    			} else {
    				content = replace(content, "" + Letters.CR, ""
    						+ Letters.BACKSLASH + Letters.CR);
    				content = replace(content, "" + Letters.LF, ""
    						+ Letters.BACKSLASH + Letters.LF);
    			}
     
    			if (firstColumn && content.length() > 0
    					&& content.charAt(0) == userSettings.Comment) {
    				if (content.length() > 1) {
    					content = "" + Letters.BACKSLASH + userSettings.Comment
    							+ content.substring(1);
    				} else {
    					content = "" + Letters.BACKSLASH + userSettings.Comment;
    				}
    			}
    		}
     
    		outputStream.write(content);
     
    		if (textQualify) {
    			outputStream.write(userSettings.TextQualifier);
    		}
     
    		firstColumn = false;
    	}
     
    	/**
    	 * Writes another column of data to this record. Does not preserve
    	 * leading and trailing whitespace in this column of data.
    	 * 
    	 * @param content
    	 *            The data for the new column.
    	 * @exception IOException
    	 *                Thrown if an error occurs while writing data to the
    	 *                destination stream.
    	 */
    	public void write(String content) throws IOException {
    		write(content, false);
    	}
     
    	public void writeComment(String commentText) throws IOException {
    		checkClosed();
     
    		checkInit();
     
    		outputStream.write(userSettings.Comment);
     
    		outputStream.write(commentText);
     
    		if (useCustomRecordDelimiter) {
    			outputStream.write(userSettings.RecordDelimiter);
    		} else {
    			outputStream.println();
    		}
     
    		firstColumn = true;
    	}
     
    	/**
    	 * Writes a new record using the passed in array of values.
    	 * 
    	 * @param values
    	 *            Values to be written.
    	 * 
    	 * @param preserveSpaces
    	 *            Whether to preserver leading and trailing spaces in columns
    	 *            while writing out to the record or not.
    	 * 
    	 * @throws IOException
    	 *             Thrown if an error occurs while writing data to the
    	 *             destination stream.
    	 */
    	public void writeRecord(String[] values, boolean preserveSpaces)
    			throws IOException {
    		if (values != null && values.length > 0) {
    			for (int i = 0; i < values.length; i++) {
    				write(values[i], preserveSpaces);
    			}
     
    			endRecord();
    		}
    	}
     
    	/**
    	 * Writes a new record using the passed in array of values.
    	 * 
    	 * @param values
    	 *            Values to be written.
    	 * 
    	 * @throws IOException
    	 *             Thrown if an error occurs while writing data to the
    	 *             destination stream.
    	 */
    	public void writeRecord(String[] values) throws IOException {
    		writeRecord(values, false);
    	}
     
    	/**
    	 * Ends the current record by sending the record delimiter.
    	 * 
    	 * @exception IOException
    	 *                Thrown if an error occurs while writing data to the
    	 *                destination stream.
    	 */
    	public void endRecord() throws IOException {
    		checkClosed();
     
    		checkInit();
     
    		if (useCustomRecordDelimiter) {
    			outputStream.write(userSettings.RecordDelimiter);
    		} else {
    			outputStream.println();
    		}
     
    		firstColumn = true;
    	}
     
    	/**
    	 * 
    	 */
    	private void checkInit() throws IOException {
    		if (!initialized) {
    			if (fileName != null) {
    				outputStream = new PrintWriter(new OutputStreamWriter(
    						new FileOutputStream(fileName), charset));
    			}
     
    			initialized = true;
    		}
    	}
     
    	/**
    	 * Clears all buffers for the current writer and causes any buffered data to
    	 * be written to the underlying device.
    	 */
    	public void flush() {
    		outputStream.flush();
    	}
     
    	/**
    	 * Closes and releases all related resources.
    	 */
    	public void close() {
    		if (!closed) {
    			close(true);
     
    			closed = true;
    		}
    	}
     
    	/**
    	 * 
    	 */
    	private void close(boolean closing) {
    		if (!closed) {
    			if (closing) {
    				charset = null;
    			}
     
    			try {
    				if (initialized) {
    					outputStream.close();
    				}
    			} catch (Exception e) {
    				// just eat the exception
    			}
     
    			outputStream = null;
     
    			closed = true;
    		}
    	}
     
    	/**
    	 * 
    	 */
    	private void checkClosed() throws IOException {
    		if (closed) {
    			throw new IOException(
    			"This instance of the CsvWriter class has already been closed.");
    		}
    	}
     
    	/**
    	 * 
    	 */
    	protected void finalize() {
    		close(false);
    	}
     
    	private class Letters {
    		public static final char LF = '\n';
     
    		public static final char CR = '\r';
     
    		public static final char QUOTE = '"';
     
    		public static final char COMMA = ',';
     
    		public static final char SPACE = ' ';
     
    		public static final char TAB = '\t';
     
    		public static final char POUND = '#';
     
    		public static final char BACKSLASH = '\\';
     
    		public static final char NULL = '\0';
    	}
     
    	private class UserSettings {
    		// having these as publicly accessible members will prevent
    		// the overhead of the method call that exists on properties
    		public char TextQualifier;
     
    		public boolean UseTextQualifier;
     
    		public char Delimiter;
     
    		public char RecordDelimiter;
     
    		public char Comment;
     
    		public int EscapeMode;
     
    		public boolean ForceQualifier;
     
    		public UserSettings() {
    			TextQualifier = Letters.QUOTE;
    			UseTextQualifier = true;
    			Delimiter = Letters.COMMA;
    			RecordDelimiter = Letters.NULL;
    			Comment = Letters.POUND;
    			EscapeMode = ESCAPE_MODE_DOUBLED;
    			ForceQualifier = false;
    		}
    	}
     
    	public static String replace(String original, String pattern, String replace) {
    		final int len = pattern.length();
    		int found = original.indexOf(pattern);
     
    		if (found > -1) {
    			StringBuffer sb = new StringBuffer();
    			int start = 0;
     
    			while (found != -1) {
    				sb.append(original.substring(start, found));
    				sb.append(replace);
    				start = found + len;
    				found = original.indexOf(pattern, start);
    			}
     
    			sb.append(original.substring(start));
     
    			return sb.toString();
    		} else {
    			return original;
    		}
    	}
    }

  5. #5
    Membre confirmé Avatar de djsnipe
    Inscrit en
    Mai 2008
    Messages
    440
    Détails du profil
    Informations forums :
    Inscription : Mai 2008
    Messages : 440
    Points : 493
    Points
    493
    Par défaut
    Tu as oublié d'appeler la méthode "close" à la fin pour fermer proprement (et flusher) le flux de sortie

  6. #6
    Membre à l'essai
    Inscrit en
    Février 2007
    Messages
    21
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 21
    Points : 20
    Points
    20
    Par défaut
    Impeccable, c'est ca !! Merci beaucoup !!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 1
    Dernier message: 30/01/2015, 20h37
  2. Problème d'export de donnée dans un fichier csv
    Par sab_info dans le forum Général Dotnet
    Réponses: 3
    Dernier message: 07/11/2014, 12h31
  3. Réponses: 1
    Dernier message: 15/03/2012, 09h56
  4. [PHP 4] Exporter une table dans un fichier .csv
    Par silbano85 dans le forum Langage
    Réponses: 7
    Dernier message: 20/07/2011, 11h27
  5. exporter données sql dans un fichier csv en java
    Par pinkemma dans le forum JDBC
    Réponses: 2
    Dernier message: 07/03/2007, 09h23

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo