excel to database

excel to database

How to export data from excel sheet to mysql database by using java with request parameter

Here q=40 is a request parameter ..request parameter using i export the all data to database

View Answers

June 25, 2011 at 10:40 AM

<%@page import="java.io.*,java.sql.*,java.util.*,jxl.*, jxl.read.biff.BiffException"%>

<%
ArrayList<String> list1=new ArrayList<String>();
ArrayList<String> list2=new ArrayList<String>();
ArrayList<String> list3=new ArrayList<String>();
    Cell rowData[] = null;
    int rowCount = 0;
    int columnCount = 0;

       WorkbookSettings ws = new WorkbookSettings();
       Workbook workbook = Workbook.getWorkbook(new File("C:/data.xls"), ws);

        Sheet s = workbook.getSheet(0);
        rowCount = s.getRows();
        columnCount = s.getColumns();
        for(int i = 1; i < rowCount; i++){
            rowData = s.getRow(i);
            if(rowData[0].getContents().length() != 0){ 
                for(int j = 0; j < columnCount ;j++){
                 switch(j){
                    case 0:
                        System.out.println("ID: "+rowData[j].getContents());
                        list1.add(rowData[j].getContents());
                        break;
                    case 1:
                        System.out.println("Name: "+rowData[j].getContents());
                        list2.add(rowData[j].getContents());
                        break;
                    case 2:
                        System.out.println("Address: "+rowData[j].getContents());
                        list3.add(rowData[j].getContents());
                        break;
                       }
                    }
                 }
        }
    workbook.close(); 
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia","root", "root");
    Statement st=conn.createStatement();
        for(int i=0;i<list1.size();i++){
        String id=list1.get(i).toString();
        String name=list2.get(i).toString();
        String address=list3.get(i).toString();
        st.executeUpdate("insert into data(id,name,address) values('"+id+"','"+name+"','"+address+"')");
    }
    out.println("Data is successfully inserted into the database");
%>









Related Tutorials/Questions & Answers:
Excel to database
Excel to database  Hi I want to update SQL database with the values from excel using java code. Can you help me
excel to database
excel to database   How to export data from excel sheet to mysql database by using java with request parameter Here q=40 is a request parameter ..request parameter using i export the all data to database   <
Advertisements
get values from Excel to database
get values from Excel to database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel file that should go to database which exists. am using SQL Server management studio
write excel file into the oracle database
write excel file into the oracle database  dear sir, i need the jsp code that reads the excel file and stores it into the oracle database table..and also i need the code to connect oracle database? thank u in advance
jsp with excel sheet data uploading into database
jsp with excel sheet data uploading into database  how to upload data in excel sheet with jsp into oracle 10g database
how to import excel sheet into mysql database and save it as a table in database
how to import excel sheet into mysql database and save it as a table in database  sir, i want to import an excel sheet into a MySQL database and after importing it i want to store the excel sheet as a table in database
How to insert rows from Excel spreadsheet into database by browsing the excel file?
How to insert rows from Excel spreadsheet into database by browsing the excel file?  I want to insert rows from excel sheet to database.for this i... excel file and insert rows into MSSQL database in JSP???   Have a look
insert values from excel file into database
the following link: Insert values from excel file to database...insert values from excel file into database   hi i want to insert values from Excel file into database.Whatever field and contents are there in excel
How to transfer the excel content on consol to the database
How to transfer the excel content on consol to the database   Hi I have write the java code with which I am able to read the excel file and display... to the database using mySQL.Could you please help me in doing what I need.Provide a code
Import Excel file(date) into mysql database in php
Import Excel file(date) into mysql database in php  I try to import excel file which contains data date(yyyy-mm-dd) into mysql database in php...(); //connect to the database $connect = mysql_connect("localhost","root",""); mysql
export data from database to excel sheet - JDBC
export data from database to excel sheet  I am facing a problem about exporting required data from database table to ms-excel sheet.i mean whenever I execute a query then result will be display in MS-EXCEL sheet. please give me
Excel File data upload into postgresql database in struts 1.x
Excel File data upload into postgresql database in struts 1.x  Dear members please explain how Excel Files data upload into postgresql database in struts 1.x
How to browse excel file and stored the contents into the database using jsp/servlet?
How to browse excel file and stored the contents into the database using jsp/servlet?  Hi.. I want to browse excel file and stored the file data into the My-sql database using jsp/servlet
Read code from excel sheet and upload into database using JSP
Read code from excel sheet and upload into database using JSP  I want to upload data to database from an excel worksheet using jsp ...Please help
Read data from excel file and update database using jsp
Read data from excel file and update database using jsp  read data from excel file and update database using jsp Hi, I am using a MySQL database... upload excel file and update database using JSP ? Thanks in Advance
Upload Excel into Database Table Using SERVLET - JSP-Servlet
Upload Excel into Database Table Using SERVLET  Hi i hava sitution that upload .xls file into database table which has same coloumn names... in database table are NAME,ID,SAL. please help me to upload that excel using
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
insert rows from Excel sheet into a database by browsing the file
insert rows from Excel sheet into a database by browsing the file  hello, I am trying to insert rows from Excel sheet into SQL database by browsing Excel file in java(JSP). I can insert rows using ODBC connetion. But using odbc
how read excel data into database using struts2 with hibernate
how read excel data into database using struts2 with hibernate   hi friends, i am venkat i am started learning struts 2, please help me how to read excel data into database using struts2 with hibernate, please show me
how to read values from excel sheet and compare with database using jsp
how to read values from excel sheet and compare with database using jsp  hi sir i am arun how to read values from excel sheet and compare with database using jsp coding i.e, if i have 6(assetid,assetname,serialno,cubical
Export data in excel sheet via Browse and upload button into mysql database
Export data in excel sheet via Browse and upload button into mysql database  how to create a Browse & Upload Buttons and then save the information from it in mysql database's Table Am using struts2,hibernate for making
How to save excel sheet into mysql database using blob or clob
How to save excel sheet into mysql database using blob or clob  Hi All, I am new to java and i need to upload excel sheet to mysql, please suggest me the steps to do this, i am able to connect to the database, from there i don't
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database
How to retrieve file name and path of an excel spreadsheet imported into Oracle Database  I imported an excel spreadsheet using sql developer into my Oracle database and I want to know how to retrieve the path of the file
Retrieve Data from the database and write into excel file
Retrieve Data from the database and write into excel file. In this section, we are going to retrieve data from the database and write into the excel file..., we have inserted the database table values in the excel sheet. Here
How to export data from database to excel sheet by using java in standalone project
How to export data from database to excel sheet by using java in standalone project  How to export data from database to excel sheet by using java in standalone project
How to read excel data and store it in database - Java Beginners
How to read excel data and store it in database  Hi, I want a java code to read data from excel and store it in Ms Access database.I tried the code but but its printing the output in console.I dont know how to store the excel
upload a file into database and progrm should support excel and text and csv file formats
upload a file into database and progrm should support excel and text and csv file formats  Hai all, I need a program to upload a file into database table... and the program should support .excel ,.txt ,.csv file formats. can
Insert excel file data into database Using Java Programming
Insert excel file data into database in Java Program In this PHP tutorial section, you will learn how to insert excel file data into the database. We have used Jakarta POI api for inserting excel file data into database in this purpose
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
excel
excel  how to save excel sheet data into the database using poi api?   import java.io.*; import java.sql.*; import java.util.*; import java.util.regex.*; import org.apache.poi.hssf.usermodel.
in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats.
in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats.  in Spring MVC, i would like to download my Mysql database table in pdf,msword,excel formats: in View: radio buttons: pdf 2. mswod
Insert data in Excel File from Database using JSP
developed a application to insert data  in excel file from database in JSP. We... will retrieve the data from database, create an excel file and data insert... Insert data in Excel File from Database  using JSP 
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database using jsp or oracle???  sir.. i have number of excel sheets which... be inserted into oracle database.. please help me sir...   hi friend
excel
excel  how to read columns values of excel file in java and store in array list in java like col1 col2 2 3 1 7 7 9 then list1 have values of col1 and list2 have values of col2...  
How to export data from database to excel sheet by using java swing in standalone project - Java Beginners
How to export data from database to excel sheet by using java swing... database to excel sheet by using java swing in standalone project.I get solution from..., that will take the database vales from JTable to Excel sheet. import
JSP to Excel - JSP-Servlet
JSP to Excel  Need an example of JSP and Excel database connection. Thanks
JSP TO EXCEL
JSP TO EXCEL  Hi sir/mam, How to import data to excel using jsp without retrieving database.   friend, you can't import excel data into the middle of an HTML pages (your JSP will result in an HTML page
insert excel sheet into mysql as a table
insert excel sheet into mysql as a table  sir, i want to import an excel sheet into mysql5.0 database as in the table format using tomcat 6.0 by jsp
Database
Database  Hi, i need help building a database based on something like...), multiplicity (or cardinality), in the context of the database system (i.e. give... form for the final handup (try Excel or Visio)) Develop a Scheme based
JDBC to EXcel
JDBC to EXcel  How to insert data in excel sheet from java
database
database  database
database
database  database application
JAVA EXCEL
JAVA EXCEL  How to read the contents of an excel, perform some calculation and wrote the calculated values to another excel using poi
excel to ms access
excel to ms access  hello sir i am developing a application which requires extracting data from excel sheet and place in the ms access database using java programming for example: in excel sheet i have 2 columns and more than
download excel
download excel  hi i create an excel file but i don't i know how to give download link to that excel file please give me any code or steps to give download link
how to display data in excel sheet?
how to display data in excel sheet?  According to the user Id,some links will be generated from the database,and if we click a link,data would be retrieved from the database and data will be displayed in a new page.in this page
odbc MS EXCEL
odbc MS EXCEL  hey my whole database is stored in MS Excel. so please tell me that can we connect to that database. if yes, how to do that. please help me out i am doing it in netbeans can please tell me the steps
JAVA_EXCEL
JAVA_EXCEL  I need to read the all the contents of excel which has... content another excel. For example if I have three tabs in an excel with some contents... to another excel. Please help me out with this problem
Sql to excel
Sql to excel  How to convert a Sql Data into excel Doc with Using Netbeans
database
database  the code for initializing the database connection

Ads