Import txt files into table

Hi all,
I was created table A with A1 and A2 columns.
create table A (number A1, varchar A2).
I have file.txt from my desktop like
1,elementA
2,elementKK
3,elementMM
1000,element YIIO
How to import this file into table A with A1 have number and A2 have elements
from txt file using sql plus editor?
Thanks in advance

Hi,
Below example using External Table Feature.
create a directory on the server where your database is installed and copy your data file(text file) in that directory. In the below example Oracle directory name is "text_file" and the physical directory on the server is "D:\TEXT_FILE\". The file name of data file is "data.txt".
create directory text_file as 'D:\TEXT_FILE\';
DROP TABLE load_a;
CREATE TABLE load_a
(a1 varchar2(20),
a2 varchar2(200))
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY text_file
ACCESS PARAMETERS
(FIELDS TERMINATED BY ','
LOCATION ('data.txt')
select * from load_a;
now you can use
insert into a select * from load_a;
Sachin Chauhan

Similar Messages

  • Import txt file into user dictionary

    How to import text file into user dictionary through javascript? I can manually import txt file into user dictionary thru "Edit=>Spelling=>User dictionary...". But I don't know how to do it using javascript. Please advise.

    Advice? See in some version of the object-model reference under userDictionary. There you'll find a method called addWord(), which looks promising.
    Peter

  • Import txt file into report

    I have an Arinc signal that I have decoded into each of its digital I/Os.  Since I have over 150 I/Os I needed a way to sort and do a quick report on them.
    I have three categories.
    1. Stayed =1 throughout test
    2. Stayed = 0 throughout test
    3. Changed either from 0 --> 1 or 1-->0 during the test.
    I want to just put a list of the signals for each of these categories into my report.
    I have created a txt file for these to go in, but how do I import that into my report?
    Or is there an easier way?
    Here is an example of my code...
    'HCM1
    'HCM1 Label 104 decode - Untitled 3
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HSOV_A1_CLOSED"")= GetB (Ch(""[1]/Untitled 3""),0)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HSOV_A2_CLOSED"")= GetB (Ch(""[1]/Untitled 3""),1)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_RUNNING"")= GetB (Ch(""[1]/Untitled 3""),2)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_SYS_A_HI_TEMP"")= GetB (Ch(""[1]/Untitled 3""),4)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_SYS_A_LO_PRS"")= GetB (Ch(""[1]/Untitled 3""),7)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_LO_PRS"")= GetB (Ch(""[1]/Untitled 3""),12)")
    Call Calculate ("Ch(""HCM1_104/HCM_1_CAS_HPP_A_HI_TEMP"")= GetB (Ch(""[1]/Untitled 3""),13)")
    'HCM1 Label 105 decode - Untitled 4
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HSOV_A1_FAIL"")= GetB (Ch(""[1]/Untitled 4""),0)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HSOV_A2_FAIL"")= GetB (Ch(""[1]/Untitled 4""),1)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A1_FAIL"")= GetB (Ch(""[1]/Untitled 4""),2)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A2_FAIL"")= GetB (Ch(""[1]/Untitled 4""),3)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_SYS_A_PRS_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),6)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_SYS_A_RET_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),7)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A1_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),8)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_EDP_A2_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),9)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_LO_QTY"")= GetB (Ch(""[1]/Untitled 4""),11)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_FAIL"")= GetB (Ch(""[1]/Untitled 4""),12)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_HPP_A_CDF_FLT_CLG"")= GetB (Ch(""[1]/Untitled 4""),14)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_IV_A_FAIL"")= GetB (Ch(""[1]/Untitled 4""),15)")
    Call Calculate ("Ch(""HCM1_105/HCM_1_FLT_IV_A_FAIL_LOCAL"")= GetB (Ch(""[1]/Untitled 4""),16)")
    'HCM1 Label 106 decode - Untitled 5
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_PF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),0)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_RF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),1)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A1_CDF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),2)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A2_CDF_DPI_FAIL"")= GetB (Ch(""[1]/Untitled 5""),3)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A1_PS_FAIL"")= GetB (Ch(""[1]/Untitled 5""),4)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_EDP_A2_PS_FAIL"")= GetB (Ch(""[1]/Untitled 5""),5)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_PX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),6)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_TX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),7)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_SYS_A_QX_FAIL"")= GetB (Ch(""[1]/Untitled 5""),8)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A1_IND_FAIL"")= GetB (Ch(""[1]/Untitled 5""),10)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A2_IND_FAIL"")= GetB (Ch(""[1]/Untitled 5""),11)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_EDP_A1_FAIL"")= GetB (Ch(""[1]/Untitled 5""),12)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_EDP_A2_FAIL"")= GetB (Ch(""[1]/Untitled 5""),13)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_FLT_FV_A_FAIL"")= GetB (Ch(""[1]/Untitled 5""),14)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A1_RELAY_FAIL"")= GetB (Ch(""[1]/Untitled 5""),15)")
    Call Calculate ("Ch(""HCM1_106/HCM_1_HSOV_A2_RELAY_FAIL"")= GetB (Ch(""[1]/Untitled 5""),16)")
    Dim k, m, pMyChn, result, ArincTrue, intMyHandle01, intMyHandle02,intMyHandle03,intMyText, intMyError01, intMyError02, intMyError03
    intMyHandle01 = TextFileOpen("C:\ArincTrue.txt",tfCreate or tfWrite)
    intMyHandle02 = TextFileOpen("C:\ArincFalse.txt",tfCreate or tfWrite)
    intMyHandle03 = TextFileOpen("C:\ArincChange.txt",tfCreate or tfWrite)
    For k = 2 to 4
    For m = 1 to GroupChnCount(k)
    Set pMyChn = Data.Root.ChannelGroups(k).Channels(m)
    Result = ChnValMax(pMyChn)-ChnValMin(pMyChn)
    If Result = 0 and ChnValMax(pMyChn) > 0 then
    intMyText= TextfileWriteLn(intMyHandle01, pMyChn.Name)
    elseif result= 0 and ChnValMax(PMyChn) = 0 then
    intMyText= TextfileWriteLn(intMyHandle02, pMyChn.Name)
    else
    intMyText= TextfileWriteLn(intMyHandle03, pMyChn.Name)
    End If
    Next
    Next
    intMyError01 = TextFileClose(intMyHandle01)
    intMyError02 = TextFileClose(intMyHandle02)
    intMyError03 = TextFileClose(intMyHandle03)
    Solved!
    Go to Solution.

    Hi 2Pale4TX,
    You can't easily reference the content of an ASCII file.  Instead, I suggest you make a new Group of 3 text channels that you can drag onto a REPORT table.
    Dim k, m, z, ResultsGroup, TrueChannel, FalseChannel, ChangeChannel, Group, Channel, Result
    Set ResultsGroup = Data.Root.ChannelGroups.Add("Results")
    Set TrueChannel = ResultsGroup.Channels.Add("ArincTrue", DataTypeString)
    Set FalseChannel = ResultsGroup.Channels.Add("ArincFalse", DataTypeString)
    Set ChangeChannel = ResultsGroup.Channels.Add("ArincChange", DataTypeString)
    For k = 2 to 4
    Set Group = Data.Root.ChannelGroups(k)
    For m = 1 to Group.Channels.Count
    Set Channel = Group.Channels(m)
    ChMax = CMax(Channel)
    ChMin = CMin(Channel)
    Result = ChMax - ChMin
    If Result = 0 and ChMax > 0 Then
    z = TrueChannel.Size + 1
    TrueChannel(z) = Channel.Name
    Elseif Result = 0 and ChMax = 0 Then
    z = FalseChannel.Size + 1
    FalseChannel(z) = Channel.Name
    Else
    z = ChangeChannel.Size + 1
    ChangeChannel(z) = Channel.Name
    End If
    Next ' m
    Next ' k
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Automator-How to batch import txt files into excel

    Hi
    I have been using Automator to import hundreds of text files into one excel workbook using the "Import Text files to Excel Workbook" action. Automator works great for all files that are tab delimited. However I have another set of data that are output with a varying amount of spaces between each column. I cannot change the way they are output. Automator gives me the option of choosing "space" as a delimiter, but it wont give me the option to "Treat consecutive delimiters as one" that Import within excel does. I also tried to record my actions within excel many times but it didn't work even with just one file. So what I need is a way to get these text files into one excel workbook as separate worksheets with the data separated correctly into columns.
    Any help would be great!

    I'm confused by the "I cannot change the way they are output" line: What's stopping you from reimporting them into excel and resaving them as tab delimited?  Converting from fixed-format to tab-delimited is always a bit of a pain (it involves chunking each line to the correct sized bits and then stripping whitespace from the end - doable in applescript and shell scripting, but a headache to get right); no sense remaking the wheel if you can get Excel to do it for you.

  • Importing text file into table

    hello
    i have a text file which contains data like empno,date and one character . every day this file is updated with new records.
    now i want this data to get inserted to a table, whenever new record has been appended to the text file
    can i have query or some way to do this. i can do it through sql loader, but i will not have info when the data is appended to the text file.
    pls help
    thanks in advance
    sdsreenivas

    If you're on 8.0.3 (which has been desupported for a number of years), then SQL*Loader strikes me as your best option. You could write a batch process that re-loads the file periodically so you see changes or you could write a batch file that polls the timestamp for the file and calls SQL*Loader whenever it is updated.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • QT Pro import txt files

    I want to import txt file into a QT Movie. But under the pulldown menu is not a import icon.
    How can I import the text file.

    So once you choose open file what do you do from there? How do I get the text file into the movie?

  • No Clue where to start: Importing Excel file into existing oracle tables

    I have an excel document that has data organized in formats according to the columns of tables we have. Our database is 10 G and developers only have clients such as toad to manipulate database.
    There are two columns that are sequentially created using tbl.NEXTVAL in two different tables. They are called LEAD_ID and CUSTOMER_ID in LEADS and CUSTOMER table obviously these are not included in the file.
    CREATE tbl CUSTOMER ( int CUSTOMER_ID, varchar(40) FirsName, varchar(40) LastName )
    CREATE tbl LEADS ( int LEAD_ID, int CUSTOMER_ID, varchar(40) notes, varchar(40) status )
    The excel file is organized in cells that is consistent..
    Where do I start, how would I do it? and I am being asked to do it by tomorrow and I have no clue..Can I do this with oracle itself or I have to read the file through Java?
    Please give me some idea
    Thank you,

    Thanks for your suggestion with checking the log and bad file..It helped and was able to insert..
    Actually this is a real project.. and the actual data is in the hundreds or more.. The problem was I had put sysdate in double quotes and should have been without them. It is now inserting into the table.. however If I can ask one more question.. I have actually multiple tables that I need to insert into from an excel file which is organized in columns..
    For example.. let's say I have a row in the excel file as
    Claim_Number FirstName LastName
    A single insert would be inserting into four tables (CLAIMS, CUSTOMERS, LEADS, etc..)
    first on CLAIMS table that only takes the Claim_Number
    Second CUSTOMER table, that takes the Claim Number and Customer names ( FIRST and LAST)
    Third could be inserting the LEADS table with a sequenced lead number along with the customer name and claim number..
    So I would need to reuse the values three or four times for a single record to be inserted..
    Can you give me some idea?
    And also I have columns like ACCOUNT_TYPE that would be have same value always more like a constant or other columns like UPPER_FIRSTNAMEwith result that comes from a sql function with Uppse case of the other column.. which is just the upper case letter version of FIRST_NAME column.. and it won't be read from the input file.. How would I take care of such issues like the sysdate .. I tried the following shown in bold but didn't work..
    LOAD DATA
    INFILE 'c:\trex2.csv'
    BADFILE 'c:\trexbad.txt'
    APPEND
    INTO TABLE CC_CUSTOMERS
    FIELDS TERMINATED BY ","
    TRAILING NULLCOLS
         LAST_UPDATE_DATE sysdate,
         CUSTOMER_NUMBER "CC_CUSTOMERS_S.NEXTVAL",
         CUSTOMER_ID "CC_CUSTOMERS_S.NEXTVAL",
    UPPER_FIRSTNAME UPPER(:FIRST_NAME) ,
    ACCOUNT_TYPE CONSTANT 'Residential'
         FIRST_NAME,
         LAST_NAME
    Thank you in advance..

  • Problem reading .txt-file into JTable

    My problem is that I�m reading a .txt-file into a J-Table. It all goes okay, the FileChooser opens and the application reads the selected file (line). But then I get a Null Pointer Exception and the JTable does not get updated with the text from the file.
    Here�s my code (I kept it simple, and just want to read the text from the .txt-file to the first cell of the table.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.util.*;
    import java.lang.*;
    import java.io.*;
    public class TeamTable extends JFrame implements ActionListener, ItemListener                {
    static JTable table;
         // constructor
    public TeamTable()                {
    super( "Invoermodule - Team Table" );
    setSize( 740, 365 );
              // setting the rownames
    ListModel listModel = new AbstractListModel()                     {
    String headers[] = {"Team 1", "Team 2", "Team 3", "Team 4", "Team 5", "Team 6", "Team 7", "Team 8", "Team 9",
    "Team 10", "Team 11", "Team 12", "Team 13", "Team 14", "Team 15", "Team 16", "Team 17", "Team 18"};
    public int getSize() { return headers.length; }
    public Object getElementAt(int index) { return headers[index]; }
              // add listModel & rownames to the table
              DefaultTableModel defaultModel = new DefaultTableModel(listModel.getSize(),3);
              JTable table = new JTable( defaultModel );
              // setting the columnnames and center alignment of table cells
              int width = 200;
              int[] vColIndex = {0,1,2};
              String[] ColumnName = {"Name Team", "Name Chairman", "Name Manager"};
              TableCellRenderer centerRenderer = new CenterRenderer();          
              for (int i=0; i < vColIndex.length;i++)          {
                             table.getColumnModel().getColumn(vColIndex).setHeaderValue(ColumnName[i]);
                             table.getColumnModel().getColumn(vColIndex[i]).setPreferredWidth(width);
                             table.getColumnModel().getColumn(vColIndex[i]).setCellRenderer(centerRenderer);
              table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
              // force the header to resize and repaint itself
              table.getTableHeader().resizeAndRepaint();
              // create single component to add to scrollpane (rowHeader is JList with argument listModel)
              JList rowHeader = new JList(listModel);
              rowHeader.setFixedCellWidth(100);
              rowHeader.setFixedCellHeight(table.getRowHeight());
              rowHeader.setCellRenderer(new RowHeaderRenderer(table));
              // add to scroll pane:
              JScrollPane scroll = new JScrollPane( table );
              scroll.setRowHeaderView(rowHeader); // Adds row-list left of the table
              getContentPane().add(scroll, BorderLayout.CENTER);
              // add menubar, menu, menuitems with evenlisteners to the frame.
              JMenuBar menubar = new JMenuBar();
              setJMenuBar (menubar);
              JMenu filemenu = new JMenu("File");
              menubar.add(filemenu);
              JMenuItem open = new JMenuItem("Open");
              JMenuItem save = new JMenuItem("Save");
              JMenuItem exit = new JMenuItem("Exit");
              open.addActionListener(this);
              save.addActionListener(this);
              exit.addActionListener(this);
              filemenu.add(open);
              filemenu.add(save);
              filemenu.add(exit);
              filemenu.addItemListener(this);
    // ActionListener for ActionEvents on JMenuItems.
    public void actionPerformed(ActionEvent e) {       
         String open = "Open";
         String save = "Save";
         String exit = "Exit";
              if (e.getSource() instanceof JMenuItem)     {
                   JMenuItem source = (JMenuItem)(e.getSource());
                   String x = source.getText();
                        if (x == open)          {
                             System.out.println("open file");
                        // create JFileChooser.
                        String filename = File.separator+"tmp";
                        JFileChooser fc = new JFileChooser(new File(filename));
                        // set default directory.
                        File wrkDir = new File("C:/Documents and Settings/Erwin en G-M/Mijn documenten/Erwin/Match Day");
                        fc.setCurrentDirectory(wrkDir);
                        // show open dialog.
                        int returnVal =     fc.showOpenDialog(null);
                        File selFile = fc.getSelectedFile();
                        if(returnVal == JFileChooser.APPROVE_OPTION) {
                        System.out.println("You chose to open this file: " +
                   fc.getSelectedFile().getName());
                        try          {
                             BufferedReader invoer = new BufferedReader(new FileReader(selFile));
                             String line = invoer.readLine();
                             System.out.println(line);
                             // THIS IS WHERE IT GOES WRONG, I THINK
                             table.setValueAt(line, 1, 1);
                             table.fireTableDataChanged();
                        catch (IOException ioExc){
                        if (x == save)          {
                             System.out.println("save file");
                        if (x == exit)          {
                             System.out.println("exit file");
    // ItemListener for ItemEvents on JMenu.
    public void itemStateChanged(ItemEvent e) {       
              String s = "Item event detected. Event source: " + e.getSource();
              System.out.println(s);
         public static void main(String[] args)                {
              TeamTable frame = new TeamTable();
              frame.setUndecorated(true);
         frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
              frame.addWindowListener( new WindowAdapter()           {
                   public void windowClosing( WindowEvent e )                {
         System.exit(0);
    frame.setVisible(true);
    * Define the look/content for a cell in the row header
    * In this instance uses the JTables header properties
    class RowHeaderRenderer extends JLabel implements ListCellRenderer           {
    * Constructor creates all cells the same
    * To change look for individual cells put code in
    * getListCellRendererComponent method
    RowHeaderRenderer(JTable table)      {
    JTableHeader header = table.getTableHeader();
    setOpaque(true);
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    setHorizontalAlignment(CENTER);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setFont(header.getFont());
    * Returns the JLabel after setting the text of the cell
         public Component getListCellRendererComponent( JList list,
    Object value, int index, boolean isSelected, boolean cellHasFocus)      {
    setText((value == null) ? "" : value.toString());
    return this;

    My problem is that I�m reading a .txt-file into a J-Table. It all goes okay, the FileChooser opens and the application reads the selected file (line). But then I get a Null Pointer Exception and the JTable does not get updated with the text from the file.
    Here�s my code (I kept it simple, and just want to read the text from the .txt-file to the first cell of the table.
    A MORE READABLE VERSION !
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    import java.util.*;
    import java.lang.*;
    import java.io.*;
    public class TeamTable extends JFrame implements ActionListener, ItemListener                {
    static JTable table;
         // constructor
        public TeamTable()                {
            super( "Invoermodule - Team Table" );
            setSize( 740, 365 );
              // setting the rownames
            ListModel listModel = new AbstractListModel()                     {
                String headers[] = {"Team 1", "Team 2", "Team 3", "Team 4", "Team 5", "Team 6", "Team 7", "Team 8", "Team 9",
                "Team 10", "Team 11", "Team 12", "Team 13", "Team 14", "Team 15", "Team 16", "Team 17", "Team 18"};
                public int getSize() { return headers.length; }
                public Object getElementAt(int index) { return headers[index]; }
              // add listModel & rownames to the table
              DefaultTableModel defaultModel = new DefaultTableModel(listModel.getSize(),3);
              JTable table = new JTable( defaultModel );
              // setting the columnnames and center alignment of table cells
              int width = 200;
              int[] vColIndex = {0,1,2};
              String[] ColumnName = {"Name Team", "Name Chairman", "Name Manager"};
              TableCellRenderer centerRenderer = new CenterRenderer();          
              for (int i=0; i < vColIndex.length;i++)          {
                             table.getColumnModel().getColumn(vColIndex).setHeaderValue(ColumnName[i]);
                             table.getColumnModel().getColumn(vColIndex[i]).setPreferredWidth(width);
                             table.getColumnModel().getColumn(vColIndex[i]).setCellRenderer(centerRenderer);
              table.setFont(new java.awt.Font("Dialog", Font.ITALIC, 12));
              // force the header to resize and repaint itself
              table.getTableHeader().resizeAndRepaint();
              // create single component to add to scrollpane (rowHeader is JList with argument listModel)
              JList rowHeader = new JList(listModel);
              rowHeader.setFixedCellWidth(100);
              rowHeader.setFixedCellHeight(table.getRowHeight());
              rowHeader.setCellRenderer(new RowHeaderRenderer(table));
              // add to scroll pane:
              JScrollPane scroll = new JScrollPane( table );
              scroll.setRowHeaderView(rowHeader); // Adds row-list left of the table
              getContentPane().add(scroll, BorderLayout.CENTER);
              // add menubar, menu, menuitems with evenlisteners to the frame.
              JMenuBar menubar = new JMenuBar();
              setJMenuBar (menubar);
              JMenu filemenu = new JMenu("File");
              menubar.add(filemenu);
              JMenuItem open = new JMenuItem("Open");
              JMenuItem save = new JMenuItem("Save");
              JMenuItem exit = new JMenuItem("Exit");
              open.addActionListener(this);
              save.addActionListener(this);
              exit.addActionListener(this);
              filemenu.add(open);
              filemenu.add(save);
              filemenu.add(exit);
              filemenu.addItemListener(this);
    // ActionListener for ActionEvents on JMenuItems.
    public void actionPerformed(ActionEvent e) {       
         String open = "Open";
         String save = "Save";
         String exit = "Exit";
              if (e.getSource() instanceof JMenuItem)     {
                   JMenuItem source = (JMenuItem)(e.getSource());
                   String x = source.getText();
                        if (x == open)          {
                             System.out.println("open file");
                        // create JFileChooser.
                        String filename = File.separator+"tmp";
                        JFileChooser fc = new JFileChooser(new File(filename));
                        // set default directory.
                        File wrkDir = new File("C:/Documents and Settings/Erwin en G-M/Mijn documenten/Erwin/Match Day");
                        fc.setCurrentDirectory(wrkDir);
                        // show open dialog.
                        int returnVal =     fc.showOpenDialog(null);
                        File selFile = fc.getSelectedFile();
                        if(returnVal == JFileChooser.APPROVE_OPTION) {
                        System.out.println("You chose to open this file: " +
                   fc.getSelectedFile().getName());
                        try          {
                             BufferedReader invoer = new BufferedReader(new FileReader(selFile));
                             String line = invoer.readLine();
                             System.out.println(line);
                             // THIS IS WHERE IT GOES WRONG, I THINK
                             table.setValueAt(line, 1, 1);
                             table.fireTableDataChanged();
                        catch (IOException ioExc){
                        if (x == save)          {
                             System.out.println("save file");
                        if (x == exit)          {
                             System.out.println("exit file");
    // ItemListener for ItemEvents on JMenu.
    public void itemStateChanged(ItemEvent e) {       
              String s = "Item event detected. Event source: " + e.getSource();
              System.out.println(s);
         public static void main(String[] args)                {
              TeamTable frame = new TeamTable();
              frame.setUndecorated(true);
         frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
              frame.addWindowListener( new WindowAdapter()           {
                   public void windowClosing( WindowEvent e )                {
         System.exit(0);
    frame.setVisible(true);
    * Define the look/content for a cell in the row header
    * In this instance uses the JTables header properties
    class RowHeaderRenderer extends JLabel implements ListCellRenderer           {
    * Constructor creates all cells the same
    * To change look for individual cells put code in
    * getListCellRendererComponent method
    RowHeaderRenderer(JTable table)      {
    JTableHeader header = table.getTableHeader();
    setOpaque(true);
    setBorder(UIManager.getBorder("TableHeader.cellBorder"));
    setHorizontalAlignment(CENTER);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setFont(header.getFont());
    * Returns the JLabel after setting the text of the cell
         public Component getListCellRendererComponent( JList list,
    Object value, int index, boolean isSelected, boolean cellHasFocus)      {
    setText((value == null) ? "" : value.toString());
    return this;

  • Bcp txt file into Sybase

    I wonder how to bcp a txt file into sybase, what is the method I need and syntax. i know it is poss using dos commands but not sure what to do in java program. can anyone please help? many thanks

    Dave,thanks for the suggestion. I am having a lot of trouble , and if that code works for you, then it must be my connection string.
    I am trying
    import java.io.*;
    public class rabbit5{
    public static void main (String[] args) {
    String bcp_command ="bcp [maindatabase].[databaseowner].[table-to-populate] in [file - in] -I -Sserver -Uuser -Ppassword >stdout_ylogfile 2>std_error_file";
    try{
    String[]cmd = {"cmd.exe","/C",bcp_command };
    Process p = Runtime.getRuntime().exec(cmd);
    p.waitFor();
    catch(Exception i){   
    System.out.println("this has not bcp'd");
    But I get a variety of errors; from not being able to find my database, to not being able to find my server - in that order as well!! All to do with my bcp_command string
    You have been very helpful, but I think I need an example of a working string. please??
    many thanks
    Kevin

  • Copy contents of a txt file into a transport request

    I am implementing the steps of the 990534 note.
    The note says "Create a new transport request (transaction SE09) in the source client of your Solution Manager system. Unpack file SOLMAN40_MOPZ_TTYP_SLMO_000.zip, which is attached to this note. Copy the contents of the SOLMAN40_MOPZ_TTYP_SLMO_000.txt file into the transport request."
    can anyone tell me how can I copy the contents of a txt file into a transport request?

    Hello,
    I don't know the OSS note, but I think they mean, that you have to go into the object list of your transport (in transaction SE09), switch to change mode and insert the objects from the text file.
    I guess the text file looks like:
    R3TR PROG xyz
    R3TR TABL abc
    Best regards
    Stephan

  • Bullet character in imported TXT file

    I am importing an external TXT file into a dynamic text box
    in my SWF file using Actionscript (see AS below).
    I want the text to read as a bulleted list.
    I tried typing the bullet character (Option + 8 on Mac), but
    this gave me Yen symbols when I previewed the movie.
    Then I tried the HTML code <UL>, <LI>, etc.,
    which just showed exactly as typed when previewed.
    I also tried the HTML code for this character (&#149;)
    but this also showed exactly as typed when previewed.
    How do I create the bullet character in Flash? Is there a
    reference for creating all types of special characters in Flash?
    Or is there a simple way to create a bulleted list?
    Many Thanks,
    Nathan
    My system specifications:
    Mac OS 10.4.10
    Flash CS3

    for html content you would need to use external_txt.htmlText
    = event.target.data;. also embed the basic font and the specific
    "•" character
    if you wanted to go the character code route you would have
    to strip the character code from the string first and replace it
    with a bullet.

  • Can I import html files into Buzzword?

    Can I import html files into Buzzword?

    Thank you for your post.
    Buzzword lets you import Microsoft Word (DOC, DOCX), plain text (TXT), Rich Text Format (RTF), Word 2003 XML, and Open Document Format (.odt) files. (Font substitution and other formatting changes sometimes occur on import, depending on the content of the document.) You'll need to convert your HTML file to one of the supported file types before importing to Buzzword.
    Kind Regards,
    Michelle

  • Importing Text Files  into Notes

    Having trouble reading imported text. I have IPod nano 3rd gen. It is checked to enable disc use. When I drop a .txt file into notes folder, then eject IPod, I can see the document titles in IPod/notes however, text displays as code (alot of 0's &1's and other garbled letters). Does anyone know why this happens and how I can solve this? I would greatly appreciate any suggestions.
    Thanks

    The files MUST be plain text files (possible sich text format as well) but not Word Documents and stuff like that. Simply taking a Word document and changing the extension from .doc to .txt won't do it for you, if that is what you tried.
    Patrick

  • Also problem read txt files into JTable

    hello,
    i used the following method to load a .txt file into JTable
    try{
                        FileInputStream fin = new FileInputStream(filename);
                        InputStreamReader isr = new InputStreamReader(fin);
                        BufferedReader br =  new BufferedReader(isr);
                        StringTokenizer st1 = new StringTokenizer(br.readLine(), "|");
                        while( st1.hasMoreTokens() )
                             columnNames.addElement(st1.nextToken());
                        while ((aLine = br.readLine()) != null)
                             StringTokenizer st2 = new StringTokenizer(aLine, "|");
                             Vector row = new Vector();
                             while(st2.hasMoreTokens())
                                  row.addElement(st2.nextToken());
                             data.addElement( row );
                        br.close();
                        }catch(Exception e){ e.printStackTrace(); }
                   //colNum = st1.countTokens();
                   model = new DefaultTableModel(data,columnNames);
                   table.setModel(model);but there is a problem : if cell A's location is (4,5),and its left neighbour,that is, cell(4,4) is blank (the value is ""), the the cell A's value will be displayed in cell(4,4).if cell(4,3) is also blank ,the cell A's value will be displayed in cell(4,3).that is,the non-blank value will be displayed in the first blank cell of the line.
    how can i solve it?Please give me some helps or links.
    Thank u very much!

    Or, use the String.split(..) method to tokenize the data
    Or, use my SimpleTokenizer class which you can find by using the search function.

  • How to Import .txt files in ORACLE having 300 thousand records

    How to Import .txt files in ORACLE having 300 thousand records. Kindly help me in that context

    You can make use of Sql*Loader utility and You can also use External table technique for this puspose.
    For external table go through this link.
    http://www.oracle-base.com/articles/9i/ExternalTables9i.php
    Regards

Maybe you are looking for