Using JDBC to write a DAT file with delimiters to a database

Hi Everybody
I am new to JDBC and i am trying out some small applications: I downloaded this small program and tried to compile it and and I got the following errors: ( I have MySql installed). I have to set the classpath for the driver. But I am not sure why I am gettting the NullPointerException though)
I will be very gratefull to your help. Thanks a lot..
Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
     at java.net.URLClassLoader$1.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClassInternal(Unknown Source)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Unknown Source)
     at us.ilango.WriteFileToTable.<init>(WriteFileToTable.java:69)
     at us.ilango.WriteFileToTable.main(WriteFileToTable.java:367)
java.lang.NullPointerException
     at us.ilango.WriteFileToTable.createTable(WriteFileToTable.java:97)
     at us.ilango.WriteFileToTable.main(WriteFileToTable.java:368)
Exception in thread "main"
the Program is as follows:
package us.ilango;
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import java.text.ParseException;
* The following class provides an example of how to read a simple text file
* of records and then insert them into a table in a database. A text file
* named Employee.txt will contain employee records to be inserted into the
* following table:
*      SQL> desc emp
*      Name              Null?    Type
*      EMP_ID              NOT NULL NUMBER
*      DEPT_ID                      NUMBER
*      NAME                NOT NULL VARCHAR2(30)
*      DATE_OF_BIRTH       NOT NULL DATE
*      DATE_OF_HIRE        NOT NULL DATE
*      MONTHLY_SALARY      NOT NULL NUMBER(15,2)
*      POSITION            NOT NULL VARCHAR2(100)
*      EXTENSION                    NUMBER
*      OFFICE_LOCATION              VARCHAR2(100)
* NOTE: This example will provide and call a method that creates the EMP
*       table. The name of the method is called createTable() and is called
*       from the main() method.
public class WriteFileToTable {
    final static String driverClass    = "oracle.jdbc.driver.OracleDriver";
    final static String connectionURL  = "jdbc:oracle:thin:@localhost:1521:CUSTDB";
    final static String userID         = "scott";
    final static String userPassword   = "tiger";
    final static String inputFileName  = "Employee.txt";
    final static String TABLE_NAME     = "EMP";
    final static String DELIM          = ",";
    Connection   con                   = null;
     * Construct a WriteFileToTable object. This constructor will create an
     * Oracle database connection.
    public WriteFileToTable() {
        try {
            System.out.print("  Loading JDBC Driver  -> " + driverClass + "\n");
            Class.forName(driverClass).newInstance();
            System.out.print("  Connecting to        -> " + connectionURL + "\n");
            this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
            System.out.print("  Connected as         -> " + userID + "\n");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
     * Method used to create the initial EMP table. Before attempting to create
     * the table, this method will first try to drop the table.
    public void createTable() {
        Statement stmt = null;
        try {
            stmt = con.createStatement();
            System.out.print("  Dropping Table: " + TABLE_NAME + "\n");
            stmt.executeUpdate("DROP TABLE " + TABLE_NAME);
            System.out.print("    - Dropped Table...\n");
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            System.out.print("    - Table " + TABLE_NAME + " did not exist.\n");
        try {
            stmt = con.createStatement();
            System.out.print("  Creating Table: " + TABLE_NAME + "\n");
            stmt.executeUpdate("CREATE TABLE emp (" +
                             "    emp_id           NUMBER NOT NULL " +
                             "  , dept_id          NUMBER " +
                             "  , name             VARCHAR2(30)  NOT NULL " +
                             "  , date_of_birth    DATE          NOT NULL " +
                             "  , date_of_hire     DATE          NOT NULL " +
                             "  , monthly_salary   NUMBER(15,2)  NOT NULL " +
                             "  , position         VARCHAR2(100) NOT NULL " +
                             "  , extension        NUMBER " +
                             "  , office_location  VARCHAR2(100))");
            System.out.print("    - Created Table...\n");
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
     * Method used to read records from Employee.txt file then write the records
     * to an Oracle table within the database named "EMP".
    public void performLoadWrite() {
        Statement stmt          = null;
        int       insertResults = 0;
        StringTokenizer st = null;
        String  emp_id;
        String  dept_id;
        String  name;
        String  date_of_birth;
        String  date_of_hire;
        String  monthly_salary;
        String  position;
        String  extension;
        String  office_location;
        try {
            System.out.print("  Creating Statement...\n");
            stmt = con.createStatement ();
            System.out.print("  Create FileReader Object for file: " + inputFileName + "...\n");
            FileReader inputFileReader = new FileReader(inputFileName);
            System.out.print("  Create BufferedReader Object for FileReader Object...\n");
            BufferedReader inputStream   = new BufferedReader(inputFileReader);
            String inLine = null;
            while ((inLine = inputStream.readLine()) != null) {
                st = new StringTokenizer(inLine, DELIM);
                emp_id   = st.nextToken();
                dept_id  = st.nextToken();
                name     = st.nextToken();
                date_of_birth = st.nextToken();
                date_of_hire = st.nextToken();
                monthly_salary = st.nextToken();
                position = st.nextToken();
                extension = st.nextToken();
                office_location = st.nextToken();
                System.out.print("  Inserting value for [" + name + "]\n");
                insertResults = stmt.executeUpdate(
                        "INSERT INTO " + TABLE_NAME + " VALUES (" +
                                  emp_id +
                        "  ,  " + dept_id +
                        "  , '" + name + "'" +
                        "  , '" + date_of_birth + "'" +
                        "  , '" + date_of_hire + "'" +
                        "  ,  " + monthly_salary +
                        "  , '" + position + "'" +
                        "  ,  " + extension +
                        "  , '" + office_location + "')");
                System.out.print("    " + insertResults + " row created.\n");
            System.out.print("  Commiting Transaction...\n");
            con.commit();
            System.out.print("  Closing inputString...\n");
            inputStream.close();
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
     * Method used to query records from the database table EMP. This method
     * can be used to verify all records have been correctly loaded from the
     * example text file "Employee.txt".
    public void queryRecords() {
        Statement stmt           = null;
        ResultSet rset           = null;
        int       deleteResults  = 0;
        int       rowNumber      = 0;
        int     emp_id;
        int     dept_id;
        String  name;
        String  date_of_birth;
        Date    date_of_birth_p;
        String  date_of_hire;
        Date    date_of_hire_p;
        float   monthly_salary;
        String  position;
        int     extension;
        String  office_location;
        try {
            SimpleDateFormat formatter      = new SimpleDateFormat("yyyy-MM-dd");
            NumberFormat     defaultFormat  =     NumberFormat.getCurrencyInstance();
            System.out.print("  Creating Statement...\n");
            stmt = con.createStatement ();
            System.out.print("  Opening query for table: " + TABLE_NAME + "...\n");
            rset = stmt.executeQuery ("SELECT * FROM emp ORDER BY emp_id");
            while (rset.next ()) {
                rowNumber = rset.getRow();
                emp_id = rset.getInt(1);
                if ( rset.wasNull() )   {emp_id = -1;}
                dept_id = rset.getInt(2);
                if ( rset.wasNull() )   {dept_id = -1;}
                name = rset.getString(3);
                if ( rset.wasNull() )   {name = "<null>";}
                date_of_birth = rset.getString(4);
                if ( rset.wasNull() ) {date_of_birth = "1900-01-01";}
                try {
                    date_of_birth_p = formatter.parse(date_of_birth);
                } catch (ParseException e) {
                    date_of_birth_p = new Date(0);
                date_of_hire = rset.getString(5);
                if ( rset.wasNull() ) {date_of_hire = "1900-01-01";}
                try {
                    date_of_hire_p = formatter.parse(date_of_hire);
                } catch (ParseException e) {
                    date_of_hire_p = new Date(0);
                monthly_salary = rset.getFloat(6);
                if ( rset.wasNull() ) {monthly_salary = 0;}
                position = rset.getString(7);
                if ( rset.wasNull() ) {position = "<null>";}
                extension = rset.getInt(8);
                if ( rset.wasNull() )   {extension = -1;}
                office_location = rset.getString(9);
                if ( rset.wasNull() ) {office_location = "<null>";}
                System.out.print(
                    "\n" +
                    "  RESULTS -> [R" + rowNumber + "] " + "\n" +
                    "      Employee ID     : " + emp_id + "\n" +
                    "      Department ID   : " + dept_id + "\n" +
                    "      Employee Name   : " + name + "\n" +
                    "      D.O.B.          : " + date_of_birth_p + "\n" +
                    "      Date of Hire    : " + date_of_hire_p + "\n" +
                    "      Monthly Salary  : " + defaultFormat.format(monthly_salary) + "\n" +
                    "      Position        : " + position + "\n" +
                    "      Extension       : x" + extension + "\n" +
                    "      Office Location : " + office_location +
                    "\n");
            System.out.print("  Closing ResultSet...\n");
            rset.close();
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
     * Close down Oracle connection.
    public void closeConnection() {
        try {
            System.out.print("  Closing Connection...\n");
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
     * Sole entry point to the class and application.
     * @param args Array of String arguments.
     * @exception java.lang.InterruptedException
     *            Thrown from the Thread class.
    public static void main(String[] args)
            throws java.lang.InterruptedException {
        WriteFileToTable runExample = new WriteFileToTable();
        runExample.createTable();
        runExample.performLoadWrite();
        runExample.queryRecords();
        runExample.closeConnection();
    }

Hi
Thanks a lot. I ran the program with the MySql driver as follows:
The errors are as follows: I will ttry to place the Driver in the Classpath. As far as I know the driver has been specified correctly this time.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
     at java.net.URLClassLoader$1.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClassInternal(Unknown Source)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Unknown Source)
     at us.ilango.WriteAntennas.<init>(WriteAntennas.java:41)
     at us.ilango.WriteAntennas.main(WriteAntennas.java:377)
java.lang.NullPointerException
     at us.ilango.WriteAntennas.createTable(WriteAntennas.java:70)
     at us.ilango.WriteAntennas.main(WriteAntennas.java:378)
Exception in thread "main" Loading JDBC Driver -> com.mysql.jdbc.Driver
The program is as follows:
package us.ilango;
* @author ilango
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.IOException;
public class WriteAntennas {
    final static String driverClass    = "com.mysql.jdbc.Driver";
    final static String connectionURL  = "jdbc:mysql://localhost/test2";
    final static String userID         = "brian";
    final static String userPassword   = " ";
    final static String inputFileName  = "CO.DAT";
    final static String TABLE_NAME     = "CELL";
    final static String DELIM          = "|";
    Connection   con                   = null;
    public WriteAntennas() {
        try {
            System.out.print("  Loading JDBC Driver  -> " + driverClass + "\n");
            Class.forName(driverClass).newInstance();
            System.out.print("  Connecting to        -> " + connectionURL + "\n");
            this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
            System.out.print("  Connected as         -> " + userID + "\n");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
     * Method used to create the initial EMP table. Before attempting to create
     * the table, this method will first try to drop the table.
    public void createTable() {
        Statement stmt=null;
        try {
            stmt = con.createStatement();
            System.out.print("  Dropping Table: " + TABLE_NAME + "\n");
            stmt.executeUpdate("DROP TABLE " + TABLE_NAME);
            System.out.print("    - Dropped Table...\n");
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            System.out.print("    - Table " + TABLE_NAME + " did not exist.\n");
        try {
            stmt = con.createStatement();
            System.out.print("  Creating Table: " + TABLE_NAME + "\n");
            stmt.executeUpdate("create table TOWER_PUBACC_CO (" +
     "record_type               char(2)              null" +
     ", content_indicator         char(3)              null" +
     ", file_number               char(8)              null" +
     ", registration_number       char(7)              null" +
     ", unique_system_identifier  long(9,0)         not null" +
     ", coordinate_type           char(1)              not null" +
     ",latitude_degrees          int                  null" +
     ",latitude_minutes          int                  null" +
     ",latitude_seconds          int(4,1)         null" +
     ",latitude_direction        char(1)              null" +
     ",latitude_total_seconds    int(8,1)         null" +
     ",longitude_degrees         int                  null" +
     ",longitude_minutes         int                  null" +
     ",longitude_seconds         int(4,1)         null" +
     ",longitude_direction       char(1)              null" +
     ",longitude_total_seconds   int(8,1)         null)" );
            System.out.print("   created Table...\n");
            System.out.print("  closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
    public void performLoadWrite() {
        Statement stmt          = null;
        int       insertResults = 0;
        StringTokenizer st = null;
        String record_type ;
        String  content_indicator;
        String file_number ;
        String registration_number;
         String unique_system_identifier ;
        String coordinate_type;
        String latitude_degrees;
        String  latitude_minutes;
        String latitude_seconds;
        String latitude_direction;
        String latitude_total_seconds;
        String longitude_degrees;
       String longitude_minutes;
       String longitude_seconds;
       String longitude_direction;
       String longitude_total_seconds;
        try {
            System.out.print("  Creating Statement...\n");
            stmt = con.createStatement ();
            System.out.print("  Create FileReader Object for file: " + inputFileName + "...\n");
            FileReader inputFileReader = new FileReader(inputFileName);
            System.out.print("  Create BufferedReader Object for FileReader Object...\n");
            BufferedReader inputStream   = new BufferedReader(inputFileReader);
            String inLine = null;
            while ((inLine = inputStream.readLine()) != null) {
                st = new StringTokenizer(inLine, DELIM);
                record_type   = st.nextToken();
               content_indicator = st.nextToken();
                file_number    = st.nextToken();
                registration_number = st.nextToken();
                unique_system_identifier = st.nextToken();
               coordinate_type =st.nextToken();
               latitude_degrees  = st.nextToken();
               latitude_minutes = st.nextToken();
                latitude_seconds=st.nextToken();
               latitude_direction = st.nextToken();
                latitude_total_seconds =st.nextToken();
                longitude_degrees= st.nextToken();
                longitude_minutes = st.nextToken();
                longitude_seconds = st.nextToken();
                longitude_direction=st.nextToken();
                longitude_total_seconds =st.nextToken();
                System.out.print("  Inserting value for [" + unique_system_identifier + "]\n");
                insertResults = stmt.executeUpdate(
                        "INSERT INTO " + TABLE_NAME + " VALUES (" +
                                  record_type +
                        "  ,  " + content_indicator +
                        "  , '" + file_number + "'" +
                        "  , '" + registration_number + "'" +
                        "  , '" + unique_system_identifier + "'" +
                        "  ,  " + coordinate_type + "'" +
                        "  , '" + latitude_degrees + "'" +
                        "  ,  " + latitude_minutes + "'" +
                        "  , '" + latitude_seconds + "'" +
                        "  , '" + latitude_direction + "'" +
                        "  , '" + latitude_total_seconds + "'" +
                       "  , '" + longitude_minutes + "'" +
                       "  , '" + longitude_seconds + "'" +
                      "  , '" + longitude_direction + "'" +
                       "  , '" + longitude_total_seconds + "')");
                System.out.print("    " + insertResults + " row created.\n");
            System.out.print("  Commiting Transaction...\n");
            con.commit();
            System.out.print("  Closing inputString...\n");
            inputStream.close();
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
    public void queryRecords() {
        Statement stmt           = null;
        ResultSet rset           = null;
        int       deleteResults  = 0;
        int       rowNumber      = 0;
        String   record_type;
        String   content_indicator;
        String  file_number;
        String registration_number ;
        long  unique_system_identifier;
        String coordinate_type ;
        int   latitude_degrees ;
        int latitude_minutes ;
        int latitude_seconds;
        String latitude_direction;
        int  latitude_total_seconds;
        int     longitude_degrees;
         int longitude_minutes;
           int     longitude_seconds;
             String longitude_direction;
       int  longitude_total_seconds;
        try {
            System.out.print("  Creating Statement...\n");
            stmt = con.createStatement ();
            System.out.print("  Opening query for table: " + TABLE_NAME + "...\n");
            rset = stmt.executeQuery ("SELECT * FROM cell ORDER BY unique_system_identifier");
            while (rset.next ()) {
                rowNumber = rset.getRow();
                unique_system_identifier = rset.getInt (1);
                if ( rset.wasNull() )   {unique_system_identifier = -1;}
                record_type = rset.getString (2);
                if ( rset.wasNull() )   {record_type = "<null>";}
                content_indicator = rset.getString(3);
                if ( rset.wasNull() )   {content_indicator = "<null>";}
                file_number = rset.getString(4);
                if ( rset.wasNull() ) {file_number = "<null>";}
                registration_number = rset.getString(5);
                if ( rset.wasNull() ) {registration_number = "<null>";}
                coordinate_type = rset.getString(6);
                if ( rset.wasNull() )   {coordinate_type = "<null>";}
                latitude_degrees = rset.getInt(7);
                if ( rset.wasNull() ) {latitude_degrees = 1;}
latitude_minutes = rset.getInt(8);
                if ( rset.wasNull() ) {latitude_minutes = 1;}
latitude_seconds = rset.getInt(9);
                if ( rset.wasNull() ) {latitude_seconds = 1;}
latitude_direction = rset.getString(10);
                if ( rset.wasNull() ) {latitude_direction = "<null>";}
latitude_total_seconds = rset.getInt(11);
                if ( rset.wasNull() ) {latitude_total_seconds = 1;}
longitude_degrees = rset.getInt(12);
                if ( rset.wasNull() ) {longitude_degrees = 1;}
longitude_minutes = rset.getInt(13);
                if ( rset.wasNull() ) {longitude_minutes = 1;}
longitude_seconds = rset.getInt(14);
                if ( rset.wasNull() ) {longitude_seconds = 1;}
longitude_direction = rset.getString(15);
                if ( rset.wasNull() ) {longitude_direction = "<null>";}
longitude_total_seconds = rset.getInt(16);
                if ( rset.wasNull() ) {longitude_total_seconds = 1;}
                System.out.print(
                    "\n" +
                    "  RESULTS -> [R" + rowNumber + "] " + "\n" +
                    "  Unique_System_Identifier         : " + unique_system_identifier  + "\n" +
                    "  Record_type     : " + record_type   + "\n" +
                    "  Content_Indicator      : " + content_indicator   + "\n" +
                    "  Registration_Number              : " + registration_number   + "\n" +
                    "  File_Number        : " +  file_number  + "\n" +
                    "  Coordinate_Type     : " + coordinate_type  + "\n" +
                    "  Latitude_Degrees          : " + latitude_degrees + "\n" +
                    "  Latitude_Minutes          : " + latitude_minutes + "\n" +
                    "  Latitude_Seconds           : " + latitude_seconds + "\n" +
                    " Latitude_Direction            : " + latitude_direction + "\n" +
                    "  Latitude_Total_Seconds           : " + latitude_total_seconds + "\n" +
                    "  Longitude_Degrees           : " + longitude_degrees + "\n" +
                    "  longitude_minutes           : " + longitude_minutes + "\n" +
                    "  Longitude_Seconds           : " + longitude_seconds + "\n" +
                   "     longitude_direction        : " + longitude_direction + "\n" +
                   "  Longitude_Total_Seconds           : " + longitude_total_seconds +
                   "\n");
            System.out.print("  Closing ResultSet...\n");
            rset.close();
            System.out.print("  Closing Statement...\n");
            stmt.close();
        } catch (SQLException e) {
            e.printStackTrace();
    public void closeConnection() {
        try {
            System.out.print("  Closing Connection...\n");
            con.close();
        } catch (SQLException e) {
            e.printStackTrace();
    public static void main(String[] args)
            throws java.lang.InterruptedException {
        WriteAntennas runJob = new WriteAntennas();
        runJob.createTable();
        runJob.performLoadWrite();
        runJob.queryRecords();
        runJob.closeConnection();
}

Similar Messages

  • LabVIEW created .DAT file with saving only new data on existing files

    I can successfully create and save a .DAT file using LabView and Diadem.   The save command I am using (in Labview) only overwrites existing files, I would like it to save only the new data from the last save.  Overall I would like to save the data every 1hr and since my test will last for many hours, the further along in the test the longer it would take to save the full file.  I know Diadem has the capability to save in such a manner, so I have thought about after I write to Diadem have a small Diadem application save periodically, but I haven't found a way to save the .DAT file, with out any signals coming into the save function.  I have attached the example .DAT file creater and saver I am using to figure it out.  thanks for your help!

    Howdy New Guy -
    I am not sure if you are looking to append to a file, or if you would
    like to overwrite a file.  In either case, you can take a look at
    the "Append To File.vi" example for DIAdem. 
    Either way, you may be experiencing problems because you are only using
    the "DIAdem Simple File Write.vi" (found on the DIAdem >> DAT
    Files palette).  Instead, you can use the "DIAdem File Write.vi"
    (located on teh DIAdem >> DAT Files >> DAT Files Advanced
    palette).  This VI can be set to overwrite or append to file.
    I hope this helps in your development!
    Andrew W. || Applications Engineer

  • How to load unicode data files with fixed records lengths?

    Hi!
    To load unicode data files with fixed records lengths (in terms of charachters and not of bytes!) using SQL*Loader manually, I found two ways:
    Alternative 1: one record per row
    SQL*Loader control file example (without POSITION, since POSITION always refers to bytes!)<br>
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode.dat
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001111112234444
    01NormalDExZWEI
    02ÄÜÖßêÊûÛxöööö
    03ÄÜÖßêÊûÛxöööö
    04üüüüüüÖÄxµôÔµ Alternative2: variable length records
    LOAD DATA
    CHARACTERSET UTF8
    LENGTH SEMANTICS CHAR
    INFILE unicode_var.dat "VAR 4"
    INTO TABLE STG_UNICODE
    TRUNCATE
    A CHAR(2) ,
    B CHAR(6) ,
    C CHAR(2) ,
    D CHAR(1) ,
    E CHAR(4)
    ) Datafile:
    001501NormalDExZWEI002702ÄÜÖßêÊûÛxöööö002604üuüüüüÖÄxµôÔµ Problems
    Implementing these two alternatives in OWB, I encounter the following problems:
    * How to specify LENGTH SEMANTICS CHAR?
    * How to suppress the POSITION definition?
    * How to define a flat file with variable length and how to specify the number of bytes containing the length definition?
    Or is there another way that can be implemented using OWB?
    Any help is appreciated!
    Thanks,
    Carsten.

    Hi Carsten
    If you need to support the LENGTH SEMANTICS CHAR clause in an external table then one option is to use the unbound external table and capture the access parameters manually. To create an unbound external table you can skip the selection of a base file in the external table wizard. Then when the external table is edited you will get an Access Parameters tab where you can define the parameters. In 11gR2 the File to Oracle external table can also add this clause via an option.
    Cheers
    David

  • Want attach the XML data file with layout template in Oracle 10g

    Hi All,
    I need a help from you genius guys.
    I am genrating reports in BI with xml the procedure which I am following is as below.
    1. generating XML from the RDF
    2. creating a template in .rtf format
    3.after that loading the xml to the template then getting the required report.
    This all is doing through the given buttons
    But now my requirement is to create the gui from user can select the report and get the desire output file so how we would be able to attach the XML data file with layout template in Oracle 10g.
    If you require more detail please let me knnow.
    Thanks,
    Harry

    I am not using Oracle apps.
    I am using oracle 10g reports and I get something in it like one patch I downloded and one java code is having which creates the batch file ...still I am working on it ..
    If you will get some please share so that it will be helpful.
    Thanks,
    Harry

  • Can someone help with a previous post labeled "Writing to a data file with time stamp - Help! "

    Can someone possibly help with a previous post labeled "Writing to a data file with time stamp - Help! "
    Thanks

    whats the problem?
    Aquaphire
    ---USING LABVIEW 6.1---

  • I had no idea Aurora used the same actual App Data file as it's own source, I thought it was just emulating Firefox. I unistalled it and lost everything...

    I had installed Aurora 21.0a2 some time last year and had only used it once. I recently uninstalled it and without knowledge that it used the same exact App Data files as Firefox does, so I removed all data. Now I have lost 100's of bookmarks... I do backup my system often but not my browser data, I had only once made a copy of my Firefox data in August 2013, so I was able to copy and paste that info, which had maybe 35-40% of my bookmarks...
    I had tried Windows Recovery a couple times, it says it wasn't able to restore the data successfully each time. I had also tried Recuva, not really sure if it found the file I was searching for, so I would kindly ask any of the Forum Mods or users who would suggest this method, what "file" exactly should I search for.
    I had been searching for ".default" and ".defaults" files, and any other data relating to Firefox but with no success.
    Do I really have any options of recovery or ....?

    You should never choose to remove "personal data" when you uninstall your current Firefox version, because this will remove all profile folders and you lose personal data like bookmarks and passwords including data in profiles created by other Firefox versions.
    You will have to try to recover a recent JSON backup (bookmarks-####-##-##_xxxx.json) in the bookmarkbackups folder of that removed Firefox profile folder with Recuva or another undelete utility.
    *http://kb.mozillazine.org/Profile_folder_-_Firefox
    *https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    *http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • UNICODE data files with SQLLDR

    how can i load UNICODE data files with SQLLDR.
    my Oracle instance is on UNIX with NLS_CHARACTERSET WE8ISO8859P1.
    I have .dat files extracted from SQL Server using bcp utility with -w option.
    When i use -c option i'm not getting the european characters correctly like the a and e with 2 dots on top....
    when i load UNICODE (-w) file with CHARACTERSET UTF8 in my control file, it doesnt go thru. Any solution for this ? Thanks !

    I just created a unicode textfile on windows with some westeuropean characters and imported it into we8iso8859p1 database on linux using controlfile parameter CHARACTERSET UTF16.
    They got all properly converted.
    As Justin mentioned, unicode on windows means generally UTF16 Little Endian.
    Best regards
    Maxim

  • Using Migration Assistant to Move Data Files from one Account to New User

    Is it possible or recommended to use Migration Assistant to move data files from an old user account to a new user account on the same volume/hard disk?

    Migration Assitant cannot be used as a simple file transfer utility. MA can transfer an entire Home folder or entire Users folder but not individual files.
    In general files in one user account cannot be moved to another user account as this would violate built-in security measures.
    What you can do is to copy the files to an external device like a hard drive or flash drive. First log in to the old account. Then configure the drive to ignore preferences by Pressing COMMAND-I to open the Get Info window and check the Ignore permissions on this volume checkbox at the bottom of the window. Copy your files to the device. Log into the new account. Verify the external drive is still configured to ignore permissions (reset it, if not.) Copy the files from the external device into the Home folder of the new account. I would create a temporary folder for these files. If you still end up without the proper permissions you will need to make modifications that are easier done if all the files are in a single folder.

  • SQL Loader - CSV Data file with carraige returns and line fields

    Hi,
    I have a CSV data file with occasional carraige returns and line feeds in between, which throws my SQL loader script off. Sql loader, takes the characters following the carraige return as a new record and gives me error. Is there a way I could handle carraige returns and linefeeds in SQL Loader.
    Please help. Thank you for your time.
    This is my Sql Loader script.
    load data
    infile 'D:\Documents and Settings\user1\My Documents\infile.csv' "str '\r\n'"
    append
    into table MYSCHEMA.TABLE1
    fields terminated by ','
    OPTIONALLY ENCLOSED BY '"'
    trailing nullcols
    ( NAME CHAR(4000),
    field2 FILLER,
    field3 FILLER,
    TEST DEPT CHAR(4000)
    )

    You can "regexp_replace" the columns for special characters

  • Create XML format file in bulk insert with a data file with out delimiter

    Hello
    I have a date file with no delimiter like bellow
    0080970393102312072981103378000004329392643958
    0080970393102312072981103378000004329392643958
    I just know 5 first number in a line is for example "ID of bank"
    or 6th and 7th number in a line is for example "ID of employee"
    Could you help me how can I create a XML format file?
    thanks alot

    This is a fixed file format. We need to know the length of each field before creating the format file. Say you have said the first 5 characters are Bank ID and 6th to 7th as Employee ID ... then the XML should look like,
    <?xml version="1.0"?>
    <BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <RECORD>
      <FIELD ID="1"xsi:type="CharFixed"LENGTH="5"/>
      <FIELD ID="2"xsi:type="CharFixed"LENGTH="2"/>
      <FIELD ID="3" xsi:type="CharFixed" LENGTH="8"/>
      <FIELD ID="4" xsi:type="CharFixed" LENGTH="14"/>
      <FIELD ID="5" xsi:type="CharFixed" LENGTH="14"/>
      <FIELD ID="6" xsi:type="CharFixed" LENGTH="1"/>
    </RECORD>
    <ROW>
      <COLUMNSOURCE="1"NAME="c1"xsi:type="SQLNCHAR"/>
      <COLUMNSOURCE="2"NAME="c2"xsi:type="SQLNCHAR"/>
      <COLUMN SOURCE="3" NAME="c3" xsi:type="SQLCHAR"/>
      <COLUMN SOURCE="4" NAME="c4" xsi:type="SQLINT"
    />
      <COLUMN SOURCE="5" NAME="c5" xsi:type="SQLINT"
    />
    </ROW>
    </BCPFORMAT>
    Note: Similarly you need to specify the other length as well.
    http://stackoverflow.com/questions/10708985/bulk-insert-from-fixed-format-text-file-ignores-rowterminator
    Regards, RSingh

  • How to read a passward protected excel file with the help of database connectivity tool kit

    hi, i was reading an excel file with the help of database connectivity tool kit in labview 8.0
    i made tabels in the excel file nand made odbc connection and specified the workbbok name.
    now my problem is how to read the same file if i specife a pasword to that excel file ?

    Hi,
    Check out this thread about opening a password-protected Excel file using ActiveX. This should take care of it for you!
    Amanda Howard
    Americas Services and Support Recruiting Manager
    National Instruments

  • How do I use old data files with a new installation in Oracle 9i

    I am in an unenviable position, with an unsupported database.
    We are running Oracle 9i on Windows XP. We are upgrading soon to Oracle 11g on a newer platform, but need to get our development environment working first.
    We lost a system that was running our development database without having a database export. The C drive was placed into a new system as the D drive.
    I have loaded Oracle 9i on the C drive, but I have been unable to determine how to point it to the existing data files on the D drive. My search skills may be the limiting factor here...
    We cannot simply load the drive as C, since the hardware is different.
    What are the steps to point the new database software at the data files on the D drive? Or, how do I copy the old data files into the new Oracle Home and have them recognized properly?
    Thanks for any advice.

    user3930585 wrote:
    I am in an unenviable position, with an unsupported database.
    We are running Oracle 9i on Windows XP. We are upgrading soon to Oracle 11g on a newer platform, but need to get our development environment working first.
    We lost a system that was running our development database without having a database export. The C drive was placed into a new system as the D drive.
    I have loaded Oracle 9i on the C drive, but I have been unable to determine how to point it to the existing data files on the D drive. My search skills may be the limiting factor here...
    We cannot simply load the drive as C, since the hardware is different.
    What are the steps to point the new database software at the data files on the D drive? Or, how do I copy the old data files into the new Oracle Home and have them recognized properly?
    Are you stating that you don't know how to use COPY command?
    Can you recreate same directory structure on new C drive as exist on old C drive?
    Can you then drag & drop copies of the files?

  • Adding data file with out using  brtools /sapdba

    Hi all,
    How to add data file to table spaces with out using  brtools /sapdba.Please let meknow.
    Satya.

    why would you do that? whats your requirement?
    You can use sql commands (I prefer doing it via brtools),
    example
    alter tablespace <name of the tablespace> add datafile '<path of the datafile>' size <size in Mb>M autoextend <on/off> next <size> maxsize <size>;
    regards
    Juan

  • How can i write a XML file with oracle data ?

    How can i write a XML file using PL/SQL.
    Can i do as follows.
    1.Open a file using UTL_FILE.FOPEN(LC_DIR_LOC,'abc.xml','W')     ;
    2.write all the required tag and value using UTL.put_line
    that is enough. Is not, please guide me to write.
    gk

    Having Oracle 9i.
    One more doubt. In the speck, some constand values are there, When i write the same into file, How can i write ?.
    1. l_str := ' "E27" '
    or
    2. l_str := ' E27 '
    UTL_FILE.PUT_LINE(L_FILE_POI,l_str,TRUE);          
    1 case : in XML file : "E27"
    In 2 case : E27
    When we write a XML file through editors , we have to define the constant within quote . is it?      
    Which one can i use ? Or any other way is there ..
    Thanks and Regards
    gopi

  • Problem in using JDBC Execute commands(Update & Delete Only) with af:Table

    HI Everyone,
    I have one issue with Updating and Deleting Row Data using JDBC Execute commands.
    Suppose In My Application i have two pages, in Page 1 I have Two Command Buttons(Delete and Save) and One Input TextBox to write the String to be stored in the Database. and Page 2 where the result Table is shown and table is binded with a ViewObject, Now When User Types some String in InTB and click Save then By Programmatically I'm searching, that string is already present in database or not, if it is already exist then Save button converts in Update button and instead of inserting it allows user to Update the String already exist in database.
    Everything is working fine but the problem comes when i put those all buttons on the same page where result table is present.After putting all things on the same page and When i click save button to insert new String it is Successfully inserting but when any of other action is performed like updating or Deleting the existing one.. then my application just hanged and then nothing I able to do.
    Please Help me to understand this problem and give me the solution for this..
    Thanks
    Fizzz...

    Hi frank,
    Thanks to reply me...
    I'm refreshing table's iterator on each command button's action to reflect the changed result... and i'm sorry i mentioned two pages in my project.. actually these are two forms in the same page..which conditionally changed its renderer properties.. its working fine when only one form is renderred and the otherside when both are rendered then it is not working.
    Hope this change will help you to understand the problem.. if something else you are looking for then please tell me..
    Thanks
    Fizzz...

Maybe you are looking for

  • Unable to add a special character in the rskc

    Hi I want to add the degree symbol like how it will come when we will write : 36degree [that small circle]. Please suggest how to add i am trying by coping that from a word file but failed. Regards Vismark

  • Fonts are not reflecting while running Java Applet Through Forms

    Hello Oralce Gurus!! I have a Java Applet which has few lines of text in different fonts such as AgencyFB, Verdana Ref etc., When I am running this applet from console, I am able to see the text in different fonts. Where as If I run the applet throug

  • Airport Express and Airtunes no longer work error -15006

    This is killing me, I feel at my wits end. I have an airport express that has been in use for two years. I use it only for airtunes from itunes through my wireless network. I have an apple TV that I added 2 months ago and use occasionally for airtune

  • Check the date format

    Hi,   Can anybody tell me how to check the date format in BDC while updating.   The system date format is like mm/dd/yyyy. Check the dates format, in case of error return the following message “The date format should be YYYYMMDD”. Thanks......

  • URGENT Help: Converting JAVA ALE API (9.3)  to MDX API (11.1.1)

    Hi All, currnetly I am in the process of converting ALE to MDX API as ALE is no more used com.hyperion.ap.IAPMdMember in ALE Api gives the member details like Alias, level, Gen etc Equivalent to IAPMdMember , In MDX there are two 1.com.essbase.api.me