PROBLEM LOADING DATA FROM A TEXT FILE.
Hi,
Im having a problem in loading my csv file to the database. Im using Oracle Database 10g for Linux. Im in p. 228 in the book. This is my csv file look.
db_name db_version host_id
db10 9.2.0.7 1
db11 10.2.0.1 1
db12 10.2.0.1 1
db13 9.2.0.7 1
db14 10.2.0.1 1
db15 9.2.0.7 1
I loaded this data to an existing table called DATABASES loaded from tab delimited. FILE CHARACTER SET is UNICODE UTF-8. Then I browsed the name of the csv file to be uploaded. It looked like this.
File Name F23757437/db2.csv Reupload File
Separator
Optionally Enclosed By
First row contains column names.
File Character Set
I CLICKED NEXT, THIS IS WHAT IT LOOKED LIKE.
Schema: HANDSONXE06
Table Name: DATABASES
Define Column Mapping
Column Names %
Format
Upload yes
Row 1 "db10" "9.2.0.7" 1
Row 2 "db11" "10.2.0.1" 1
Row 3 "db12" "10.2.0.1" 1
Row 4 "db13" "9.2.0.7" 1
Row 5 "db14" "10.2.0.1" 1
Row 6 "db15" "9.2.0.7" 1
I CLICKED LOAD AND THIS WAS THE RESULT.
* There are NOT NULL columns in HANDSONXE06.DATABASES. Select to upload the data without an error.
Schema
Down
Table Name
Down
File Details
Down
Column Mapping
Load Data
Schema: HANDSONXE06
Table Name: DATABASES
Define Column Mapping
Column Names COLUMN_NAMES
Format FORMAT
Upload UPLOAD
Row 1 "db10" "9.2.0.7" 1
Row 2 "db11" "10.2.0.1" 1
Row 3 "db12" "10.2.0.1" 1
Row 4 "db13" "9.2.0.7" 1
Row 5 "db14" "10.2.0.1" 1
Row 6 "db15" "9.2.0.7" 1
I WAS REALLY WONDERING WHAT WAS REALLY WRONG. AN ERROR MESSAGE SAID, THERE ARE NOT NULL COLUMNS IN THE HANDSONXE06.DATABASES. I DIDN'T KNOW HOW TO FIX IT. WHAT DO I NEED TO CHANGE TO LOAD THE DATA WITHOUT AN ERROR? IT REALLY CONFUSED ME A LOT AND HOW COME I HAVE AN ERROR? PLEASE HELP ME. I NEED AND ANSWER TO MY PROBLEM PLEASE. I CANNOT GO FORWARD BECAUSE OF THIS.
THANKS,
JOCELYN
I'm not certain of the utility you are using to load the data, however, I completed the following test using SQL Loader to insert the data into my table. Your process should work similar if the trigger and sequence are created for the table you are loading.
SQL> create table load_tbl
2 (db_id number(3) not null,
3 db_name varchar2(100) not null,
4 db_version varchar2(25),
5 host_id number(3) not null)
6 /
Table created.
SQL> desc load_tbl
Name Null? Type
DB_ID NOT NULL NUMBER(3)
DB_NAME NOT NULL VARCHAR2(100)
DB_VERSION VARCHAR2(25)
HOST_ID NOT NULL NUMBER(3)
SQL> create sequence db_id_seq;
Sequence created.
SQL> create or replace trigger db_id_trig
2 before insert on load_tbl
3 for each row
4 when (new.db_id is null)
5 begin
6 select db_id_seq.nextval into :new.db_id from dual;
7 end;
8 /
Trigger created.
The contents of the data file, control file and log file are below for the load into load_tbl.
C:\>sqlldr userid=username/password@db control=db_id_load.ctl log=db_id_load.log
SQL*Loader: Release 9.2.0.6.0 - Production on Thu Jan 18 17:21:47 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Commit point reached - logical record count 6
C:\>
SQL> select * from load_tbl
2 /
DB_ID DB_NAME DB_VERSION HOST_ID
1 db10 9.2.0.7 1
2 db11 10.2.0.1 1
3 db12 10.2.0.1 1
4 db13 9.2.0.7 1
5 db14 10.2.0.1 1
6 db15 9.2.0.7 1
6 rows selected.
SQL>
Data File"db10" "9.2.0.7" 1
"db11" "10.2.0.1" 1
"db12" "10.2.0.1" 1
"db13" "9.2.0.7" 1
"db14" "10.2.0.1" 1
"db15" "9.2.0.7" 1
Control FileLOAD DATA
INFILE "C:\db_id_load.dat"
APPEND INTO TABLE load_tbl
FIELDS TERMINATED BY WHITESPACE OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(db_name CHAR,
db_version CHAR,
host_id "TO_NUMBER(:host_id,'99999999999')"
Log FileSQL*Loader: Release 9.2.0.6.0 - Production on Thu Jan 18 17:21:47 2007
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Control File: db_id_load.ctl
Data File: C:\db_id_load.dat
Bad File: db_id_load.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table LOAD_TBL, loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
DB_NAME FIRST * WHT O(") CHARACTER
DB_VERSION NEXT * WHT O(") CHARACTER
HOST_ID NEXT * WHT O(") CHARACTER
SQL string for column : "TO_NUMBER(:host_id,'99999999999')"
Table LOAD_TBL:
6 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 49536 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 6
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Jan 18 17:21:47 2007
Run ended on Thu Jan 18 17:21:47 2007
Elapsed time was: 00:00:00.39
CPU time was: 00:00:00.13
Similar Messages
-
Error while loading data from a text file to a datastore
Hi all,
i am a starter in ODI. I am trying to load data from a text file into a datastore. I have put the file on a unix server whose location is defined in the topology manager. when i am trying to "view data" it is giving me error file does not exist at <location where i have put the file>. Please help meHi,
1. If your files are on a remote File System, you will need to copy one of your files to the machine ODI Designer is running on to allow ODI to retrieve the metadata information of the file.
2. In Topology create a Physical Schema, the directory you enter for Data and Work Schema should point at this local file.
3. Then define the File Datastore in ODI Designer. Enter a name, browse and select the file and fill in each filed of the Files tab.
* If its a Fixed file, click on the grid icon on the Columns tab to enter the columns and have Automatic Adjustment checked.
* If its a Delimited file, use the Reverse button on the Columns tab to reverse the columns.
* Right click on the File Datastore select View Data, if you can view data, that means the File Datastore has been defined correctly.
* If not, check each tab of the File Datastore to make sure everything is defined correctly and retry.
4. Once View Data is successful, you now change the directories (Data and Work Schema in Topology) to point at the remote File System. These directories must be accessible to the ODI Agent that will be used to run the transformations. The directory can be an absolute path (m:/public/data/files) or relative to the ODI Agent startup directory (../demo/files). It is strongly advised to use a UNC (independent from the execution location) for the path. When running the transformations with "no agent", the directory is relative to the directory where Oracle Data Integrator has been installed.
You need to have a agent process running at the system where your source file resides .
Then while running the odi interface choose that agent .
Thanks,
Sutirtha -
Problem – loading HTMLtext from a text file
Problem – loading HTMLtext from a text file
Hi, I have a dynamic text set up to render text as HTML and I
am loading the text into the text object by using the code below.
var loadText:LoadVars = new LoadVars();
loadText.load("Nyheter.txt");
loadText.onLoad = function(success){
if(success){
Nyheter_txt.htmlText = this.VariabelTekst;
The textfile looks like:
VariabelTekst=<p align
="Right">(13.11.2006)</p><p><b><font
size="12">This is the tittle</b></p><p>Here
comes the text</p>
It works almost fine but the first problem is that the
paragraph text in the textfile should be written in Norwegian. This
involves some Nordic characters. By default these characters are
just shown as small square in the text control when running the
flash file. If I try to enter these characters in the textbox
“Include these characters” within the dialog for
embedding, the text within the bold tag of the text file is not
shown when the text is rendered. It looks as if it effect the HTML
rendering of the text. The Nordic characters are still not showing
but instead the small square placeholders for the characters are
gone.
Am I doing it wrong, or is there a work around for solving
this problem?
Any ideas?
TIRislaaProblem – loading HTMLtext from a text file
Hi, I have a dynamic text set up to render text as HTML and I
am loading the text into the text object by using the code below.
var loadText:LoadVars = new LoadVars();
loadText.load("Nyheter.txt");
loadText.onLoad = function(success){
if(success){
Nyheter_txt.htmlText = this.VariabelTekst;
The textfile looks like:
VariabelTekst=<p align
="Right">(13.11.2006)</p><p><b><font
size="12">This is the tittle</b></p><p>Here
comes the text</p>
It works almost fine but the first problem is that the
paragraph text in the textfile should be written in Norwegian. This
involves some Nordic characters. By default these characters are
just shown as small square in the text control when running the
flash file. If I try to enter these characters in the textbox
“Include these characters” within the dialog for
embedding, the text within the bold tag of the text file is not
shown when the text is rendered. It looks as if it effect the HTML
rendering of the text. The Nordic characters are still not showing
but instead the small square placeholders for the characters are
gone.
Am I doing it wrong, or is there a work around for solving
this problem?
Any ideas?
TIRislaa -
How to automate loading data from a text file ?
Hi,
I need to load a data form a text file automatically. (for example: every day at 6.p.m) .
It is possible to use DBMS_SCHEDULER with SQL LOADER ? or maybe u have others idea ?
regards,assuming that the text file resides at the machine where the database is installed at you can create a procedure that use the built-in UTL_FILE package to read and load the data to the oracle tables. then create a job that use the DBMS_JOB or DBMS_SCHEDULER to create an automated schedule to run the job that calls the procedure you have created.
or assuming that the text file resides or at the local/client machine (example c:\ drive) on a windows xp platform. create a batch file that do a ftp to transfer the text file to the oracle database server and create a schedule job using the windows scheduler. also create a procedure that use the built-in UTL_FILE package to read and load the data to the oracle tables. then create a job that use the DBMS_JOB or DBMS_SCHEDULER to create an automated schedule to run the job that calls the procedure you have created. -
I have a text file in a data archive that contains various information (numeric and string) that I need to load into different controls in a VI would I have to open the file and look for certain characters to begin and end loading? The information was previously stored by the VI from the control so can I simply load a previous set of data by using it's data path and control file name?
Solved!
Go to Solution.I assume that the numbers following the "OH data is listed below:" is supposed to go into a 2D array?
There are several ways to do this. One simple way is to simply read the file and chop off each section of interest, and converting the string to a 2D array, like this:
Another is to read the file in using the Read From Spreadsheet File, and then indexing out the first column, and use that to search for the indices where the regions of interest lie. You can then use Array Subset to get the 2D array of data.
Message Edited by smercurio_fc on 07-22-2009 02:56 PM
Attachments:
Example_VI.png 15 KB -
Is there away to load data from a text file to a table?
I have data stored in filename.txt and I want to load those data into a table on the front pannel of vi. How can I do that?
Se;
If the text file is already in an spreadsheet format, you can download the VI Read Strings From Spreadsheet File from my website:
http://www.jyestudio.com/lview.shtml
It is the suggested modification of the VI Read From Spreadsheet File that comes with LabVIEW, as stated in the diagram.
If the text file is not in spreadsheet format, then you need to write your own code to make the string table suitable for the table.
Regards;
Enrique
www.vartortech.com -
Loading Data From a Text File Through an Application into Oracle
Hi There,
I have a web application that allows the user to upload a text file. This file is then processed by my application. Each line in the file is a new row I need to insert into my table.
Currently, I batch 200 updates together and insert them into the DB.
For about 3 million records this is taking much longer than I would like it to.
Any suggestions for optimization?
thanks.I put here a simplest demo (file has whitespace)
I think it may help to start.
--Structure of your file test1.dat (put in your directory)
a1 b1
a2 b2
a3 b3
a4 b4
CREATE OR REPLACE DIRECTORY
test_dir AS
'C:\oraclexe\DIR' --or anywhere
--GRANT READ, WRITE ON DIRECTORY test_dir TO your_user
--external table:
DROP TABLE test_ext
CREATE TABLE test_ext
(col1 CHAR(5),
col2 CHAR(5)
ORGANIZATION EXTERNAL
(TYPE oracle_loader
DEFAULT DIRECTORY test_dir
ACCESS PARAMETERS
(RECORDS DELIMITED BY NEWLINE
FIELDS TERMINATED BY WHITESPACE)
LOCATION ('test1.dat')
SELECT * FROM test_ext
COL1 COL2
a1 b1
a2 b2
a3 b3
a4 b4
Insert into another_table(another_col1, another_col2) (select col1, col2 from test_ext) if needed -
How to do import data from the text file into the mathscript window?
Could anyone tell me how to do import data from text file into mathscript window for labview 8?
MathScript Window openned, File, Load Data - it has options: custom pattern (*.mlv) or all files.
ThanksHi Milan,
Prior to loading data in Mathscript Window , you have to save the data from the Mathscript window (the default extension of the file is .mlv but you can choose any extension). This means that you cannot load data from a text file that was not created using the Mathscript window.
Please let me know if you have any further questions regarding this issue.
Regards,
Ankita -
How to load Test data from a Text file in ECATT
Hi,
I have created a test configuration with a test script, system data container, and test data container.
I have done the recording of a transaction and created the script. Parameterization is done for the script and have imported those parameters from script in to the data container.
I am trying to load a the data from a text file on the local work-station. The data is not being read.
Please explain this in detail (step by step) as I am very new to ECATT.
I am trying this on SAP ECC 6.0 IDES server.
Thanks in Advance
Vikas PatilPlease explain this in detail (step by step) as I am very new to ECATT.
Thanks in Advance
Vikas Patil -
Average Data from multiple text files
I am new to labVIEW hence a little help is appreciated:
I have a 100 txt files with two columns (tab separated) for X and Y value.
I need to average the Y values to generate one single txt file and generate X versus Y graph.
So how do I read the data from these text files? (without having to select each one of them individually) and how to average the data and create a XY graph from it?
Thanks in advance
Solved!
Go to Solution.Use X-Y Graph.
You were able to get two arrays of X and Y points from text file right?
Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved. -
Problem loading data from the PSA to the InfoCube
Hello experts.
I'm having a problem loading data from the PSA to the InfoCube.
I'm using a DTP for this process but is happening the following error:
"Diagnosis
An error occurred while executing the transformation rule:
The exact error message is:
Overflow converting from''
The error was triggered at the point in the Following Program:
GP4KMDU7EAUOSBIZVE233WNLPIG 718
System Response
Processing the record date has Been terminated.
Procedure
The Following is additional information included in the higher-level
node of the monitor:
Transformation ID
Data record number of the source record
Number and the name of the rule Which produced the error
Procedure for System Administration
Have already created new DTP's deactivate and reactivate the InfoCube, the transformation, but solves nothing.
Does anyone have any idea what to do?
Thank you.HI,
Is it a flat file load or loading frm any data source?
try to execute the program GP4KMDU7EAUOSBIZVE233WNLPIG 718 in Se38 and check if its active and no syntax errors are there.
Check the mapping of the fileds in transformations weather
some data fileds are mapped to decimal or char 32 filed is mapped to Raw 16
or calweek, calmonth mapped to calday etc.
Check in St22 if there any short dumps ..
Regards
KP -
How do you read data from a text file into a JTextArea?
I'm working on a blogging program and I need to add data from a text file named messages.txt into a JTextArea named messages. How do I go about doing this?
Student_Coder wrote:
1) Read the file messages.txt into a String
2) Initialize messages with the String as the textSwing text components are designed to use Unix-style linefeeds (\n) as line separators. If the text file happens to use a different style, like DOS's carriage-return+linefeed (\r\n), it needs to be converted. The read() method does that, and it saves the info about the line separator style in the Document so the write() method can re-convert it.
lethalwire wrote:
They have 2 different ways of importing documents in this link:
http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
Neither of those methods applies to JTextAreas. -
I would like to plott data from a text file in the same way as a media player does from a video file. I’m not sure how to create the pointer slide function. The vi could look something like the attached jpg.
Please, can some one help me?
Martin
Attachments:
Plotting from a text file like a media player example.jpg 61 KBHI Martin,
i am not realy sure what you want!?!?
i think you want to display only a part of the values you read from XYZ
so what you can do:
write all the values in an array.
the size of the array is the max. value of the slide bar
now you can select a part of the array (e.g. values from 100 to 200) and display this with a graph
the other option is to use the history function of the graphes
regards
timo -
How to parse data from a text file with no convenient delimiters?
I need to read data from a text file. This file contains one line of data with the repeating pattern "time 00 ADVar2: ___ Height: ____ time 01 ADVar2: ___ Height: ___ ..." I need LabView to parse out the "time" and "height" values, build an array with the values, and graph the correlation on an X&Y plot. Does Labview have an automated way to read to the input data file and parse out the correct values, even without convenient delimiters? Thank you.
You actually do have a convenient delimiter: "time". Thus, you can make an array using that as the delimiter. Only caveat is that the first array element will be empty. Then you can conveniently use the Scan From String function in a for-loop. Something like this:
Message Edited by smercurio_fc on 11-21-2008 03:13 PM
Attachments:
Example_VI.png 9 KB -
Read data from a text file, one line at a time.
I need to read data from a text file, and display each line in a String Indicator on Front Panel. It displays each line, but I get Error 4, End Of Line, unless I enter an extra line of data in the file that I don't need. I tried Read From Text File.vi, made by Nat Instr, and it gave the same error.
The Read from Text File.vi reads data from a text file line by line until the user stops the VI manually with the Stop button on the front panel, or until an error (such as "Error 4, End of file") occurs. If an error occurs, the Simple Error Handler.vi pops up a dialog that tells you which error occurred.
The Read from Text File.vi uses a while loop, but if you knew how many lines you wanted to read, you could replace the while loop with a for loop set to read that many lines from the file.
If you need something more dynamic because the number of lines in your files vary, then you could change the code of the Read from Text File.vi to the expect "Error 4, End of file" and handle it appropriately. This would require unbundling the error cluster that comes fro
m the Read File function with the Unbundle By Name function, so that you can expose the individual error "status" and error "code" values stored in the cluster. If the value of the error "code" is 4, then you can change the error "status" from true to false, and you can rebundle the cluster with the Bundle by Name function. Setting the error "status" to false instructs the Simple Error Handler to ignore the error. Otherwise, pass the original error cluster to the Simple Error Handler.vi, so that you can see what the error is.
Of course, if you're not interested in what the errors are, you could just remove the Simple Error Handler.vi, but then you wouldn't see any error messages.
Best of Luck,
Dieter
Dieter Schweiss
Applications Engineer
National Instruments
Maybe you are looking for
-
Where are all the bug fixes? Software updates?
delete me Message was edited by: HLT1
-
Hi Everyone I'm doing a formal report for a university project and would like to know how to add a second y-axis to a chart? I have 4 lines plotted on a scatter graph, 3 of the lines have values that are between 0 and 3 and the fourth line has values
-
How to create an object of our own class by using Class.forName()??
how to create an object of our own class by using Class.forName()?? plzz anser my qustion soon..
-
Error in maintenance optimizer generating Stack File XML
Hi all, In step 3 "Download Files" of maintenance optimizer transaction to implement the EHP5 of ERP, In the tab "Log" I see the following error. *Collecting XML adjustment input data done with error or warning. Message no.AGS_MOPZ_PLAN_MSG144* The s
-
Dear All, When user trying to reverse GR, following error appears. But stock to be there for that material in MMBE. "Deficit of Project Stock unr.1,00 PC 113-901290 3082 0001 Q" Please advise how to proceed. Regards Edited by: Venkateshwaran Balaji K