Get the data from excel and insert into the database
I want to read the data from excel file, get the data from excel and insert into the database.
You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
This has nothing to do with JSP/JSTL.
Similar Messages
-
Read data from Excel and write into oracle database
Hi
I want to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
Thanks and Regards
NeetaHai,
I am suggesting the solution.
I will try out and let u know soon.
Make a coma separated file from your excel file.
Assuming that your requirement allows to make a csv file.
This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
You do not want to go via sql Loader?
For reading the excel file itself do you want java? -
Error in fetching the data from textfield and inserting to the database..
I'm using Java Swing as front end and MySQL as backend using the netbeans ide..I am trying to fetch the data from the textfiled in the form and insert to the database table.i've skipped the generated code..In the following code i get the erro cannot find symbol "stmt" in the actionPerformed method..
mport java.awt.event.*;
import java.sql.*;
public class BarcodeReader extends JFrame implements ActionListener {
public BarcodeReader() {
initComponents();
nb.addActionListener(this);
public void jdbcConnect(){
Connection con=null;
String url = "jdbc:mysql://localhost:3306/";
String db = "mynewdatabase";
String driver = "com.mysql.jdbc.Driver";
String user = "usrname";
String pass = "pwd";
try{
String s=newtxt.getText();
con=DriverManager.getConnection(url + db, user, pass);
Statement stmt=con.createStatement();
Class.forName(driver);
public void actionPerformed(ActionEvent e){
try{
jdbcConnect();
stmt.executeUpdate("INSERT into machine(mname) values '"+jTextField1.getText()+"'");
}}catch (Exception ex) {
System.out.println(ex);
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BarcodeReader().setVisible(true);
}There are far too many errors to try and clear.
For one, the exception references the actionPerformed method (according to your text), so why is that not shown here?
For another you are performing, possible time-consuming, actions, and even worse IO actions, on the event thread, which is a huge no-no.
You are not closeing your resources properly, if at all, which is another huge no-no.
You are completely mixing your "view" (the gui), and your "model" (the data related classes), which is another huge no-no.
etc, etc, etc. -
How do I import the data from Excel (.xls) file into Oracle Database table
I have an excel file with 5 columns of 5000 rows.
I have to import 5000 rows of data into my oracle table with
same column names & Data types.
What is the best advise for this ?
Thanks.
SriniYou can connect to Oracle from Excel directly. I know you can read data but am not sure if you can export data.
Other option is to import the data into Access.
Create an ODBC connection for Oracle
Use the to connect to Oracle from Access
Export data to Oracle from Access
Shakti
http://www.impact-sol.com
Developers of Guggi Oracle - Tool for DBAs and Developers -
How to extract data from xml and insert into Oracle table
Hi,
I have a large xml file. which will have hundreds of the following transaction tags having column names and there values.
There is a table one of the schema with coulums "actualCostRate","billRate"....etc.
I need to extract the values of these columns and insert into the table
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuUK" chargeCode="LCOCD1" externalID="L-RESCODE_UK1-PROJ_UK_CNT_GBP-37289-8" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-12" transactionType="L" units="11" taskID="5017601" inputTypeCode="SALES" groupId="123" voucherNumber="ABCVDD" transactionClass="ABCD"/>
<Transaction actualCostRate="0" billRate="0" chargeable="1" clientID="NikuEU" chargeCode="LCOCD1" externalID="L-RESCODE_US1-PROJ_EU_STD2-37291-4" importStatus="N" projectID="TESTPROJ" resourceID="admin" transactionDate="2002-02-04" transactionType="L" units="4" taskID="5017601" inputTypeCode="SALES" groupId="124" voucherNumber="EEE222" transactionClass="DEFG"/>Re: Insert from XML to relational table
http://www.google.ae/search?hl=ar&q=extract+data+from+xml+and+insert+into+Oracle+table+&btnG=%D8%A8%D8%AD%D8%AB+Google&meta= -
How to select the data from DB and write into File?
Hi Experts,
Can any one please help me,
I want to write the data from a table "T1" from Data Base to one file in windows.
This functionality i need to achive in SSIS package through script component and Execute SQL task if it's passible.
If any other way is there please help me.through script component and Execute SQL task if it's passible
The easier way is to use a "Data Flow" Task with a "OleDB Data Source" pointing the the SQL Server table / query and a "Flat File Destination" to export to a file.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Hi to all,
I have flat files in different location through FTP i need to fetch those files and load in the relavant table of the database.
Please share me the query to do it ..You would need a ForEach Loop to iterate though the files. Initially the FTP task will pull the files from locations to a landing folder. Once thats done the ForEachLoop will iterate through files in the folder and will have a data flow task inside to transfer
file data to tables.
If you want a more secure option you can also use SFTP (Secured FTP) and can implement it using free WinSCP clinet. I've explained a method of doing it fo dynamic files here
http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
for iterating through files see this example
http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
you may not need the validation step inside the loop in your case
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Reading xml data from url and insert into table
CREATE TABLE url_tab2
URL_NAME VARCHAR2(100),
URL SYS.URIType
INSERT INTO url_tab2 VALUES
(’This is a test URL’,
sys.UriFactory.getUri(’http://www.domain.com/test.xml’)
it is giving error as invalid characterCheck if your single quotes are the correct single quotes.
The principle works as advertised in the XMLDB Developers Guide...
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Tue Nov 25 21:44:46 2008
Copyright (c) 1982, 2008, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user OTN identified by OTN account unlock;
User created.
SQL> grant dba, xdbadmin to OTN;
Grant succeeded.
SQL> conn OTN/OTN
Connected.
SQL> CREATE TABLE uri_tab (docUrl SYS.URIType, docName VARCHAR2(200));
Table created.
SQL> -- Method SYS.URIFACTORY.getURI() with absolute URIs
SQL> -- Insert an HTTPUri with absolute URL into SYS.URIType using URIFACTORY.
SQL> -- The target is Oracle home page.
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('http://www.oracle.com'), 'AbsURL');
1 row created.
SQL> -- Insert an HTTPUri with relative URL using constructor SYS.HTTPURIType.
SQL> -- Note the absence of prefix http://. The target is the same.
SQL> INSERT INTO uri_tab VALUES (SYS.HTTPURIType('www.oracle.com'), 'RelURL');
1 row created.
SQL> -- Insert a DBUri that targets employee data from database table hr.employees.
SQL>
SQL> INSERT INTO uri_tab VALUES
2 (SYS.URIFACTORY.getURI('/oradb/HR/EMPLOYEES/ROW[EMPLOYEE_ID=200]'), 'Emp200');
1 row created.
SQL> SELECT e.docUrl.getCLOB(), docName FROM uri_tab e;
E.DOCURL.GETCLOB()
DOCNAME
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
AbsURL
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
E.DOCURL.GETCLOB()
DOCNAME
<head>
RelURL
<?xml version="1.0"?>
<ROW>
<EMPLOYEE_ID>200</EMPLOYEE_ID>
<FIRST_NAME>Jenn
Emp200
SQL> set long 1000
SQL> select HTTPURITYPE('www.oracle.com').getCLob() from dual;
HTTPURITYPE('WWW.ORACLE.COM').GETCLOB()
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN
">
<html>
<head>
<title>Oracle 11g, Siebel, PeopleSoft |
Oracle, The World's Largest Enterprise S
oftware Company</title>
<meta name="title" content="Enterprise Applications | D
atabase | Fusion Middleware | Applicatio
ns Unlimited | Business | Oracle, The Wo
rld's Largest Enterprise Software CompanEdited by: Marco Gralike on Nov 25, 2008 10:13 PM -
How to read the data from excel file and store into the table?
Hi All,
I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
All the excel fields and my table columns are same.
Can you share with me how can acheive this using LOB's?
ThanksHi OraSuirya,
you can try with external tables .
syntax as follows
create table ext_table_csv (
i Number,
n Varchar2(20),
m Varchar2(20)
organization external (
type oracle_loader
default directory ext_dir
access parameters (
records delimited by newline
fields terminated by ','
missing field values are null
location ('file.csv')
reject limit unlimited;
For this you need to create directory
Directory Creation syntax:
create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
grant read, write on directory ext_dir to <User>;
please paste the excel file in the particular directory .
I hope this will help you.
Please correct me if I am wrong anywhere .
Thanks,
Tippu. -
Problem with reading data from screen and inserting in table
hi ther,
im new to abap-webdyn pro. can anyone suggest how to read data from screen and insert into table when press 'ADD' button.
i done screen gui , table creation but problems with action. what the content of acton add.
is ther any link that helps me or tut??
thankx in advance!
regardsHi,
Create a context node for the screen fields for which you want to enter the values with cardinality 1.1.....
Now in the layout of your view bind the screen input fields to that context node(attributes) to the value property of the input fields...
Now in the action of ADD button....
--> go the wizard and select the read node button and select the node which you have created it generates the auto code for you.....
for example if the node is contains aone attribute like MATNR
reading the node from wizard will generate the code as....
DATA lo_nd_matnr TYPE REF TO if_wd_context_node.
DATA lo_el_matnr TYPE REF TO if_wd_context_element.
DATA ls_matnr TYPE wd_this->element_matnr.
DATA lv_matnr TYPE wd_this->element_matnr-matnr.
* navigate from <CONTEXT> to <MATNR> via lead selection
lo_nd_matnr = wd_context->get_child_node( name = wd_this->wdctx_matnr ).
* @TODO handle non existant child
* IF lo_nd_matnr IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_matnr = lo_nd_matnr->get_element( ).
* @TODO handle not set lead selection
IF lo_el_matnr IS INITIAL.
ENDIF.
* get single attribute
lo_el_matnr->get_attribute(
EXPORTING
name = `MATNR`
IMPORTING
value = lv_matnr ).
here the variable lv_matnr will contain the entered value......
now you can use this value for further process.
Thanks,
Shailaja Ainala. -
How to take the data from excel list to sap r/3(with time interval)
hi experts,
how to transfer the data from a third party system(if it is in format of excel) to sap r/3.with that in a particular time interval,it will delete the data from excel sheet.Hi
use the Fm
'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '2'
i_end_row = '500'
giving the starting row and column and passing the ending row and column name
Reward points if useful........
Regards,
Nitin Sachdeva -
How to get data from excel sheet present in the client(local) system?
hi,
I have to upload the data from an excel sheet present in the local system(not on the server) to the table using webdynpro.
i donot want to upload the excel file
if it is necessary to upload the file then it should be on temporary basis and it should be deleted automatically.
i can get the data from excel sheet which is present in the km using HSSF api but how to do the same if it is in local system?
if anyone has the sample application of this type please give me the link.
thanksYou can use the FM ALSM_EXCEL_TO_INTERNAL_TABLE with Web Dynpro ABAP.
-
How to read the data from Excel file and Store in XML file using java
Hi All,
I got a problem with Excel file.
My problem is how to read the data from Excel file and Store in XML file using java excel api.
For getting the data from Excel file what are all the steps i need to follow to get the correct result.
Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
Thanks & Regards,
Sreenu,
[email protected],
india,If you want someone to do your work, please have the courtesy to provide payment.
http://www.rentacoder.com -
How to Load the data from excel file(Extension is .CSV) into the temp.table
Hi
How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
Kindly Suggest the Solution.
Regards,
SachinHello Sachin,
You can use the following metalink note:How to Read Data from an EXCEL Spreadsheet into a Form Using Webutil Client_OLE2 (Doc ID 813535.1) and modify it a little bit.
Instead of copy values into forms you can save them in your temporary table.
Kind regards,
Alex
If someone's helpful or correct please mark it accordingly. -
How to load the data from excel file into temprory table in Forms 11g?
Hi
How to Load the data from excel file(Extension is .CSV) into the temporary table of oracle in Forms11g.
My Forms Version is - Forms [64 Bit] Version 11.1.2.0.0 (Production)
Kindly Suggest the Solution.
Regards,
SachinDeclare
v_full_filename varchar2(500);
v_server_path varchar2(2000);
v_separator VARCHAR2(1);
v_filename VARCHAR2(400);
filename VARCHAR2 (100);
v_stop_load varchar2 (2000);
v_rec_error_log varchar2(4000);
v_error_log varchar2(4000);
ctr NUMBER (12);
cols NUMBER (2);
btn number;
RES BOOLEAN;
application ole2.obj_type;
workbooks ole2.obj_type;
workbook ole2.obj_type;
worksheets ole2.obj_type;
worksheet ole2.obj_type;
cell ole2.obj_type;
cellType ole2.OBJ_TYPE;
args ole2.obj_type;
PROCEDURE olearg
IS
args ole2.obj_type;
BEGIN
args := ole2.create_arglist;
ole2.add_arg (args, ctr);
ole2.add_arg (args, cols);
cell := ole2.get_obj_property (worksheet, 'Cells', args);
ole2.destroy_arglist (args);
END;
BEGIN
v_full_filename := client_get_file_name(directory_name => null
,file_name => null
,file_filter => 'Excel files (*.xls)|*.xls|'
||'Excel files (*.xlsx)|*.xlsx|'
,message => 'Choose Excel file'
,dialog_type => null
,select_file => null
If v_full_filename is not null Then
v_separator := WEBUTIL_CLIENTINFO.Get_file_Separator ;
v_filename := v_separator||v_full_filename ;
:LOAD_FILE_NAME := substr(v_filename,instr(v_filename,v_separator,-1) + 1);
RES := Webutil_File_Transfer.Client_To_AS(v_full_filename,"server_path"||substr(v_filename,instr(v_filename,v_separator,-1) + 1));
--Begin load data from EXCEL
BEGIN
filename := v_server_path||substr(v_filename,instr(v_filename,v_separator,-1) + 1); -- to pick the file
application := ole2.create_obj ('Excel.Application');
ole2.set_property (application, 'Visible', 'false');
workbooks := ole2.get_obj_property (application, 'Workbooks');
args := ole2.create_arglist;
ole2.add_arg (args, filename); -- file path and name
workbook := ole2.get_obj_property(workbooks,'Open',args);
ole2.destroy_arglist (args);
args := ole2.create_arglist;
ole2.add_arg (args, 'Sheet1');
worksheet := ole2.get_obj_property (workbook, 'Worksheets', args);
ole2.destroy_arglist (args);
ctr := 2; --row number
cols := 1; -- column number
go_block('xxx');
FIRST_RECORD;
LOOP
--Column 1 VALUE --------------------------------------------------------------------
olearg;
v_stop_load := ole2.get_char_property (cell, 'Text'); --cell value of the argument
:item1 := v_stop_load;
cols := cols + 1;
--Column 2 VALUE --------------------------------------------------------------------
olearg;
:item2 := ole2.get_char_property (cell, 'Text'); --cell value of the argument
cols := cols + 1;
--<and so on>
ole2.invoke (application, 'Quit');
ole2.RELEASE_OBJ (cell);
ole2.RELEASE_OBJ (worksheet);
ole2.RELEASE_OBJ (worksheets);
ole2.RELEASE_OBJ (workbook);
ole2.RELEASE_OBJ (workbooks);
ole2.RELEASE_OBJ (application);
END;
--End load data from EXCELPlease mark it as answered if you helped.
Maybe you are looking for
-
My plasma supports 1080p @ 24fps or 1080i@50/60- my 2 Bluray players appear and HD sat box all appear as 1080 sources. (The panel itself is an older 768x768 but as I said still accepts a 1080 signal) But ATV only appears as a 750p source, and I'm gu
-
The date and time of files created and saved are off
I notice that under the date modified column, files that I have saved or updated are usually a day off. I checked the date and time in the system preferences and it is correct. is something wrong with the battery?
-
Approval workflow of purchase requisitions after EhP4
Hi all, After implementing a new support package installation (Ehp4), there are some purchase requisitions that get their approval workflow started again even after purchase order has been created. Is there someone that could give me some help on thi
-
[SOLVED] wireless problems
I've installed ndiswrapper and loaded the .inf file it said hardware and driver present. I can iwconfig and see my connection but I can't iwlist wlan0 scan, it says no scan results. I can't seem to set the ESSID, it is called default, I called it lik
-
Interface program to transmit billing docs as edi 810
Hi experts, I am new to ale/edi/idocs. I need to develop an interface program to transmit billing documents in a text file for sending them as edi 810 docs. Can anyone give me some idea on how to deal with this? Thanks a lot... Regards, Abhinav M