Fetch Records from SQL database and convert into XML file

Fetch Records from SQL database and convert into XML file

Hi Experts, I want a complete end to end code for the below requirement. I would like to explain you the below requirement into 3 steps. cases. I request you to please provide me the code to FULFIL my requirement....

1) Fetch all the records from a SQL VIEW (not from original table) based on the query "SELECT * from AMAR_VIEW WHERE CLASS = 'TENTH" & SIGN = 'AAA' " List of fields below fields as example: - Fields are; - TIMESTAMP,ROLLNO,FROMID,SIGN,CLASS

2) Once you Select lets say 10 records from table / view then you need to Update the selected records only based on the UNIQUR KEY FIELD --> ROLL_NO and what ever the you selected rows those only needs to be update the Signature field SIGN from 'AAA' to 'BBB'

3) Once you Update there immediately then you need to push and output XML file with all records into a single XML with containing as Row's.

Please see the output XML: - I need output XML File as: -

**

<?xml version="1.0" encoding="utf-8"?>
<ns:MT_TestingSQL xmlns:ns="http://abcd.com//SQL_to_File">
    <row>
        <TIMESTAMP>20101107094853</TIMESTAMP>
        <ROLL_NO>112</ROLL_NO>  // UNIQUE KEY FIELD 
        <FROM_ID>SQL01</FROM_ID>    
        <SIGN>AAA</SIGN>        // FLAG = Intially it will comes as W21 once you select 10 records lets say ex: -  then you need to UPDATE Only those Selected fields only with status field SIGN = 'AAA'
        <CLASS>TENTH</CLASS>
    </row>

**

Kindly provide me the JAVA CODE for generating the output XML file.

Regards Amar Srinivas Eli

View Answers

November 7, 2010 at 11:58 AM

I prefer to go for SAX Parser while creating the XML file after fetching the records.

Also please try to use Isolation level as "SERIALIZABLE" Concept while implementing the code it means stating that it will lock the view while accessing the database so that new records will not get insert into the same time while my code is accessing.

Also please update the records in a control way based on ROLL_NO

Thanks in Advance


November 7, 2010 at 11:58 AM

I prefer to go for SAX Parser while creating the XML file after fetching the records.

Also please try to use Isolation level as "SERIALIZABLE" Concept while implementing the code it means stating that it will lock the view while accessing the database so that new records will not get insert into the same time while my code is accessing.

Also please update the records in a control way based on ROLL_NO

Thanks in Advance









Related Tutorials/Questions & Answers:
Fetch Records from SQL database and convert into XML file
Fetch Records from SQL database and convert into XML file  Hi Experts... provide me the code to FULFIL my requirement.... 1) Fetch all the records from... and output XML file with all records into a single XML with containing as Row's
Fetch user records from a table in database
Fetch user records from a table in database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
Advertisements
How to convert XML file to database ?
How to convert XML file to database ?  How to convert XML file to database
PHP SQL Fetch
; PHP SQL Fetch is used to fetch the records from Mysql database to PHP... to fetch the records from database to server side scripting. Before accessing..._TO_REPLACE_1 The Tutorial illustrate an example from PHP SQL Fetch. To understand
reading the records from a .xlsx file and storing those records in database table
reading the records from a .xlsx file and storing those records in database table  Here is my requirement, I want to read the records from a .xlsx file and store that records in database table. I tried like this public class
data insertion from xml file to database table
data insertion from xml file to database table  Hi all, I have data in the XML file. I need to insert it into table in the database using servlet. so please reply me . ThankYou
insert rows from browsed file to sql database
insert rows from browsed file to sql database  i need to insert rows from excel to database by browsing the file in jsp. by connecting both..., content of the file has to go to database. how can i insert record into database
PHP WHERE clause example to fetch records from Database Table
on the MYSQL Server and will fetch the results from the database table employee... the data within the MYSQL database table. You can also fetch the results using...You can query a MYSQL database based on multiple conditions. PHP & MYSQL
MySql Databse query to fetch results from database and display it in HTML File
MySql Databse query to fetch results from database and display it in HTML File  Hi. I have a field in database named stages. its datatype is varchar... to retrieve these data from the field table. Actually they are separated by comma
fetch data from database in javascript
fetch data from database in javascript   How to fetch data from database in JavaScript when it is a leap year
how to display records from database
how to display records from database  I want to display records from database in tables, the database is having 2000 records and i want to display 20 records at a time and to use next and previous link buttons to show
Write records into text file from database
Write records into text file from database You have already learnt how to insert records from text file to database. But here we are going to retrieve records from database and store the data into the text file. For this purpose, we have
Data needs to be gathered in XML file from the database (MySql) using JSP
Data needs to be gathered in XML file from the database (MySql) using JSP ... data regarding particular id from the database table. Data needs to be gathered in XML file from the database (MySql) using appropriate JSP/Java Bean functions
Need solution to get values for XML namespace tags from SQL database in Java
Need solution to get values for XML namespace tags from SQL database... comp:loc=" "/> now i need to get values from sql database for values... and created xml tags in separate file. please provide me solution to get values for xml
Create XML file from flat file and data insert into database
Create XML file from flat file and data insert into database... have developed an application to create xml file from flat file and data... After run Successfully Create an  XML file "flatfile.xml"
Export SQL database schema from SQL server management studion express2005 into MS excel file
Export SQL database schema from SQL server management studion express2005 into MS excel file  HI I need to export Database Schema from SQL Server.... but i need to have Excel file contains database schema. how can i do with SQL
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C
Data fetch from multiple SQL tables - Hibernate
Data fetch from multiple SQL tables   I am in the process of writing my first hibernate application. I have a sql query that fetches data from... chapter 13 example that fetches data from one table. Please advice. SQL from
how to convert .xml file to csv file
how to convert .xml file to csv file  how to convert .xml file to csv file
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
storing records which of a file into a table of mssql database
storing records which of a file into a table of mssql database  I have a requirement like this, A file contains some records with headers same as column names of a table. I have to store those records into a table
questions from an xml file
questions from an xml file  i am developing online bit by bit exam for that i retrieved questions from an xml file but when i retrieved using jsp i am getting all questions at a time in a single page.but i want to show one
create a xml from sql server 2005 - XML
create a xml from sql server 2005  hello Dear, i want to know how we create a xml file which retrieve data from Sql server 2005 using java. i... with the name as 'student' i want to create a xml file from the table values which
Storing records of a file inside database table in java
Storing records of a file inside database table in java  Here is my requirement, I have a file which contains some number of records like... the records inside the database except headings (Here sid,sname,age are headings
SQL Bulk Insert csv
SQL Bulk Insert csv       SQL Bulk Insert is used to import the records from csv  file... The Tutorial covers an example from 'SQL Bulk Insert CSV'.To understand and 
retrieving xml document from database
retrieving xml document from database  Hi Guys, I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature. Thank You Madhu
Displaying file from database
Displaying file from database  I have list of files in my database. I... that corresponding file from database. I have list of file id related to search. I want... * from file"; ResultSet rs = stmt.executeQuery(strQuery); while(rs.next
how to fetch values from .properties to a html file
how to fetch values from .properties to a html file  I have a .properties file with some key value pairs in it. I need to fetch the values from this .properties file into a html file.Please let me know how to do
MySql Databse query to fetch results from database
MySql Databse query to fetch results from database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
JAXB Create XML File And Get Data From XML
JAXB Create XML File And Get Data From XML In this section we will read about how to create XML file and how to convert XML file's data to Java Object... to write the Java Objects into a XML file and unmarshal() method to read XML
retrieving newly added records from mssql database and display in a jsp
retrieving newly added records from mssql database and display in a jsp ... from mssql database table and display those records in a jsp.And i have to delete these 10 records from the jsp and retrieve the next recently added 10 records
Solution to get vaues for xml tags fform sql database in java
Solution to get vaues for xml tags fform sql database in java  hi I...; now i need to get values from sql database for values in the blank field... in separate file. please provide me solution to get values for xml tags from
how to convert text file to xml file in java. - XML
how to convert text file to xml file in java.  Hi all, I m having some problem. Problem is I want to convert a text file which is having the no of record(i.e no of different line of information)to a xml file through java
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table as if i am trying following String query = "select * from LTCINFO.PERSONS"; st1
fetch values from database into text field
fetch values from database into text field  please provide the example for fetching values from database into text field of table wth edit... * from LTCINFO.PERSONS"; st1 = con.createStatement(); rs = st1.executeQuery(query
converting an xml file in relational database objects
converting an xml file in relational database objects  converting an xml file in relational database objects
Select tag to fetch data from oracle database
Select tag to fetch data from oracle database  I created a select box... of a student and when regnno is selected from the drop down list by a user... oracle database.Similarly when address will be selected by the user from
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C#. <?xml version="1.0" ?> <!DOCTYPE PubmedArticleSet (View Source
create the SQL tables from an XML schema
create the SQL tables from an XML schema  I'm using Eclipse, Please let me know if anyone developped an application that would automatically create the SQL tables from an XML schema
How to fetch entries/values from database to a jsp page one by one?
How to fetch entries/values from database to a jsp page one by one?  I have a table in Microsoft SQL server Management Studio with two columns title... to display different database entries of the each column in different blocks. Now
How to create a .mdf file from script (.sql)
How to create a .mdf file from script (.sql)  Hi, I have a sql database in 2008 server. now i want it to convert to 2005. so i script it. just help me to create a .mdf file back from the script
Need Solution to get vaues from sql database in java
file. please provide me solution to get values for xml tags from database...Need Solution to get vaues from sql database in java  hi I have... need to get values from sql database for values in the blank field(" "). how do i
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java ...:loc=" "/> now i need to get values from sql database for values in the blank... xml tags in separate file. please provide me solution to get values for xml tags
fetch record from oracle database using jsp-servlet?
fetch record from oracle database using jsp-servlet?  how can i fetch data from oracle database by using jsp-servlet. i'm using eclipse, tomcat server and oracle database and creating jsp pages and also using servlet
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend, -------------------------------------------- Visit for more information
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I need to retrieve the records from the database for every 7 seconds and display... it is not right way. I have written a following servlet to get the records from
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
Convert text file to XML file in Java
Convert text file to XML file Java In this section, you will learn how to convert the text file into xml file in Java language. To do this, we have used... that Transformer class process XML from a variety of sources and write
Uploading a Profile with image[file] into a sql database
Uploading a Profile with image[file] into a sql database  I need to upload a file along with the some text into a database ......[ Similar to http... , but upload file to database ] ... Pls help

Ads