I tried using Teradata fastload
Here is the sample file that they provide on the official website
L_INDEX,L_TIMESTAMP,L_TEXT
1,2010-08-11 13:19:05.1,some text
2,2010-08-11 13:19:05.1,
3,2010-08-11 13:19:05.1,more text
4,,text
5,,
It runs perfect with the above file
Then I modified ONLY the first row . So that some text became "some, text" . The following is a perfectly legit csv
L_INDEX,L_TIMESTAMP,L_TEXT
1,2010-08-11 13:19:05.1,"some, text" // this row was slightly modified
2,2010-08-11 13:19:05.1,
3,2010-08-11 13:19:05.1,more text
4,,text
5,,
However I got an error saying that the first column contains 4 values but only 3 values were expected
As far as I understand I must specify text qualifier " . How can I do this ?
I read documentation but nothing is mentioned about this .
According to the FastLoad Utility documentation pertaining to the selection of a delimiter for use with the SET RECORD command and a VARTEXT layout:
Any character sequence that appears in the data cannot be used as a
delimiter. No control character other than a tab character can be used
in a delimiter.
This would likely extend to the use of the FastLoad API mechanism leveraged within the Teradata JDBC driver.
EDIT
FastLoad has been around for 15+ years and does what it was intended to well -- load lots of data fast. Your other options would be to create a fixed length record where you do not have to rely on a delimiter or create an INMOD to parse the file as it is streamed into FastLoad.
Other alternatives include MultiLoad, Teradata Parallel Transport, TPUMP, or a proper ETL tool to load your data. Each have their own advantages and disadvantages that have to be considered with the format of the data which is being supplied to the environment.
Related
I am trying to display ŵ through my jsf page but unable to do so. Basically the text with special characters is read from properties file , but on my application screen it becomes something else . I did try to use entity values but not succeeding for example if original text is :
ŵyhsne klqdw dwql
then after replacing with with entity or hexvalues:
**&wcirc ;**yhsne klqdw dwql but in my page it displays as it is
I can just guess your question. Please edit it and improve it.
If you are displaying in web, you should use ŵ (note: without spaces), but this also requires a fonts on client site that support such character.
If the string is in your code: replace the character with \u0175.
But probably the best way it is to use just ŵ either in code on in web, or on any file, and you should assure that such files (or sources) are interpreted ad UTF-8, and you deliver pages are UTF-8. If you are not using UTF-8, just check in similar way, that you are using consistently the correct encoding.
And sending a character doesn't mean it could be displayed. There is always the possibility that a font will not have all *special" characters in it.
SELECT * FROM `employee` WHERE `name` LIKE "%شريف%"
Above query works fine and find the element by phpmyAdmin query but using it inside JavaFX doesn't get it.
And get the english searchs, So what I need to add in java to permit me search by Arabic.
As per my above comments, I guess it to be a encoding - decoding issue of Java and has nothing specific to do with JavaFX and I also assume that you are not getting any exceptions. You have to use a proper standard while inserting as well as retrieving data. Helpful information is there at , How to store arabic text in mysql database using python?
Refer this article to work only on bytes so your application is always properly internationalized , Byte Encodings and Strings
Refer this one too as how to set encoding in Java , How can I insert arabic word to mysql database using java
Your console might be UTF8 enabled so you are able to match strings there and see Arabic characters.
Hope it helps.
I have the following scenario, and need some advice:
The user will input a word document as a template, and provide some parameters in runtime so i can query my database and get data to fill the document.
So, there are two basic things i need to do:
Replace every key in the document with it´s respective result from the current query line.
"Merge" (copy? duplicate?) the existing document unchanged into itself (append) depending on how many rows i got from the query, and replacing the keys from this new copy with the next row values.
What´s is the best aprroach to do this? I´ve managed to do the replace part for now, by using the unmarshallfromtemplate providing it a hashmap.
But this way is a little bit tricky, because i need to add "${variable_name}" in the document, and sometimes word separates "${" and "}" in different tags, causing issues.
I´ve read about the custom xml binding, but didn´t understand it completely. I need to generate a custom XML, inject it in the document (all of this un runtime) and call the applybindings?? If this is true, how would i bind the fields in the document to the xml ? By name?
docx4j includes VariablePrepare, which can tidy up your input docx so that your keys are not split across separate runs.
But, you would still be better off switching to content control data binding, particularly if you have repeated data (think for example of line items in an invoice). Disclosure: I champion this approach in docx4j.
To adopt the content control data binding approach:
dream up an XML format which makes sense for your data, and write some code to convert the results of your database query into that format.
modify your template, so that the content controls are bound to elements in your XML document. ordinarily you'd use an authoring add-in for Word to help with this. (The technology Microsoft uses for binding is XPath, so how you bind depends on your XML structure, but, yes, you'd typically bind to the element name or ID).
now you have your XML file and a suitable intput docx, ContentControlsMergeXML contains the code you need to create an instance document at run time. There's also a version of this for a servlet environment at https://github.com/plutext/OpenDoPE-WAR
As an alternative to 1 & 2, there is also org.docx4j.model.datastorage.migration.FromVariableReplacement in current nightlies, which can convert your existing "${" document. Only to a standardised target XML format though.
If you have further questions, there is a forum devoted to this topic at http://www.docx4java.org/forums/data-binding-java-f16/
how to read unicode text from java resultset?
rs.getString() returns a Java String which is Unicode by definition.
If you get mangled characters, you have to configure your database driver to use the right encoding for the connection to the database.
Just read the strings. All strings in Java are unicode already. If you're having problems, then:
It could be a diagnostic problem - you may be reading the right data out of the ResultSet but displaying it so it looks like you haven't read it properly
It could be a configuration problem - there may be something you need to do when connecting to the database so that it determines the right encoding to use
It could be a database problem - the database may not be configured to store full Unicode data
It could be a database schema problem - the particular column you're using may be configured using a column type which doesn't support full Unicode
It could be a problem in the data, e.g. with another program incorrectly submitting data.
I've seen all of these before now. You should use detailed logging (e.g. of the individual characters, in hex) to work out whether you've got the data correctly or not - that will tell you where to look next.
If you are using DataSource (f.e. com.mysql.jdbc.jdbc2.optional.MysqlDataSource) you can directly set channel encoding to UTF8 like ds.setEncoding("UTF-8")
Due to repetitive errors with one of our Java applications:
Engine engine_0: Error in application action.
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x13)
was found in the element content of the document.
I need to "fix" some Unicode character in an Oracle database, ideally in a programmatic fashion. Once identified, what would be a simple way to "search and replace" it?
Assuming the characters are present in a text field:
update TABLE set COLUMN=REPLACE(convert(varchar(5000), COLUMN), 'searchstring', 'replacestring')
(note that this will only work on a text field with no more than 5000 characters, for larger text fields increase the number in the query).