read files and upload in database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • IVETH
    New Member
    • Feb 2007
    • 6

    read files and upload in database

    Hi

    Can anyone provide an example of how to read files in java and upload this information to the database ?

    Thanks
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by IVETH
    Hi

    Can anyone provide an example of how to read files in java and upload this information to the database ?

    Thanks
    Here is a link on Java File IO.

    As for the database question, you're going to have to download your driver, either put it in your classpath or attach it to your program, create a connection, and upload. How you do this is dependent on what type of database you are connecting to.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by IVETH
      Hi

      Can anyone provide an example of how to read files in java and upload this information to the database ?

      Thanks
      What type of files? .txt, .pdf, .doc, .xml?

      Comment

      • IVETH
        New Member
        • Feb 2007
        • 6

        #4
        thaks for your help, but I need to read files in java and upload this information to the database with a Web Applications

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by IVETH
          thaks for your help, but I need to read files in java and upload this information to the database with a Web Applications
          Are you going to tell us what tpye of files they are?

          Comment

          • IVETH
            New Member
            • Feb 2007
            • 6

            #6
            Originally posted by r035198x
            Are you going to tell us what tpye of files they are?
            thaks for your help, I need to read files.txt in java and upload this information to the database using Java Beans

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #7
              Originally posted by IVETH
              thaks for your help, I need to read files.txt in java and upload this information to the database using Java Beans
              Are you able to connect to the database then. If they are .txt files then reading is not going to be a problem. You can use Scanner or FileReader. What you need to do is make sure you've got your database connection right. What is the structure of the data in the text files and how do you want it to be structured in the database.

              Comment

              • IVETH
                New Member
                • Feb 2007
                • 6

                #8
                Please, can you give a code example?
                Thanks

                Comment

                • sicarie
                  Recognized Expert Specialist
                  • Nov 2006
                  • 4677

                  #9
                  Originally posted by IVETH
                  Please, can you give a code example?
                  Thanks
                  Not really, there aren't enough details. What database are you using? How do you want to connect - with what driver?

                  So you understand the FileReader/Scanner portion?

                  Comment

                  • r035198x
                    MVP
                    • Sep 2006
                    • 13225

                    #10
                    Originally posted by IVETH
                    Please, can you give a code example?
                    Thanks
                    For which part? Have you written anything yourself yet? Write the file reading part first.

                    Comment

                    • IVETH
                      New Member
                      • Feb 2007
                      • 6

                      #11
                      Originally posted by sicarie
                      Not really, there aren't enough details. What database are you using? How do you want to connect - with what driver?

                      So you understand the FileReader/Scanner portion?
                      I am using Oracle 9i, i want to do a java bean that read the file and save the information in the database.
                      Thanks

                      Comment

                      • r035198x
                        MVP
                        • Sep 2006
                        • 13225

                        #12
                        Originally posted by IVETH
                        I am using Oracle 9i, i want to do a java bean that read the file and save the information in the database.
                        Thanks
                        Well start on it. When you get stuck with the code post and then we'll be able to help.

                        Comment

                        • IVETH
                          New Member
                          • Feb 2007
                          • 6

                          #13
                          Originally posted by r035198x
                          Well start on it. When you get stuck with the code post and then we'll be able to help.
                          I have the code to connect to a database, i need only the instructions for read the text file then i have to upload that contents into a table.

                          Comment

                          • sicarie
                            Recognized Expert Specialist
                            • Nov 2006
                            • 4677

                            #14
                            Originally posted by IVETH
                            I have the code to connect to a database, i need only the instructions for read the text file then i have to upload that contents into a table.
                            http://www.google.com/search?hl=en&q...=Google+Search http://www.google.com/search?hl=en&q...=Google+Search

                            The first links (the javadocs) will probably be the most helpful to you.

                            Comment

                            • r035198x
                              MVP
                              • Sep 2006
                              • 13225

                              #15
                              Originally posted by IVETH
                              I have the code to connect to a database, i need only the instructions for read the text file then i have to upload that contents into a table.
                              The tip of the week talks about how to read files.

                              Comment

                              Working...