.txt or CSV file to Database
Hi-
I have a text file generated by a Pulse Oximeter, What I want is, as the system recieves the file (in .txt of CSV) it automaticly is entered into a MySql Database or SQL Server and generates an SMS message. Thanks
Regards
Tayyab Hussain
Web services imply using sychronous communication. However, the use case you describe implies that asynchronous, so-called fire-and-forget, communication is better suited to your needs.
For example, with sychronous communication, the system is unaware of the exact moment a TXT or CSV file will come in. Also, when the system is processing a file, all other processing waits until the system finishes. This may cause synchronicity problems if multiple files come into the system in quick succession.
ColdFusion has an asynchronous solution that suits every requirement of your use case. The following methods will enable you to receive the file, to automatically enter it into the database and to generate an SMS message. Use ColdFusion's DirectoryWatcher gateway to monitor the directory in which the TXT or CSV files are dropped, and ColdFusion's SMS event gateway to send SMS messages.
Whenever a third party drops a file into the directory, an event is triggered, setting the DirectoryWatcher into action. Implement a query in the onAdd method of the DirectoryWatcher's listener CFC to store the file in the database. Following the query, use the sendGatewayMessage method to send the SMS message.
Similar Messages
-
Error for the uploading csv file to database
Hi i tried to upload the csv file to database and i am getting error as
<cffile action="read" file="#data_dir_upload#/di_audit_corp_upc_ldr_tbl.csv" variable="di_audit_corp_upc_ldr_tbl">
<!--- loop through the CSV-TXT file on line breaks and insert into database --->
<cfloop index="index" list="#di_audit_corp_upc_ldr_tbl#" delimiters="#chr(10)##chr(13)#">
<cfquery datasource="#request.dsnCAO#">
<!--- SET ANSI_WARNINGS OFF --->
INSERT INTO [dbo].[di_audit_corp_upc_ldr_tbl]
( cpt_dpt_cd,cpt_com_cd,sub_com_cd,con_upc_no,pid_lng_dsc_tx,pid_sht_dsc_tx)
VALUES
(<cfqueryparam value='#left(trim(listgetAt('#index#',2,',')),2)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',3,',')),3)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',4,',')),5)#' cfsqltype="cf_sql_char">,
<cfqueryparam value='#left(trim(listgetAt('#index#',1,',')),13)#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#left(trim(listgetAt('#index#',5,',')),25)#' cfsqltype="cf_sql_varchar">,
<cfqueryparam value='#left(trim(listgetAt('#index#',6,',')),12)#' cfsqltype="cf_sql_varchar">)
</cfquery>
</cfloop>
Error:
An error occurred while executing DTS package to import data.
Invalid list index 6.
In function ListGetAt(list, index [, delimiters]), the value of index, 6, is not a valid as the first argument (this list has 5 elements). Valid indexes are in the range 1 through the number of elements in the list.
i am unable to solve this issue can any one will help me to solve this issue
Thanks,
KiranI take it your are trying to use a csv file to insert new data into a database, using flex and coldfusion?
if so, then I would load the file in flex using cffile in ColdFusion and then use Load Data if you are using MySQL
This can show you more about it.
http://blog.tygate.com/?p=75
We get very large csv files ftp'd to us every week, and we have to load them in to the db. this works for us. -
Insert Data into Table from TXT or CSV file !!!!!
Dear All,
Recently I have started working on APEX. In Oracle Forms, we used to use TEXT_IO for inserting records into tables from txt files. Now I want to do the same thing in apex 3.2. How can I insert data into tables from txt of csv files.
Waiting of your valuable suggestions.
With kind regards,
Yousuf.Yousuf
wwv_flow_files is used by APEX to hold uploaded files.
If you incorporate a file browse item on you page, browse for the selected file, then submit the page (having the PL/SQL process described as an on suibmit process) then what I detailed should work.
If you don't need users to have access to this then just go to Home>Utilities>Data Load/Unload in APEX and there is a handy load utility there that does it all for you.
Cheers
Ben -
Renaming files using a list of names in a txt or csv file
Hello everyone,
I'm trying to use AppleScript (although I'm a total noob to it) to rename the files in a folder (if possible using something like this - set folder to choose folder) to coincide to a list of names (in a txt or csv - can be any extension needed).
To paint the picture clearer I'll have something like this
Files_as_they_are
Files_renamed
01.mkv
Valar Dohaeris.mkv
02.mkv
Mhysa.mkv
Here is what I've tryed so far : (some point through the night I've tryed to repeat part of the process thus the "fcount" but the result was even worse)
set theFolder to choose folder
set ep to {"Valar Dohaeris", "Dark Wings, Dark Words"}
set fcount to 1
tell application "Finder"
set name of file fcount of theFolder to item fcount of ep
end tell
set fcount to fcount + 1
Tnx in advance...This will work with a comma separated text file,
i.e.:
Files as the are, Files Renamed
01.mkv, Valar Dohaeris.mkv
02.mkv, Mhysa.mkv
Note that if the file to be renamed exists, it will be overwritten (A test can be added to skip if exists if needed)
set theFoler to POSIX path of (choose folder with prompt "Choose folder with Files" default location path to desktop)
set theFile to POSIX path of (choose file with prompt "Choose TXT file" default location path to desktop)
do shell script "
cd " & quoted form of theFoler & "
while read line
do
OldImageName=${line%,*}
NewImageName=${line#*,}
if [ -e \"$OldImageName\" ] ; then
mv \"$OldImageName\" \"$NewImageName\"
else
echo \"$OldImageName\" >> ~/Desktop/Errors.txt
fi
done < " & quoted form of theFile & " -
Hi,any suggestions welcome.I have a page that gets a .CSV file for user names from the local system and sends it a servlet to parse and send to the database.I inetnd to use a servlet to parse the csv files and insert into the database.Is there any easier method of implementation,or can i use that method.
Thanks in advanceDatabases usually have utilities which read CSV and upload data into the database. These are faster than JDBC, but that would mean using Runtime.exec(). I guess you will have to go for parsing the files and inserting the records in batches.
-
Uploading csv file into database using apex
Dear all
I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
below mentioned is error and the code
ERROR:
ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
Error
OK
CODE:
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
BEGIN
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv';
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11);
-- Clear out
v_line := NULL;
END IF;
END LOOP;
END;
what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
thanks in advance
regards
UdayHi,
Mistakes in your sample I did correct
Problem 1
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv'; to
select blob_content into v_blob_data
from wwv_flow_files where name = :P1_FILE;Problem 2
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11); to
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
v_data_array(9),
v_data_array(10),
v_data_array(11); And I did create missing table
CREATE TABLE TABLE_X
v1 VARCHAR2(255),
v2 VARCHAR2(255),
v3 VARCHAR2(255),
v4 VARCHAR2(255),
v5 VARCHAR2(255),
v6 VARCHAR2(255),
v7 VARCHAR2(255),
v8 VARCHAR2(255),
v9 VARCHAR2(255),
v10 VARCHAR2(255),
v11 VARCHAR2(255)
);Regards,
Jari
Edited by: jarola on Nov 19, 2010 3:03 PM -
How to save a .csv file to database server
Hi every body,
I need to upload a .csv file from the client machine and save it to a directory in a database sever.
I could do the uploading part. Can anyone tell me how to save the file?
Another option is save the file as a CLOB in a database column. But I'm not aware of doing that too.
Please guide me.
Thanks in advance.
Surangi.See Steve Muench's Not Yet Documented Example #85 at http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#85. While this is for 10.1.3, this is still relevant for 11g. Steve's example is for uploading to a BLOB - same thing for a CLOB. Once your data is in the database, you can use the DBMS_LOB package to write the file to a directory on the database server, if you like.
Also the Developers Guide is your friend - Chapter 9.9 in the Fusion Web User Interface Developers Guide for Oracle ADF 11g, or 19.6 in the ADF Developers Guide for Forms/4GL Developers for JDeveloper 10.1.3. -
hi,
m neame coloumns awsto java. i have a requirement.i hav a csv file .i have database table which has same coloumns as the csv field names.
i have to upload the contents of the csv file in to the table.
at present i am being able to read each line in da csv file using the readLine method and storing into array.
i have to now insert this row into the database using prepared statement.
but how do i set the values into the preared statement.
i am retrieving each row from the csv.
can anyone help meTry http://www.aquafold.com/ Aqua Data.
It loads data from formats such as CSV and loads them
into an existing table.
Plus many other cool features.Peter, thanks for that link. Looks neat.
To the OP:
You have at least two options:
1. Use Java to load the data through a series of INSERT statements.
2. Use the bulk loader facilities found in many of todays RDBMS.
Now go do your homework. -
Script to ping multiple hosts and return domain info to a txt or csv file
Hi,
I wonder if anyone can help. I need a script that will allow me to ping multiple hosts (all listed on seperate lines in a txt file) and return IP, server up\down and domain info to a txt or ideally a csv file.
I'm sure this must have been done\requested before but I can't seem to find the correct script anywhere
Thanks for your help
MalTry this modification:
$result=@()
Get-Content p:\list.TXT | %{
$start_name = $_
$conn = Test-Connection -ComputerName $_ -Quiet
if(-not $conn)
$start_name = ""
Try
$dns = [System.Net.Dns]::GetHostEntry($_)
$dns_host = $dns.HostName
$dns_ip = $dns.AddressList | select -ExpandProperty IPAddressToString
catch
$dns_host = "invalid host name" #as jrich proposed :)
$dns_ip = "invalid host name" #as jrich proposed :)
$start_name = ""
$HostObj = New-Object PSObject -Property @{
Host = $start_name
IP = $dns_ip
DNSHost = $dns_host
Active = $conn
$result += $HostObj
$result | Export-Csv p:list.csv -NoTypeInformation -
Data Migration from CSV file to Database Table.
Hi,
I have checked few answered threads on Data Migration Issues but didn't find the solution yet.
I am reading data from an CSV file to internal table but the complete row is coming under one field of the internal table.
How i can get values in different fields of the internal table from the CSV file ?
Thanks & Regards.
Raman Khurana.Hi,
If you are using GUI_UPLOAD, you might have missed to make has_field_separator as 'X'.
EXPORTING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\File.csv'
filetype = 'ASC'
has_field_separator = ' X' "<= Set this as 'X'.
TABLES
data_tab = itab.
Regards,
Manoj Kumar P -
How to read the CSV Files into Database Table
Hi
Friends i have a Table called tblstudent this has the following fields Student ID, StudentName ,Class,Father_Name, Mother_Name.
Now i have a CSV File with 1500 records with all These Fields. Now in my Program there is a need for me to read all these Records into this Table tblstudent.
Note: I have got already 2000 records in the Table tblstudent now i would like to read all these CSV File records into the Table tblstudent.
Please give me some examples to do this
Thank your for your service
Cheers
Jofin1) Read the CSV file line by line using BufferedReader.
2) Convert each line (record) to a List and add it to a parent List. If you know the columns before, you might use a List of DTO's.
3) Finally save the two-dimensional List or the List of DTO's into the datatable using plain JDBC or any kind of ORM (Hibernate and so on).
This article contains some useful code snippets to parse a CSV: http://balusc.xs4all.nl/srv/dev-jep-csv.html -
How to regularly load data from .csv file to database (using apex)
Hi,
i am using apex3 , I need to load data from a csv file to apex . I need to perform this automatically through code at regular time interval of 5-10 seconds.
Is it possible .If yes how ?. Please reply as early as possible. This will decide whether to use apex or not for this application.
this is question for Application Express. Dont know why in forum for BPEL
Edited by: TEJU on Oct 24, 2008 2:57 PMHello,
You really need to load the data every 5-10 seconds? Presumably it's read only?
I would look at using an Oracle external table instead, that way you just drop your CSV in a location the DB can read it and then you build a table that essentially references the underlying CSV (that way when you query the table you view the data in the CSV file).
Take a look at this link for a quick example on usage -
http://www.oracle-base.com/articles/9i/SQLNewFeatures9i.php#ExternalTables
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! -
Csv file to database tables and also foreginkey related columns directly
i have created dimensions tables in ssis and i need to load the data into that tables from my given csv files. iand i have foriegien key columns of fact table for this also data need to load
definitely we have primary key relations.. the tables contain primary keys and forien keys i have created tables nearly 20 tables in sql server some of them consist of dimensions and facts.. so i have an csv files of data. so that i need
to load data in that tables by using ssis package
i have an idea taking one data flow task in control flow task for each and every single table i am taking one oldb destination. for each and every one i need source as csv file. by connecting this both we can load data
but i need to load data into 20 tables by taking on dataflow task..how it is possible any solution and any different ways to load data from csv files to ssispacke tables -
Upload csv file to server database directory through Apex interface
Hi All,
I have created a file browse item in Apex Page. through which user should be able to upload the csv file to database directory located in server.
I have created one directory object in my schema say NAN_DIR where mentioned the directory.
Need urgent solution......
Thanks in Advance
DanalaxmiHi Danalaxmi,
There is an example in this thread:
Re: Store \ Retrieve files from file system
Regards,
Benz -
How do i import my local csv files into HANA database as temporary tables using java program?
I want to import my local csv file into database for further apply Join with other tables programmatic in JAVA
Hi Vivek,
Please go through the following blogs and video to resolve your issue.
Loading large CSV files to SAP HANA
HANA Academy - Importing Data using CTL Method - YouTube
Hope it helps.
Regards
Kumar
Maybe you are looking for
-
I have multiple songs that only play part on my pc even though I purchased them.
I have multiple songs that will not play all the way through. They are all songs I have purchased and do not have a buy option next to them. I lost my ipod touch and only have my pc to work with now.
-
Hi All I created a Dashboard prompt and I select Multi-select control. When I previw the results all the values are apprearing in one single line. like 101102103104 etc.....Also the values has hyperlink, so if I click 101 then I am getting just 101 a
-
PXE with IP Helpers/DHCP Relay
I'm a Sysadmin and I have a question about what is best practice in regards to PXE servers. We are currently using DHCP Options for PXE clients (options 66,67). This works for most clients but is not the recommended method from either of the vendors
-
Single cell JTextField editor in JTreeTable
- I have a JTreeTable. -I want to create a leaf renaming scheme in which a JTextField pops up over the leaf node during editing -Allows the user to input text. When focus is lost, the text will be passed to the node user object represented by the lea
-
Do I own a middle 2004 or an early 2008 - Airport Express..?
Hiall - For no specific reason at all, I wish to get a clue, whether I have one of the a/m Airport(s?) Express(es?) - or none of those. Have exploited Apple "Support Site" for hours. Anyone? - Not as stupid as me..? S/No. 6F639*U4T - On a chilly Nov.