How to read text file with big5 into db
hi,
how can i use UTL_FILE package to
read a text file with big5 characters and insert into db?
my oracle charset is AL32UTF8.
thx a lot!
Thx for yr answer!!!
I have followed and it works.
However, I got another problem with HKSCS. When the text file contained HKSCS, the store procedure also treats it as Big5 and when I select it out, the character was not the orginal one.
Please suggest if you have any ideas.
Many Thanks!!!
Similar Messages
-
How to read text file line by line...?
how to read text file line by line, but the linefeed is defined by user, return list of string, each line of file is a item of list?
please help me.
Thanks very muchBrynjar wrote:
In Groovy, you would do something like:
linefeed = "\n" //or "\r\n" if the user chose so
lines = new File('pathtofile').text.split("${linefeed}")This is one of the things that has always annoyed me about Sun's sdk, i.e. the lack of easy ways to do things like that. You always end up making your own utilities or use something like Apache's commons.io. Same goes for jdbc and xml - I'll wait for appropriate topics to show how easy that is in Groovy :)I generally agree, but what I really don't like about the Groovy text-file handling niceties: They don't care about encoding/always use the default encoding. And as soon as you want to specify the encoding, it gets a lot more complex (granted, it's still easier than in Java). -
Step by Step"How JSP read text file :
Hi ,
Any one know or have a good site to show step by step how JSP read text file.
TQ.There is no difference Between reading a text file from JSP and reading a text file from Java.
Just follow the same steps for JSP also. -
Read text file and insert into MySQL
Dears,
I need to read text file and then insert the data in the correct column in the MySQL database
example
I have the following text file:
field1=1234 field2=56789 field3=444555
field1=1333 field2=2222 field3=333555
and so on and so forth ,,note that all rows are identical and just the filed value is changed(there is a dilemeter between fields)
how can I read field1,field2 and field3 from text file and insert them in the correct table and column in the database.....
any help?????
thanks for your cooperation
Best RegarsSure.
Which part don't you understand?
1. Reading a text file
2. Parsing the text file contents.
3. Relational databases and SQL.
4. How to create a database.
5. How to connect to a database in Java.
6. How to insert records into the database in Java.
7. How to map Java objects to records in a database.
This is a pretty nice list. Solve complex problems by breaking them into smaller ones.
% -
How to read text file content in portal application?
Hi,
How do we read text file content in portal application?
Can anyone forward the code to do do?
Regards,
AnaghaCheck the code below. This help you to know how to read the text file content line by line. You can display as you require.
IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
IResourceContext resourceContext = new ResourceContext(user);
String filePath = "/documents/....";
RID rid = RID.getRID(filePath);
IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
InputStream inputStream = resource.getContent().getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
String line = reader.readLine();
while(line!=null) {
line = reader.readLine();
//You can append in string buffer to get file content as string object//
Regards,
Yoga -
How to read XML file and write into another XML file
Hi all, I am new to JAVAXML.
My problem is I have to read one XML file and take some Nodes from that and write these nodes into another XML file...
I solved, how to read XML file
But I don't know how to Write nodes into another XML.
Can anyone help in this???
Thanks in advance..This was answered a bit ago. There was a thread called "XML Mergine" that started on Sept 14th. It has a lot of information about what it takes to copy nodes from one XML Document object into another.
Dave Patterson -
How to read text file contain chinese character ?
Hi XI Expert,
I have scenario to read text file contain Chinese Character using sender file adapter. but every i was check from sxmb_moni all the chinese character looks different. and also the target file also i has changes.
Please advise me how to maintaine the chinese character in PI 7.0 SP17.
Thank You and Best Regards
FernandHi,
Refer these threads..
Receiver file adapter corrupting characters
Problem in converting special characters in input text file
Here is one more useful guide..
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
Regards,
Sarvesh
Edited by: Sarvesh Singh on Nov 17, 2008 3:47 PM -
How to read text file efficiently?
I use CharBuffer to read text file:
private List<String> load() throws IOException {
final String B = "<BODY>";
final String E = "</BODY>";
List<String> docs = new ArrayList<String>();
for (File file : files) {
FileReader reader = new FileReader(file);
CharBuffer buffer = CharBuffer.allocate(BSIZE);
StringBuilder sb = new StringBuilder();
while (reader.read(buffer) != -1) {
char[] dst = new char[buffer.length()];
buffer.get(dst);
sb.append(dst);
buffer.clear();
String s = sb.toString();
System.out.println(file + ": " + s.length());
int start = 0;
int i, j;
while ((i = s.indexOf(B, start)) != -1) {
j = s.indexOf(E, i + B.length());
docs.add(s.substring(i + B.length(), j));
start = j + E.length();
//System.out.printf("%d %d %d%n", i, j, start);
return docs;
}The file size is 1324350, but the code say it is 772802.
What's wrong with this code?
I want to read text file as quickly as possible.
Is this code the right way to read file?
Should I use FileReader or nio Channel and ByteBuffer?
Any suggestions are welcome!You are reading the file as if it were encoded in UTF-16. Each character uses two bytes so you have half the number of characters as you had bytes.
The following code reads an entire file in one hit.
public static String readText(File file) throws IOException {
byte[] bytes = new byte[(int) file.length()];
DataInputStream dis = new DataInputStream(new FileInputStream(file));
try {
dis.readFully(bytes);
} finally {
dis.close();
return new String(bytes, "UTF-8"); // or whatever your file encoding is.
}But you can still have less characters than bytes if there are any non ASCII-7 characters. -
Dear Everyone
I have coding below.
{color:#3366ff}*Text file scores.txt*
{color}1 1 1
2 2 2
*{color:#3366ff}Java class jtableone.class{color}*
import javax.swing.*;
public class jtableone extends JApplet {
public static void main(String[] args) throws Exception {
{color:#ff0000}//Read file scores.txt{color}
java.io.File file = new java.io.File("scores.txt");
Scanner input = new Scanner(file);
while (input.hasNext()){
String id = input.next();
String firstname = input.next();
String lastname = input.next();
{color:#ff0000}//System.out.println(id +" "+ firstname +" "+ lastname);
{color}}
input.close();
{color:#ff0000}//Crearte JTable{color}
private String[] columNames =
{"ID", "First Name", "Last Name"};
private Object[][] data = {
//{"12", "Tom", "Clark"},
//{"13", "helen", "Tan"}
{color:#ff0000}//Display JTable{color}
private JTable jTable1 = new JTable(data, columNames);
public jtableone(){
add(new JScrollPane(jTable1));
Can you tell me What i do next?
Create a Object[][] data which can read text file.
Thanks
sevenlonsevenlon wrote:
Can you tell me What i do next?How are we supposed to know? We have no knowledge of what your assignment is.
Create a Object[][] data which can read text file.Then do that. Create the 2D array and store the data in it.
Also when posting code use code tags. Paste code, highlight it and click CODE button. -
HI,,,How to read text file from my emulators root
hi friends,
Actully i m having problem with file connection i.e. i cant read text file from my root of the emulator.....
i have tried like this...
plz help me out
String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/New Folder/main.txt";
InputConnection conn = (InputConnection)Connector.open( uri,Connector.READ );
InputStream in = conn.openInputStream();
conn.close();
for(int j=0;j<12;j++)
ch=in.read();
str.append((char)ch);
par1=str.toString();
in.close();
screen4.append(par1);
display.setCurrent(screen4);still its not working.........
String uri = "file:///C:/WTK22/appdb/DefaultColorPhone/filesystem/root1/readme.txt";
FileConnection conn = (FileConnection)Connector.open( uri,Connector.READ);
InputStream in = conn.openInputStream();
conn.close();
String ss="";
String str1="";
int ch=0;
byte b[]=new byte[753];
ch=in.read(b,0,753);
str1= new String(b,0,ch);
ss=str1.substring(493,501);
screen4.append(ss);
display.setCurrent(screen4);
}catch(IOException io){} -
How to read text file by clicking on text file ?
Hello.. friends
I have made a java editor. I want to pass file name to a function in application by clicking on particular text file.
I assoiciated *.text file type with my application. when I click on text file application is run but I file is not read by my java application.
For example : in windows System all text are oppened in notepad when we click on any text file.
How to do this thing. please suggest me and if possible show me a sample code.
ThanksIf you are doing this in a web application you can set the content type appropriately and the file will open.
If you are doing this standalone you can use the Java RunTime class and execute something like this as the command "notepad.exe c:\\myfile.txt" which should open it up on a Windows operating system. -
How to read a file with value of RAW data type? Please help
Hi Experts,
I have a file with RAW data like DE864E48833BFFF1B805001CC4EF4BFA
I am using GUI_UPLOAD.
But this FM is throwing error.
I tried by giving FILETYPE as ASC. The output internal table for this FM contains a field of type c size 32.
Now it is able to read the file but I want to assign this value to a RAW data type variable.
This it is unable to do. How to convert the char value to RAW data type?
Please help!
Thanks
GopalHi,
The documentation for the function module contains an example for RAW upload.
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab. -
How to read Text file in WindowPhone 8.1
I am unable to pick text file from SD card or from mobile in windowPhone 8.1 app but image file can pick easily using FileOpenPicker.
below code working fine for image but when i changing PickerLocationId and Filter to "txt" or "doc " then not working. please do help.
FileOpenPicker
openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
openPicker.PickSingleFileAndContinue();Hi
I guess you are in wrong picker location and should have fileType also added
it should be documents lib
https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.pickers.pickerlocationid
Regards
Varun Ravindranath Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. -
How to read a file with data in Hierarchical Structure using XSD Schema
Hi
We have requirement in which we have to read a FIXED LENGTH file with FILE ADAPTER. File contains the data in hierarchical structure. Hierarchy in the file is identified by the first 3 characters of every line which could be any of these : 000,001,002,003 and 004. Rest files are followed after these. So structure is like:
000 -- Header of File. Will come only once in file. Length of this line is 43 characters
-- 001 -- Sub Header. Child for 000. Can repeat in file. Length of this line is 51 characters
--- 002 -- Detail record. Child for 001. Can repeat multiple times in given 001. Length of this line is 43 characters 1353
-- 003 -- Sub Footer record at same level of 001. Will always come once with 001 record. Child for 000. Length of this line is 48 characters
004 -- Footer of file.At same level of 000. Will come only once in file. Length of this line is 48 characters
Requirement is to create an XSD which should validate this Hierarchical Structure also i.e data should come in this hierarchy only else raise an error while parsing the file.
Now while configuring the FILE ADAPTER to read this file we are using Native Schema UI to create the XSD to parse this structure using an example data file. But we are not able to create a valid XSD for this file which should validate the Hierarchy also on the file.
Pls provide any pointers or solution for this.
Link to download the file, file structure details and XSD that we have created:
https://docs.google.com/file/d/0B9mCtbxc3m-oUmZuSWRlUTBIcUE/edit?usp=sharing
Thanks
Amit Rattan
Edited by: user11207269 on May 28, 2013 10:16 PM
Edited by: user11207269 on May 28, 2013 10:31 PM
Edited by: user11207269 on May 28, 2013 10:33 PMHeloo.. Can anyone help me on this. I need to do Hierarchial read / validation while reading the file using File Adapter using Native XSD schema.
-
How to read *.txt files with JSP?
I have to make a homepage that searches for information on a text file.
My text file is described below.
username=Hanako Sony
cpname=Sony Corporation
cpcode=500100
So, if the user inputs "username", then "Hanako Sony" should be returned. If the user inputs "cpname", then "Sony Corporation" should be returned and so on.
Can anyone help me with this? Can this be done with JSP?
Thanks,
RobTry this,
<%@ page import="java.io.*,java.util.*" %>
<%
RandomAccessFile raf = new RandomAccessFile("../webapps/test/jsp/Info.txt","r");
String qInfo = request.getParameter("qInfo");
String tInfo="";
if(qInfo != null) {
String line="";
while((line = raf.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line,"=");
if(st.hasMoreTokens()) {
if(st.nextToken().equalsIgnoreCase(qInfo))
tInfo = st.nextToken();
if(tInfo.equals("")) tInfo="Property Not found ???";
} else {
qInfo="";
%>
<form name=myform action="" method="get">
<table><tr>
<td>What do you want : </td><td><input type = text name="qInfo" value="<%=qInfo%>"></td></tr>
<tr><td>Here is the information : </td><td><input type = text name="tInfo" value="<%=tInfo%>"></td></tr>
<tr><td><input type="submit" name"sub"></td></tr>
</table>
</form>Here info.txt is your text file. Use the relative path accordingly.
Hope this helps.
Sudha
Maybe you are looking for
-
Bapi Function module for the Credit management
HI, Can anyone tell me the function moduleof the Credit Master Management. thanks Kiran
-
New java-like scripting language w/ powerful regex
Hi, Just wanted to let you know that there's now a new scripting language called P~ with the following important aspects: 1) matches and exceeds Perl regex solveability -- e.g. offers full regex-based boolean query on non-indexed corpus, offers compl
-
Greetings, I'm curious to know if, within Muse, I can add a link to PDF files that open in a new tab or browser window, that includes the resident PDF reader. Any suggestions? Thank you for yur assistance. Smiles, Kyle
-
Please help: I cannot find any answer.
-
Java report viewer on Report 6i
I have Java apps and my reports run on the server. I would like to launch them with my Java App. Does anyone know if there is a viewer that comes whit Report so the users would be able to see before printing. Thanks, Louis