8 Replies Latest reply: Dec 12, 2006 4:37 AM by 807607 RSS

    byte []

    807607
      Hi you all,

      I know this questions might have been asked a couple of times here but I am not been able to find a way of doing it.

      How can a get a stream of bytes from an byte[] ??

      Unfortunnately my java.io skills aren't that great... Any help is welcome.


      MeTitus
        • 1. Re: byte []
          807607
          java.io.ByteArrayInputStream
          • 2. Re: byte []
            807607
            In this case what I need to do is construct an sql statement to insert a blob into a database. I could use prepared stmts, but before you guys give that hint, I can do it at this time as it would delay some things here.

            In c# a would just place the byte[] in the statement and that would work, but it looks that it is a bit different in java...


            MeTitus
            • 3. Re: byte []
              807607
              In this case what I need to do is construct an sql
              statement to insert a blob into a database. I could
              use prepared stmts, but before you guys give that
              hint, I can do it at this time as it would delay some
              things here.
              You won't like this but - use a prepared statement! There are methods on a prepared statement that make this easy!
              • 4. Re: byte []
                807607
                I know but I wasn't the one who started the application in the first place, and right now there isn't time to change that... it will be done latter eventually... I saw some method that does it, in the ResultSet interface, but I don't really don't know how to get this done without using prepared stat...

                thanks sabre150

                MeTitus
                • 5. Re: byte []
                  807607
                  I know but I wasn't the one who started the
                  application in the first place, and right now there
                  isn't time to change that...
                  If I want to drive a wood screw into a plank of wood I use a screwdriver not a spanner.
                  it will be done latter
                  eventually... I saw some method that does it, in the
                  ResultSet interface, but I don't really don't know
                  how to get this done without using prepared stat...
                  Then learn! 1Hour tops!
                  • 6. Re: byte []
                    807607
                    Its not that I don't know, if that was the case, I am always keen to learn new stuff, but at the moment it is impossible to change our code,, I can't belive there isn't one way of doing it without...

                    MeTitus
                    • 7. Re: byte []
                      807607
                      Its not that I don't know, if that was the case, I am
                      always keen to learn new stuff, but at the moment it
                      is impossible to change our code,,
                      I dont' buy this! You have to change the code whatever happens.
                      I can't belive
                      there isn't one way of doing it without...
                      OK, spend the next week trying to put the screw in the plank of wood using a spanner. Then, when you have made a mess of the screw and the plank of wood, learn to use a screwdriver.
                      • 8. Re: byte []
                        807607
                        Ok sabre150 a got it... it seems I have no other way of doing it, at least if I don' want to spend one week trying to figure out one way of doing it without reinventing the wheel...

                        Many thanks ;)

                        MeTitus