3 Replies Latest reply: Mar 23, 2013 5:15 AM by rukbat RSS

    Accessing Data from a database and exporting them to xml using java

    997240

      Hello
      Is it there any way to convert/export a database table(like in Oracle or MySQL) schema into an XML schema using NetBeans 7.0.1 ? Or can u help me with java code in this regard?
      When we access the data into Jtable , does it hold the schema ?

      Please help
      Thank you

        • 1. Re: Accessing Data from a database and exporting them to xml using java
          rp0428
          >
          Is it there any way to convert/export a database table(like in Oracle or MySQL) schema into an XML schema using NetBeans 7.0.1 ? Or can u help me with java code in this regard?
          >
          Your question doesn't make sense.

          1. NetBeans is a GUI development tool it doesn't do anything by itself. You have to write code to do the things you want to do.

          2. You don't put anything into an XML schema; a schema defines the allowable content of an XML data file.

          Do you want the DATA from a table in the format of an XML data file?

          With Oracle that is easy; just use the DBMS_XMLGEN package and provide the query for the data that you want:
          select dbms_xmlgen.getxml('select * from emp where empno = 7369') from dual
          
          <?xml version="1.0"?>
          <ROWSET>
           <ROW>
            <EMPNO>7369</EMPNO>
            <ENAME>SMITH</ENAME>
            <JOB>CLERK</JOB>
            <MGR>7902</MGR>
            <HIREDATE>17-DEC-80</HIREDATE>
            <SAL>800</SAL>
            <DEPTNO>20</DEPTNO>
           </ROW>
          </ROWSET>
          What do you mean by:
          >
          When we access the data into Jtable , does it hold the schema ?
          >
          You need to explain your question with some more detail. A JTable is just a container. It doesn't hold anything until you put something into it. Then it holds whatever you put into it.
          • 2. Re: Accessing Data from a database and exporting them to xml using java
            997240
            Thanking you for ur valuable suggestions.

            The reason I mentioned NetBeans is that I am creating an application to export the table data from the database to an XML document as an output file on the disk , and for this I am using XML editor of NetBeans 7.0.1.

            But when I run the xml query on XML editor select dbms_xmlgen.getxml('select from hr.departments') from dual;* , the xml document is created as output on NetBeans UI , which I actually want to be saved as an xml file on the disk.

            I want my application's GUI to be looked in a way that when a particular table from the database is taken as input , while im connected to the database on a local server , and convert to XML button is clicked , it should be saved on the specified location on the disk.

            Is this job possible to perform using NetBeans ?

            Please help . Need your suggestion.

            Thank you.
            • 3. Re: Accessing Data from a database and exporting them to xml using java
              Six days ago, you started a forum thread on a topic and then abandoned it when you hijacked your own post.
              Problem connecting with Oracle 10 xe - Error:got minus one from a read call

              You hijacked it three day ago to ask this "how do I convert a file from one format to another" question.
              You were told that the file conversion question had NOTHING to do with JDBC and you should find a forum that covers that kind of subject.

              So, what do you do? You post this new "how do I convert a file from one format to another " question in the same JDBC forum.

              +... locking this off-topic post...+