Nulls in Dates

We are working with the beta release 3.0c of Forte and 2.0c of express. We
have several DateTime domain fields for which we need to have nulls carried
through and updated on the data base. Ideally when the user selects the
insert button and the new record is initialized we would like to place
nulls in those fields before the display and then have those nulls
maintained through the data base update. If the user keys a valid date in
one or more of those fields then the non-null date values would be carried.
Conversely, if a date is present we would like to be able to have the user
delete the date field resulting in nulls being carried forward.
We have made several attempts to null these date fields
(PlaceValueInDisplayField, SetValuesInNewRecord, overriding the
InsertRecordIntoResultSet method, overriding the newobject method) with no
success.
Has anyone been successful in nulling date fields? Thanks.

Donald R. Smith wrote:
>
We are working with the beta release 3.0c of Forte and 2.0c of
express. We
have several DateTime domain fields for which we need to have nulls
carried
through and updated on the data base. Ideally when the user selects
the
insert button and the new record is initialized we would like to place
nulls in those fields before the display and then have those nulls
maintained through the data base update. If the user keys a valid
date in
one or more of those fields then the non-null date values would be
carried.
Conversely, if a date is present we would like to be able to have the
user
delete the date field resulting in nulls being carried forward.
We have made several attempts to null these date fields
(PlaceValueInDisplayField, SetValuesInNewRecord, overriding the
InsertRecordIntoResultSet method, overriding the newobject method)
with no
success.
Has anyone been successful in nulling date fields? Thanks.gbkhor wrote:
1. Create a new domain class say, NewDateTimeNullable which superclass
is DateTimeNullable.
2. At the NewDateTimeNullable Init() method, do Self.IsNull = TRUE this
will set the initial value to null.
Ideally when the user selects the insert button and the new record is initialized we would like to
place nulls in those fields before the display and then have those nulls maintained through the data
base update.3. At the Application modal(Express), for all the datetime class which
would like to behave like you mention above, change the data type to
NewDateTimeNullable.
If the user keys a valid date in one or more of those fields then the non-null date values would be carried.
Conversely, if a date is present we would like to be able to have the user delete the date field resulting
in nulls being carried forward.4. Upon insertion or save do check
- If Variable.IsNull then
else If Variable.IsEqual('') then
Variable.IsNull = TRUE;
end if;
end if;
Hope this will help.
My URL http://www.geocities.com/Hollywood/Lot/3985/
BASS Consulting Sdn. Bhd.
8th Floor, Menara SMI,
6 Lorong P. Ramlee,
50250 Kuala Lumpur,
West Malaysia.
Tel. (603) 2305588 ext. 995
Fax. (603) 2019403

Similar Messages

  • UIX/BC4J: messageTextInput nulls out data.

    I switched a page from the use of messageInput to messageTextInput. This was so I would be able to control the attributes of the field better. However, now when I select Update instead of saving the new data it deletes it from the database. messageInput works messageTextInput nulls the data in the database.
    I tried setting the id value according to the note "UIX XML-BC4J: Bug on messageTextInput" but this did not solve my problem.
    Here is an example of one of the fields I changed:
    <!-- <bc4j:messageInput attrName="NOTES_GEN" /> -->
    <bc4j:messageTextInput id="genNotes"
    attrName="NOTES_GEN"
    prompt="Notes"
    columns="75"
    rows="4"
    maximumLength="1000"
    wrap="hard"/>
    Any ideas?

    We aren't properly defaulting the "name" attribute
    of <bc4j:messageTextInput> in the same way that we
    default it for <bc4j:messageInput>.
    So, set the "name" to match "attrName":
    <bc4j:messageTextInput id="genNotes"
    attrName="NOTES_GEN"
    name="NOTES_GEN"
    etc...
    />
    This has been fixed since 9.0.3 (the "name" problem,
    but unfortunately not the "id" problem).

  • Null text data??

    Whenever i load up my JSP file for the first time, i can't be able to display all my images. At my KJS prompt it says "Null text data??". I wonder if this has anything to do with the problem which i'm facing. In order to load the images, i need to use the back button on my browser and then forward again to the page. The images will only be displayed then. The images is placed under my webserver's docs directory, while the JSP is under the iAS directory tree.

    I dont know clearly what is happening, but I guess restarting the Web server and app server would definitely help solve this problem. If not, Please send me all the kjs logs.
    Thanks,
    Rakesh.

  • Include those records that have Null End Dates

    I have to pull a report that show those who are currently working so we are assuming those with no End Dates are still working. When I put '0' or '0/0/00' for the End Date I get an error stating I need to put in a date.
    How do I only include those records that have Null End Dates? Ultimately I need a count of those currently employed. So I'm assuming once my report only shows those records I can add a running total field.
    I have Crystal XI.
    Thanks

    Try entering some default value for null like enter a default date "1/1/1900" which means that the end date is null.
    Now in the record selection write the condition like this
    if {?EndDateParameter}=date(1900,1,1) then
    (isnull(datefield)=true or totext(datefield)="")
    else
    datefield={?EndDateParameter}
    Regards,
    Raghavendra

  • ORA-01841 Error when value for date col is NULL in .dat (using SQL Loader)

    Hello Gurus,
    I have some data in .dat file which needs to be loaded into oracle table. I am using SQL * Loader to do the job. Although "NULLIF col_name =BLANKS" works for character datatype, but when value for date col is NULL then I get ORA-01841 error. I have to make NULL for all rows withour value for date column
    Early reply will be highly appreciated
    Farooq

    Hi,
    May be this problem is not with the NULLIF. The value for the date column is not in proper date format.
    create table:
    create table kk (empno number, ename varchar2(20), deptno number, hiredate date)
    Control file:
    LOAD DATA
    INFILE 'd:\kk\empdata.dat'
    insert into TABLE kk ( empno position (1:2) integer external,
    ename position(4:5) char NULLIF ename=BLANKS,
    deptno position (7:8) integer external NULLIF deptno=BLANKS,
    hiredate position (10:20) date NULLIF hiredate=BLANKS)
    data file:
    10 KK 01-jan-2005
    20 10
    SELECT * FROM KK;
    EMPNO ENAME DEPTNO HIREDATE
    10 KK 01-JAN-05
    20 10
    Verify the data file.
    Hope it will help

  • Set measure to NULL for dates in the future

    Hi all
    I am trying to set the values of a measure to NULL in case the date is in the future.
    I have a time dimension and fact table. What I have so fat is the following:
    IIF([Date].[CalendarDetailed].CURRENTMEMBER.Name < format(now(), "yyyy-MM-dd"),
    SUM
    PERIODSTODATE
    [Date].[CalendarDetailed].[(All)],
    [Date].[CalendarDetailed].CURRENTMEMBER
    [TimeUtility_All].[TimeUtility].&[1],
    [Measures].[Quantity_Change]
    ), NULL)
    This actualy works quite well. The only problem I have is, that on every month level it show me NULL. I guess it is, because the value for a month is e.g. "January 2014", which doesn't work with the condition.
    How can I modify the script, that I also get a value on the month levels.
    Thanks
    Lukas

    I typically use the function ISEMPTY. I'm not a master at MDX so I can't tell you the exact syntax without actually playing around with your query. You could try something like this:
    IIF(ISEMPTY([Date].[CalendarDetailed].CURRENTMEMBER.Name, NULL,
    [Date].[CalendarDetailed].CURRENTMEMBER.Name < format(now(), "yyyy-MM-dd"),
    SUM
    PERIODSTODATE
    [Date].[CalendarDetailed].[(All)],
    [Date].[CalendarDetailed].CURRENTMEMBER
    [TimeUtility_All].[TimeUtility].&[1],
    [Measures].[Quantity_Change]
    Good Luck.

  • Null field, data passing

    Hello,
    I am new to java and servlets.
    I have 2 questions regarding servlets. I hope somene will answer them.
    1. When I am getting data html form to servlet how do I check for empty data filed.
    For example in my html form, I have field name called "supply name". How do I check this field is null.
    If (supplyname != null)
    this does not work.
    2. is it possible to pass array from one servelt to another servelet>
    Thanks

    In answer to (1), check for "".equals(supplyName.trim()).
    In answer to (2), yeah, it's possible. I'm guessing that you have one servlet included in the other? Just put the array on the request like so:
    request.setAttribute("myArray", myArray);
    Then in the recipient servlet, do:
    MyObject[] myArray = (MyObject[])request.getAttribute("myArray");

  • Assigning NULL to Date typed UDF

    Hi all,
    i have question about how to assign empty date or null to
    a userdefinedfield of usertable.
    oUserTable.UserFields.Fields.Item("U_Date").Value = Now.ToShortDateString()
    the code above is how i usually assign date, but anyone knows how to set oUserTable.UserFields.Fields.Item("U_Date").Value to a blank date or null value?
    regards,
    erwine

    Best way it not to set is at all... that gives null...
    If oyu for some reason are unable to to this, try using DateTime.MinValue

  • Dropdown return null after date error

    Hi,
    My problem :
    Scenario :
    1. I filled a date field .
    2. I choose an option from the dropdown field  , now i get an error (system error type date ) .
    3. I filled the date again now in the correct format.
    Even though i select  an option from the dropdown , the value is not updated .
    From debug i can see that the onSelect event is not activated.
    What can i do ?
    Thanks .

    Hi FF,
    If you're using DDBK the OnSelect event will not be called.
    However, if all you need is to get the key from the dropdown you don't need to use the OnSelect event, you should get the key from the "selecedKey" value.
    Omri

  • Not getting data for Null Records.

    Hi all,
    I am trying to fetch the records where  sczuo  values are NULL . 
    DATA : BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE makz.
    DATA : END OF itab.
    SELECT * FROM makz INTO TABLE itab WHERE sczuo IS NULL.
    IF sy-subrc EQ 0.
      LOOP AT itab.
        WRITE : /3 itab-matnr , 20 itab-sczuo.
      ENDLOOP.
    ENDIF.
    I did not getting data any data .But if i write select statement like this
    SELECT * FROM makz INTO TABLE itab WHERE sczuo = ' '.
    This select statement returns the correct data.
    why my first select statement is not working ? how can i use IS NULL?
    Thanks in Advance,
    Madhu

    Hi,
    When we insert a new field to an existing table, NULL values are automatically inserted into the new field by the system for all existing records. However NULL and SPACE are not the same. 
    The logical expression SQL condition is either "true, false, or unknown". The expression is UNKNOWN if one of the columns involved in the database contains a NULL value and such records could be retrieved by using u201CIS NULLu201D instead of SPACE. 
    Please note that the NULL value is inserted only for the existing records, by the time the new field is being inserted. For all new records, SPACE or the initial (default) value is inserted. 
    If the new field is inserted by checking the checkbox u201Cinitial valuesu201D, then the initial values (SPACE in case of characters) are automatically inserted and not the NULL values.
    ihope u get the solution...
    Thanks
    Ashu

  • Hibernet query returns null for XMLTYPE data when I use oracle type4 driver

    Hi,
    I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
    Thanks in advance.
    regards,
    Amaresh

    Hi,
    I am using Oracle type-4 driver, My hibernet query returns null for data type XMLTYPE. But when I use BEA type -4 driver its working fine. Please help me to retrive XMLTYPE data using oracle-4 driver through hibernet query.
    Thanks in advance.
    regards,
    Amaresh

  • Can not get data by key in BDB4.5

    my code is here :
    17 class SortExample
    18 {
    19 public:
    20 SortExample(FILE *fp);
    21 ~SortExample();
    22 void run();
    23
    24 private:
    25 Db *dbp;
    26 Dbc *dbcp;
    27 };
    29 SortExample::SortExample(FILE *fp)
    30 {
    31 char buf1[256];
    32 char buf2[256];
    33 memset(buf1,0,256);
    34 memset(buf2,0,256);
    35 (void)remove(filename);
    38 dbp = new Db(NULL,0);
    39 dbp->open(NULL,filename , NULL,DBTYPE, DB_CREATE, 0);
    40 while(fgets(buf1,256,fp))
    41 {
    42 memcpy(buf2,buf1,256);
    43 int len = strlen((char*)buf1);
    44 buf1[len-1] = '\0';
    45 buf2[len-1] = '\0';
    46 len = len + 1;
    47 Dbt* key = new Dbt(buf2, len);
    48 Dbt* data = new Dbt(buf1,len);
    49 dbp->put(NULL,key,data,DB_NOOVERWRITE);
    50 memset(buf1,0,256);
    51 memset(buf2,0,256);
    52 delete key;
    53 delete data;
    54 }//end while
    55 dbp->close(0);
    56 dbp = NULL;
    57 }
    62 }
    72 void SortExample::run()
    73 {
    74 dbp = new Db(NULL,0);
    75 dbp->open(NULL,filename , NULL,DBTYPE, DB_CREATE, 0);
    87 char p1[20];
    88 memset(p1,0,20);
    89 char* p2 = "lds";
    90 Dbt key1(p2,strlen(p2)+1);
    91 Dbt data1(p1,20);
    93 printf("\"%s\"\n",key1.get_data());
    97 int ret = dbp->get(NULL,&key1,&data1,0);
    98
    99 if(ret == DB_NOTFOUND)
    100 printf("can not find by key\n");
    101 else
    102 printf("\"%s\",\"%s\"\n",(char*)key1.get_data(),(char*)data1.get_data());
    103 }
    105 int main(int argc,char** argv)
    106 {
    107 FILE* fp = fopen("sortfile.txt","r");
    108 SortExample* sort = new SortExample(fp);
    109 fclose(fp);
    110 sort->run();
    111 }
    the out put is here:
    "adfdl","adfdl"
    "dsfd","dsfd"
    "ldff","ldff"
    "lds","lds"
    "sddf","sddf"
    "sdfj","sdfj"
    "sefd","sefd"
    "sfct","sfct"
    "lds"
    can not find by key
    the sortfile content is here:
    sdfj
    adfdl
    dsfd
    ldff
    lds
    sefd
    sfct
    sddf

    Hi,
    when we want to find data by key, the length of key
    should plus 1.
    Thanks,The problem is solved.Of course, the other option to resolve this was to increment by 1 the length of the searched key, so that it would comply with the size of the entries stored.
    Here I want to share some of my experience.
    when we use the lib with C++, some things should be
    pay attention.
    before we configure before make, the commend should
    like this.
    ../dist/configure --enablecxx
    by this commend we can get libdbcxx.a
    when link we should add -static to the flag, and add
    -lpthread to the lib.Thanks for sharing this. Indeed, to build the db c++ library "--enable-cxx" must be specified on the configuration line, and I would suggest also setting the CXX env variable to g++. For loading additional libraries, like "libpthread", than LDFLAGS and LIBS env variables must be set correctly to indicate the location(s) for the additional libraries and, respectively, the libraries that should be loaded.
    Regards,
    Andrei

  • Unable to view data in some HR tables

    Since I upgraded to SQL Developer 2.1.1.64 I have not been able to view data in the data tab for the following tables that I have run accross: per_all_people_f, per_all_assignments_f or per_all_positions_f.
    Other tables that I have been using seem to be working fine, but these I need to use all the time. I get the column numbers returned, but no data or column headings.
    Another co-worker that has upgraded is experiencing the same problem.

    I could not get the ddl to show up on the sql tab in version 2.1.1.64, but I did run it in version 1.5.4 and this is what was returned.
    -- Unable to Render DDL with DBMS_METADATA using internal generator.
    CREATE TABLE HR.PER_ALL_PEOPLE_F
    PERSON_ID NUMBER(10, 0) NOT NULL,
    EFFECTIVE_START_DATE DATE NOT NULL,
    EFFECTIVE_END_DATE DATE NOT NULL,
    BUSINESS_GROUP_ID NUMBER(15, 0) NOT NULL,
    PERSON_TYPE_ID NUMBER(15, 0) NOT NULL,
    LAST_NAME VARCHAR2(150 BYTE) NOT NULL,
    START_DATE DATE NOT NULL,
    APPLICANT_NUMBER VARCHAR2(30 BYTE),
    BACKGROUND_CHECK_STATUS VARCHAR2(30 BYTE),
    BACKGROUND_DATE_CHECK DATE,
    BLOOD_TYPE VARCHAR2(30 BYTE),
    COMMENT_ID NUMBER(15, 0),
    CORRESPONDENCE_LANGUAGE VARCHAR2(30 BYTE),
    CURRENT_APPLICANT_FLAG VARCHAR2(30 BYTE),
    CURRENT_EMP_OR_APL_FLAG VARCHAR2(30 BYTE),
    CURRENT_EMPLOYEE_FLAG VARCHAR2(30 BYTE),
    DATE_EMPLOYEE_DATA_VERIFIED DATE,
    DATE_OF_BIRTH DATE,
    EMAIL_ADDRESS VARCHAR2(240 BYTE),
    EMPLOYEE_NUMBER VARCHAR2(30 BYTE),
    EXPENSE_CHECK_SEND_TO_ADDRESS VARCHAR2(30 BYTE),
    FAST_PATH_EMPLOYEE VARCHAR2(30 BYTE),
    FIRST_NAME VARCHAR2(150 BYTE),
    FTE_CAPACITY NUMBER(5, 2),
    FULL_NAME VARCHAR2(240 BYTE),
    HOLD_APPLICANT_DATE_UNTIL DATE,
    HONORS VARCHAR2(45 BYTE),
    INTERNAL_LOCATION VARCHAR2(45 BYTE),
    KNOWN_AS VARCHAR2(80 BYTE),
    LAST_MEDICAL_TEST_BY VARCHAR2(60 BYTE),
    LAST_MEDICAL_TEST_DATE DATE,
    MAILSTOP VARCHAR2(45 BYTE),
    MARITAL_STATUS VARCHAR2(30 BYTE),
    MIDDLE_NAMES VARCHAR2(60 BYTE),
    NATIONALITY VARCHAR2(30 BYTE),
    NATIONAL_IDENTIFIER VARCHAR2(30 BYTE),
    OFFICE_NUMBER VARCHAR2(45 BYTE),
    ON_MILITARY_SERVICE VARCHAR2(30 BYTE),
    ORDER_NAME VARCHAR2(240 BYTE),
    PRE_NAME_ADJUNCT VARCHAR2(30 BYTE),
    PREVIOUS_LAST_NAME VARCHAR2(150 BYTE),
    PROJECTED_START_DATE DATE,
    REHIRE_AUTHORIZOR VARCHAR2(30 BYTE),
    REHIRE_REASON VARCHAR2(60 BYTE),
    REHIRE_RECOMMENDATION VARCHAR2(30 BYTE),
    RESUME_EXISTS VARCHAR2(30 BYTE),
    RESUME_LAST_UPDATED DATE,
    REGISTERED_DISABLED_FLAG VARCHAR2(30 BYTE),
    SECOND_PASSPORT_EXISTS VARCHAR2(30 BYTE),
    SEX VARCHAR2(30 BYTE),
    STUDENT_STATUS VARCHAR2(30 BYTE),
    SUFFIX VARCHAR2(30 BYTE),
    TITLE VARCHAR2(30 BYTE),
    VENDOR_ID NUMBER(15, 0),
    WORK_SCHEDULE VARCHAR2(30 BYTE),
    WORK_TELEPHONE VARCHAR2(60 BYTE),
    COORD_BEN_MED_PLN_NO VARCHAR2(30 BYTE),
    COORD_BEN_NO_CVG_FLAG VARCHAR2(30 BYTE),
    DPDNT_ADOPTION_DATE DATE,
    DPDNT_VLNTRY_SVCE_FLAG VARCHAR2(30 BYTE),
    RECEIPT_OF_DEATH_CERT_DATE DATE,
    USES_TOBACCO_FLAG VARCHAR2(30 BYTE),
    BENEFIT_GROUP_ID NUMBER(15, 0),
    REQUEST_ID NUMBER(15, 0),
    PROGRAM_APPLICATION_ID NUMBER(15, 0),
    PROGRAM_ID NUMBER(15, 0),
    PROGRAM_UPDATE_DATE DATE,
    ATTRIBUTE_CATEGORY VARCHAR2(30 BYTE),
    ATTRIBUTE1 VARCHAR2(150 BYTE),
    ATTRIBUTE2 VARCHAR2(150 BYTE),
    ATTRIBUTE3 VARCHAR2(150 BYTE),
    ATTRIBUTE4 VARCHAR2(150 BYTE),
    ATTRIBUTE5 VARCHAR2(150 BYTE),
    ATTRIBUTE6 VARCHAR2(150 BYTE),
    ATTRIBUTE7 VARCHAR2(150 BYTE),
    ATTRIBUTE8 VARCHAR2(150 BYTE),
    ATTRIBUTE9 VARCHAR2(150 BYTE),
    ATTRIBUTE10 VARCHAR2(150 BYTE),
    ATTRIBUTE11 VARCHAR2(150 BYTE),
    ATTRIBUTE12 VARCHAR2(150 BYTE),
    ATTRIBUTE13 VARCHAR2(150 BYTE),
    ATTRIBUTE14 VARCHAR2(150 BYTE),
    ATTRIBUTE15 VARCHAR2(150 BYTE),
    ATTRIBUTE16 VARCHAR2(150 BYTE),
    ATTRIBUTE17 VARCHAR2(150 BYTE),
    ATTRIBUTE18 VARCHAR2(150 BYTE),
    ATTRIBUTE19 VARCHAR2(150 BYTE),
    ATTRIBUTE20 VARCHAR2(150 BYTE),
    ATTRIBUTE21 VARCHAR2(150 BYTE),
    ATTRIBUTE22 VARCHAR2(150 BYTE),
    ATTRIBUTE23 VARCHAR2(150 BYTE),
    ATTRIBUTE24 VARCHAR2(150 BYTE),
    ATTRIBUTE25 VARCHAR2(150 BYTE),
    ATTRIBUTE26 VARCHAR2(150 BYTE),
    ATTRIBUTE27 VARCHAR2(150 BYTE),
    ATTRIBUTE28 VARCHAR2(150 BYTE),
    ATTRIBUTE29 VARCHAR2(150 BYTE),
    ATTRIBUTE30 VARCHAR2(150 BYTE),
    LAST_UPDATE_DATE DATE,
    LAST_UPDATED_BY NUMBER(15, 0),
    LAST_UPDATE_LOGIN NUMBER(15, 0),
    CREATED_BY NUMBER(15, 0),
    CREATION_DATE DATE,
    PER_INFORMATION_CATEGORY VARCHAR2(30 BYTE),
    PER_INFORMATION1 VARCHAR2(150 BYTE),
    PER_INFORMATION2 VARCHAR2(150 BYTE),
    PER_INFORMATION3 VARCHAR2(150 BYTE),
    PER_INFORMATION4 VARCHAR2(150 BYTE),
    PER_INFORMATION5 VARCHAR2(150 BYTE),
    PER_INFORMATION6 VARCHAR2(150 BYTE),
    PER_INFORMATION7 VARCHAR2(150 BYTE),
    PER_INFORMATION8 VARCHAR2(150 BYTE),
    PER_INFORMATION9 VARCHAR2(150 BYTE),
    PER_INFORMATION10 VARCHAR2(150 BYTE),
    PER_INFORMATION11 VARCHAR2(150 BYTE),
    PER_INFORMATION12 VARCHAR2(150 BYTE),
    PER_INFORMATION13 VARCHAR2(150 BYTE),
    PER_INFORMATION14 VARCHAR2(150 BYTE),
    PER_INFORMATION15 VARCHAR2(150 BYTE),
    PER_INFORMATION16 VARCHAR2(150 BYTE),
    PER_INFORMATION17 VARCHAR2(150 BYTE),
    PER_INFORMATION18 VARCHAR2(150 BYTE),
    PER_INFORMATION19 VARCHAR2(150 BYTE),
    PER_INFORMATION20 VARCHAR2(150 BYTE),
    PER_INFORMATION21 VARCHAR2(150 BYTE),
    PER_INFORMATION22 VARCHAR2(150 BYTE),
    PER_INFORMATION23 VARCHAR2(150 BYTE),
    PER_INFORMATION24 VARCHAR2(150 BYTE),
    PER_INFORMATION25 VARCHAR2(150 BYTE),
    PER_INFORMATION26 VARCHAR2(150 BYTE),
    PER_INFORMATION27 VARCHAR2(150 BYTE),
    PER_INFORMATION28 VARCHAR2(150 BYTE),
    PER_INFORMATION29 VARCHAR2(150 BYTE),
    PER_INFORMATION30 VARCHAR2(150 BYTE),
    OBJECT_VERSION_NUMBER NUMBER(9, 0),
    DATE_OF_DEATH DATE,
    ORIGINAL_DATE_OF_HIRE DATE,
    TOWN_OF_BIRTH VARCHAR2(90 BYTE),
    REGION_OF_BIRTH VARCHAR2(90 BYTE),
    COUNTRY_OF_BIRTH VARCHAR2(90 BYTE),
    GLOBAL_PERSON_ID VARCHAR2(30 BYTE),
    COORD_BEN_MED_PL_NAME VARCHAR2(80 BYTE),
    COORD_BEN_MED_INSR_CRR_NAME VARCHAR2(80 BYTE),
    COORD_BEN_MED_INSR_CRR_IDENT VARCHAR2(80 BYTE),
    COORD_BEN_MED_EXT_ER VARCHAR2(80 BYTE),
    COORD_BEN_MED_CVG_STRT_DT DATE,
    COORD_BEN_MED_CVG_END_DT DATE,
    PARTY_ID NUMBER(15, 0),
    NPW_NUMBER VARCHAR2(30 BYTE),
    CURRENT_NPW_FLAG VARCHAR2(30 BYTE),
    GLOBAL_NAME VARCHAR2(240 BYTE),
    LOCAL_NAME VARCHAR2(240 BYTE)
    , CONSTRAINT PER_PEOPLE_F_PK PRIMARY KEY
    PERSON_ID,
    EFFECTIVE_START_DATE,
    EFFECTIVE_END_DATE
    ENABLE
    TABLESPACE "HR_DATA_SPACE_01"
    LOGGING
    PCTFREE 10
    PCTUSED 40
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 48K
    NEXT 8000K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PEOPLE_F_FK1 FOREIGN KEY
    BUSINESS_GROUP_ID
    REFERENCES HR.HR_ALL_ORGANIZATION_UNITS
    ORGANIZATION_ID
    ) ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PEOPLE_F_FK2 FOREIGN KEY
    PERSON_TYPE_ID
    REFERENCES HR.PER_PERSON_TYPES
    PERSON_TYPE_ID
    ) ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT HR_PER_DATE_OF_DEATH CHECK
    (DATE_OF_DEATH >= DATE_OF_BIRTH)
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_ON_MILITARY_SRV_CHK CHECK
    (ON_MILITARY_SERVICE IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_DPDNT_VLNTRY_SVCE_FLAG_CHK CHECK
    (DPDNT_VLNTRY_SVCE_FLAG in ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_SECOND_PASSPORT_CHK CHECK
    (SECOND_PASSPORT_EXISTS IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_FAST_PATH_EMPLOYEE_CHK CHECK
    (FAST_PATH_EMPLOYEE IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_COORD_BEN_NO_CVG_FLAG CHECK
    (COORD_BEN_NO_CVG_FLAG in ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_RESUME_EXISTS_CHK CHECK
    (RESUME_EXISTS IN ('Y','N'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_SEX_CHK CHECK
    (SEX IN ('M', 'F'))
    ENABLE
    ALTER TABLE HR.PER_ALL_PEOPLE_F
    ADD CONSTRAINT PER_PER_EXPENSE_CHECK_SEND_CHK CHECK
    (EXPENSE_CHECK_SEND_TO_ADDRESS IN ('H', 'O', 'P'))
    ENABLE
    CREATE INDEX HR.CSUH_PPF_ATTR12_IDX ON HR.PER_ALL_PEOPLE_F (ATTRIBUTE12 ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 2
    MAXTRANS 255
    STORAGE
    INITIAL 1M
    NEXT 104K
    MINEXTENTS 1
    MAXEXTENTS 8192
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.CSUH_PPF_ATTR1_IDX ON HR.PER_ALL_PEOPLE_F (ATTRIBUTE1 ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 560K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 8192
    PCTINCREASE 0
    FREELISTS 1
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N1 ON HR.PER_ALL_PEOPLE_F (UPPER(FULL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N2 ON HR.PER_ALL_PEOPLE_F (UPPER(LAST_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N50 ON HR.PER_ALL_PEOPLE_F (LAST_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 496K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N51 ON HR.PER_ALL_PEOPLE_F (EMPLOYEE_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 328K
    NEXT 80K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N52 ON HR.PER_ALL_PEOPLE_F (APPLICANT_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 8K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N53 ON HR.PER_ALL_PEOPLE_F (NATIONAL_IDENTIFIER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 496K
    NEXT 160K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N54 ON HR.PER_ALL_PEOPLE_F (FULL_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 0
    INITRANS 16
    MAXTRANS 255
    STORAGE
    INITIAL 760K
    NEXT 240K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 1
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N55 ON HR.PER_ALL_PEOPLE_F (PARTY_ID ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N56 ON HR.PER_ALL_PEOPLE_F (NPW_NUMBER ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N57 ON HR.PER_ALL_PEOPLE_F (UPPER(GLOBAL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N58 ON HR.PER_ALL_PEOPLE_F (UPPER(LOCAL_NAME) ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 256K
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N59 ON HR.PER_ALL_PEOPLE_F (EMAIL_ADDRESS ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    CREATE INDEX HR.PER_PEOPLE_F_N60 ON HR.PER_ALL_PEOPLE_F (GLOBAL_NAME ASC) TABLESPACE "HR_INDEX_SPACE_01"
    LOGGING
    PCTFREE 10
    INITRANS 11
    MAXTRANS 255
    STORAGE
    INITIAL 16K
    NEXT 4M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    FREELISTS 4
    FREELIST GROUPS 4
    BUFFER_POOL DEFAULT
    ;

  • Data Federator XI 3.0 using DB2 VARCHAR FOR BIT DATA Column?

    We have a column in a DB2 database that is defined as VARCHAR(16) FOR 
    BIT DATA.
    We are using the suggested IBM JDBC driver, db2jcc.jar, against a DB2 
    OS/390 8.1.5 version database.
    The Datasource column displays a data type of NULL, indicating the DF 
    does not understand or cannot handle this IBM data type.
    We have two issues.
    First, target tables are not able to return any columns, regardless if 
    we exclude columns defined as NULL as mentioned above. We see the 
    'Wait' animation for a very long time when we use the 'Target table 
    test tool' option. Selecting to display the count only, returns zero.
    We are able to fetch and view non-NULL column data when using the 
    'Query tool' under the Datasource pane.
    I also get the same result when using the 'My Query Tool' in Server 
    Administrator; a selection agains the sources returns data while 
    selecting from a target table returns no data. Also, a 'select 
    count(*)' returns zero.
    The second issue is in mapping a relationship between two DB2 tables 
    where the join is between two columns of the above mentioned type 
    (NULL).
    The error we get back when we use "Show Errors" is "The types 
    'NULL' (in 'S1.PLANNEDGOALID') and 'NULL' (in 'S2.PLANNDEDGOALID') are 
    not compatible.". When reviewing the relationship, a dashed red line 
    appears instead of a solid grey line between the two tables in the 
    "Table relationships and pre-filers" section of our mapping pane.
    The following query returns an error via the Server Administrator 
    Query Tool; "Types 'NULL' and 'NULL' are not compatible for operator 
    '=' (Error code : 10248)".
    select count(*)
    from
    (select s1.CASEID, s2.PLANNEDGOALID, s2.NAME, s2.PLANNEDGRPSTTYCD
      from "/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" AS s1
    ,"/DF_CMS_ODS/sources/CMFSREPT/CMSPROD.PLANNEDGOAL" s2
              where s1.PLANNEDGOALID = s2.PLANNEDGOALID)
    Here are the properties settings in the Resource Connector Settings 
    for jdbc.db2.zSeries we are using.
    capabilities: isjdbc=true;orderBy=false
    driverLocation: drivers/db2jcc_license_cisuz.jar;drivers/db2jcc.jar
    jdbcClass: com.ibm.db2.jcc.DB2Driver
    sourceType: db2
    supportsCatalog: no
    urlTemplate: jdbc:db2://<hostname>[:<port>]/<databasename>
    Here are the Connection parameters as defined for the datasource in DF 
    Designer.
    Defined resource: jdbc.db2.zSeries
    Jdbc connection URL: jdbc:db2://DB2D03:50000/CMFSREPT
    Authentication: Use a specific database logon for all Data Federator 
    users.
    User Name: x
    Password: hidden
    Login domain: -- Choose a defined login domain --
    Supports Schema: checked
    Schema: is empty
    Prefix table names with schema name: checked
    Supports catalog: unchecked
    Prefix table names with the database name: unchecked
    Table types: TABLE and VIEW
    So, the following is the two questions we require answers for...
    Is this a limitation of Data Federator?
    Is there a work around short of changing the datatype in the database.

    Hi Darren,
    The VARCHAR() FOR BIT DATA is a binary data type and Data Federator does not support binaries. But if in your case, it makes sense to map this column to a VARCHAR data type you can configure the DB2 connector to view this column as a VARCHAR.
    Your column can be mapped explicitly to a data type of your choice using a property: castColumnType.
    This property can be set updating the resource you selected when you registered you DB2 data source.
    If the resource is "jdbc.db2", then:
    1. Launch Data Federator Administrator
    2. Click on "Administration" tab
    3. Click on "Connector Settings"
    4. Select the right resource: "jdbc.db2"
    5. Click "Add a property"
    6. Select "castColumnType"
    7. Set its value to: VARCHAR() FOR BIT DATA=VARCHAR
    8. Click on Ok
    You should see this column as a VARCHAR.
    Regards,
    Mokrane
    PS: For the target table issue, we have forwarded your mail to the Data Federator Designer team.

  • 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();
    }

Maybe you are looking for

  • Need help on defining a default font in a JTextPane

    Hi, I'm currently programming a HTML Editor and I'm stuck with a problem I don't know how to solve: I have defined a default logical style for my JTextPane. I decided to set the font to "Arial". So here is how it goes: import javax.swing.text.StyleCo

  • Help please with Compressing

    Right now when I import my videos from my JVC HD7 onto my Mac they are about 14 MB for example but when I put them through StreamClip to covert them into QuickTime they spike to +100MB. Could someone please tell me a way to keep about the same file s

  • Control Key has stopped functioning

    Hi All, My MBP (early 2009) 17" has just come back from apple after having the motherboard, battery and magsafe port replaced. Unfortunately the ctr key has stopped working, this is osx (10.6.5) and Windoze 7. Does it need to go back to the shop or i

  • Ora 164

    Hi , I have following code to insert into remote table and used autonomous transaction like below. When it called from java (XA datasource) getting followoing error - ora 164 ORA-00164: distributed autonomous transaction disallowed within migratable

  • Creating a Unit of Measure that will transfer to SuS

    I am trying to create a unit of measure and have it cross over to SuS I have pricing per 100 pc's and since I am not able to create a pricing structure of more then 2 places, this limits me to creating a new Unit of Measure - but I need to have it br