• Subject: Re: Database I/O
  • From: cujo@xxxxxxxxxx
  • Date: Tue, 16 Nov 1999 06:45:16 -0600

I think you need to explain what you are trying to do a little better
before someone is going to be able to help out.

1) When I create a field that is "For bit data", it gets  a CCSID of 65535.
I thought that was always the definition for bit data - CCSID 65535 means
do not translate the data (treat it like binary data).

2) In the most recent note below you said that you are specifying the
database as NOT NULL, but in your first note, the problem was that you were
trying to put a null into the table and your application is expecting a
null value.  If the table is created NOT NULL, you will never get a null
value.

3) I would think, in most situations, using a byte array for a binary field
would be a better approach both from a performance perspective and from an
ease of implemention standpoint.  That, of course, is just an opinion. :)



Regards,

Richard D. Dettinger
AS/400 Java Data Access Team

Think your job is safe?  Your future?  Your company's existence?  Think
again.
Right now there are people planning to do you in.  To replace you, steal
your
paycheck, obliterate your business, throw you out in the street.
...This is your wake-up call.  Digital Darwinism is unstoppable.
-Paul Somerson



enord@ORIENTAL.COM on 11/15/99 12:16:48 PM

Please respond to JAVA400-L@midrange.com

To:   JAVA400-L@midrange.com
cc:
Subject:  Re: Database I/O






Exactly.  I have a database file that is specified *NOT NULL I do not use a
default value.  When I try to use a JDBC sql statement it makes me pass a
value.
The other problem is the fields are binary.  The actual definition is LONG
VARCHAR FOR BIT DATA.  The AS/400 creates this into a HEX 8128 field.  Java
tells me the best way to pass this is by using a InputStream object.  The
problem is I cannot figure out how to create a InputStream value which is
null.
I was think that maybe I could populate this field using a direct database
connection and set those fields to null.  If you have a better idea, please
help.  I am ready for any suggestion.  If you have code examples would
greatly
help.
Thank You
Erik Nord
Oriental Trading Company
Omaha, NE
enord@oriental.com








cujo@us.ibm.com on 11/12/99 03:22:32 PM

Please respond to JAVA400-L@midrange.com








 To:      JAVA400-L@midrange.com

 cc:      (bcc: Erik Nord/OTC)



 Subject: Re: Database I/O









Is the problem here that you have created your tables to have columns that
are specified "NOT NULL WITH DEFAULT"?  If you use interactive SQL to
create tables, for example, the tables are created with this default.  This
will make it impossible to ever get a null value into the database table.
When you pass in null, the default value goes into the column instead of
the null.

If checking into this doesn't help, I can post JDBC examples setting
database columns to null and getting the null value back out if that would
help.


Regards,

Richard D. Dettinger
AS/400 Java Data Access Team

Think your job is safe?  Your future?  Your company's existence?  Think
again.
Right now there are people planning to do you in.  To replace you, steal
your
paycheck, obliterate your business, throw you out in the street.
..This is your wake-up call.  Digital Darwinism is unstoppable.
-Paul Somerson



enord@ORIENTAL.COM on 11/12/99 10:20:06 AM

Please respond to JAVA400-L@midrange.com

To:   JAVA400-L@midrange.com
cc:
Subject:  Database I/O






Can anyone give me examples of doing direct database IO's on the AS/400 via
Java?  My problem is populating a file that has a null capable field.
Everytime
I try to put a null into this field via a JDBC connection using SQL the
AS/400
places a '0' into it.  When I then run the application it errors out
because it
is expecting a null value.  I was really hoping by doing direct database
connection would solve this problem.  Any help would be greatly
appreciated.
Thank You
Erik Nord
Oriental Trading Company
Omaha, NE
enord@oriental.com





+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---






+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.