Results 1 to 3 of 3
  1. #1
    Sabinno is offline Member
    Join Date
    May 2011
    Posts
    1
    Rep Power
    0

    Default Need Help W/ Writing to DB.

    I am attempting to create a simple register/login section for a launcher of a game.
    The input has 3 fields. userNameC , passWordC , and userAgeC .
    When I write to the DB, I use this:
    bufferedWriter.write(userNameC + "\n" + passWordC + "\n" + userAgeC + "\n");
    As you can see, the multiple instances of new lines mean it should create new lines!
    Example: userNameC = asdf , passWordC = asdf1 , userAgeC = 54
    It should write to the database as:
    asdf
    asdf1
    54
    Instead, it writes as:
    asdfasdf154
    Does anyone know why this might happen, or how to solve this issue?
    Thanks in advance!
    -Sabinno-

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    What "DB" are you using that you use a BufferedWriter rather than JDBC?

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,006
    Rep Power
    20

    Default

    I'm guessing a flat file.
    I am also guessing the OP is looking in that flat file using something like Notepad, which doesn't recognise "\n" as a new line character.

Similar Threads

  1. writing to ram
    By Timmins in forum New To Java
    Replies: 0
    Last Post: 04-03-2011, 08:52 AM
  2. Replies: 1
    Last Post: 02-27-2010, 01:29 AM
  3. Writing in XLS
    By selva.bics in forum Advanced Java
    Replies: 1
    Last Post: 11-09-2009, 09:09 AM
  4. writing to gui
    By rob in forum New To Java
    Replies: 2
    Last Post: 02-13-2009, 10:55 PM
  5. Writing to DAT or TXT file
    By hunterbdb in forum Advanced Java
    Replies: 7
    Last Post: 10-12-2008, 02:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •