Corrupt Numeric Data
Hi,
when I issue a very simple statement:
select *
from table_name
where numeric_value > 0
I get row which have a numeric_value equal to 0.
We tried to rebuild the indices and the to update the statistics, but does not help.
Looks like an internal corruption of the data, does anyone have a guess, what it could be?
Is there a way to see the physical representation of the data on disk? Maybe the corruption can be find out looking on that.
Thanks for you effort
Bernhard Slominski
Bernhard:
Your result intrigued me, so I did a little research. There is an article on Metalink (Note 1007641.6) that outlines Oracle's internal representation of numbers. The gist of it goes like this.
A number is (almost) always stored as a minimum of 2 bytes. The first byte gives the sign and an exponent, the remaining bytes give the value in a base 100 notation.
The high order bit in the first byte is the sign, it will be set for a positive number. The remaining 7 bits give the exponent in excess 64 notation. The second thru whatever bytes allow you to calculate the number. To avoid storing null bytes 1 is always added to each of the remaining bytes.
Negative numbers require a little more manipulation, but to calculate a positive number from the internal representation:
SQL> select dump(150) from dual;
DUMP(150)
Typ=2 Len=3: 194,2,51
1. Convert 1st byte to binary. If the bit 8 is 1 then it is positive
194 Binary is 11000010 so it is positive.
2. Convert the remaining 7 bits to decimal
1000010 Decimal is 66
3. Subtract 64 from this to get the exponent
66 - 64 = 2
4. For each remaining byte, subtract 1 from the number and
multiply by 100 to the power of (exponent - 1). If there are decimal points, just keep
going, using negative exponents for the decimals.
(2 - 1) * (100 ^ 1) = 1 * 100 = 100
(51 - 1) * (100 ^ 0) = 50 * 1 = 50
5. Add the results together to get the number
100 + 50 = 150The dump result you get (193,1) actually does seem to resolve to 0 using this formula.
193 binary is 11000001 so it is positive.
Drop the sign bit and 1000001 decimal is 65
65 - 64 = 1 and
(1 - 1) * (100 ^ 0) = 0
Putting my dump result (128) through the same steps gives a really interesting result.
128 binary is 10000000
So zero seems to be a special case. Even though you really do have a zero stored in your table (I would bet that if you did some arithmetic with that column you would prove it), Oracle is comparing internal representations for the query and obviously
1100000100000001 is greater than 10000000
HTH
John
Similar Messages
-
Numeric data is not displayed in BI Publisher 11g report
Hi,
I'm using Oracle BI 11g (11.1.1.6.0).
I'm experiencing a serious issue with numeric data in reports created with Publisher.
When I define the query in the data model, numeric data gets declared as "integer" (even if it should be "double"). Anyway, when creating the layout all data is correctly shown.
The issue emerges when I run the report in interactive mode: numeric data is not displayed at all.
If I run it in HTML mode or other, I get proper results.
I tried to explicitly CAST numeric data in the query to number(21, 6) but I get no different result.
Any help or suggestion is warmly welcome.
Thanks,
CristinaYes, assuming that you are using the Standalone version, following are some excerpt from user guide.
10g see Oracle® Business Intelligence Publisher
Report Designer's Guide
Release 10.1.3.4
Part No. E12187-01
Chapter 6 Building a Data Template
Supported Column Types
CLOB (conditionally supported)
The CLOB must contain text or XML. Data cannot be escaped inside the CLOB column.
And for 11g see
Oracle® Fusion Middleware
Data Modeling Guide for Oracle Business Intelligence Publisher
Release 11g (11.1.1)
Part No. E18862-01
Chapter 3 Creating Data Sets
Using Data Stored as a Character Large Object (CLOB) in a Data Model
BI Publisher supports using data stored as a character large object (CLOB) data type in
your data models. This feature enables you to use XML data generated by a separate
process and stored in your database as input to a BI Publisher data model.
Use the Query Builder to retrieve the column in your SQL query, then use the data
model editor to specify how you want the data structured. When the data model is
executed, the data engine can structure the data either as:
• a plain character set within an XML tag name that can be displayed in a report (for
example, an Item Description)
• structured XML
Cheers,
ND -
Using MODEL clause and COUNT for not numeric data columns....
Hi ,
Is it possible somehow to use the COUNT function to transform a non-numeric data column to a numeric data value (a counter) and be used in a MODEL clause....????
For example , i tried the following in the emp table of SCOTT dataschema with no desired result...
SQL> select deptno , empno , hiredate from emp;
DEPTNO EMPNO HIREDATE
20 7369 18/12/1980
30 7499 20/02/1981
30 7521 22/02/1981
20 7566 02/04/1981
30 7654 28/09/1981
30 7698 01/05/1981
10 7782 09/06/1981
20 7788 18/04/1987
10 7839 17/11/1981
30 7844 08/09/1981
20 7876 21/05/1987
30 7900 03/12/1981
20 7902 03/12/1981
10 7934 23/01/1982
14 rows selected Now , i want to use the MODEL clause in order to 'predict' the number of employees who were going to be hired in the 1990 per deptno...
So , i have constructed the following query which , as expected, does not return the desired results....
SQL> select deptno , month , year , count_
2 from
3 (
4 select deptno , to_number(to_char(hiredate,'mm')) month ,
5 to_number(to_char(hiredate , 'rrrr')) year , count(ename) count_
6 from emp
7 group by deptno , to_number(to_char(hiredate,'mm')) ,
8 to_number(to_char(hiredate , 'rrrr'))
9 )
10 model
11 partition by(deptno)
12 dimension by (month , year)
13 measures (count_ )
14 (
15 count_[1,1990]=count_[1,1982]+count_[11,1982]
16 )
17 /
DEPTNO MONTH YEAR COUNT_
30 5 1981 1
30 12 1981 1
30 2 1981 2
30 9 1981 2
30 1 1990
20 4 1987 1
20 5 1987 1
20 4 1981 1
20 12 1981 1
20 12 1980 1
20 1 1990
10 6 1981 1
10 11 1981 1
10 1 1982 1
10 1 1990 As you see , the measures for the 1990 year is null...because the measure(the count(deptno)) is computed via the group by and not by the MODEL clause...
How should i transform the above query... so as the "count_[1,1982]+count_[11,1982]" will return non-null results per deptno...????
Thanks , a lot
SimonConnected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL>
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')));
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
SQL> --
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 WHERE e.department_id = 20
8 GROUP BY e.department_id
9 ,to_number(to_char(e.hire_date, 'mm'))
10 ,to_number(to_char(e.hire_date, 'rrrr')))
11 model
12 PARTITION BY(department_id)
13 dimension BY(MONTH, YEAR)
14 measures(count_)(
15 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
16 );
DEPARTMENT_ID MONTH YEAR COUNT_
20 8 1997 1
20 2 1996 1
20 1 1990 2
SQL> ---
SQL> SELECT department_id, MONTH, YEAR, count_
2 FROM (SELECT e.department_id
3 ,to_number(to_char(e.hire_date, 'mm')) MONTH
4 ,to_number(to_char(e.hire_date, 'rrrr')) YEAR
5 ,COUNT(e.first_name) count_
6 FROM employees e
7 GROUP BY e.department_id
8 ,to_number(to_char(e.hire_date, 'mm'))
9 ,to_number(to_char(e.hire_date, 'rrrr')))
10 model ignore nav
11 PARTITION BY(department_id)
12 dimension BY(MONTH, YEAR)
13 measures(count_)(
14 count_ [1, 1990] = count_ [2, 1996] + count_ [8, 1997]
15 );
DEPARTMENT_ID MONTH YEAR COUNT_
100 8 1994 2
30 12 1997 1
100 3 1998 1
30 7 1997 1
5 1999 1
30 12 1994 1
30 11 1998 1
30 5 1995 1
100 9 1997 2
100 12 1999 1
30 8 1999 1
1 1990 0
30 1 1990 0
100 1 1990 0
90 9 1989 1
20 8 1997 1
70 6 1994 1
93 rows selected
SQL> -
How to get numeric data from a string using t-sql
Hi All,
I have a table with 2 columns ID as Int and Message as nvarchar(max)
Create table Sample
ID int not null,
Message nvarchar(max) null,
CONSTRAINT [PK_ID_Msg] PRIMARY KEY CLUSTERED
ID asc
Insert statement:
INSERT INTO
Sample (ID, Message)
VALUES (1, 'X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
INSERT INTO Sample (ID, Message) VALUES (2, 'X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017
; Z: 1
; Z_DATE: 06/02/2012')
Data in the table looks like:
ID Message
1 X_YRS: 00 ; X_MONS: 18 ; X_DAYS: 000 ; Y_YRS: 00 ; Y_MONS: 16 ; Y_DAYS: 011 ; Z: 1 ; Z_DATE: 09/04/2014
2 X_YRS: 01 ; X_MONS: 15 ; X_DAYS: 010 ; Y_YRS: 00 ; Y_MONS: 18 ; Y_DAYS: 017 ; Z: 1 ; Z_DATE: 06/02/2012
Need out put as below, just with numeric data:
ID X-Column Y-Column
1 00 18 000 00 16 011
2 01 15 010 00 18 017
So, please I need t-SQL to get above output.
Thanks in advance.
RH
sql;With CTE
AS
SELECT s.ID,RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),''))) AS Val,RTRIM(LTRIM(LEFT(Val,CHARINDEX('_',Val+'_')-1))) AS Pattern,
--ROW_NUMBER() OVER (PARTITION BY LEFT(Val,CHARINDEX('_',Val+'_')-1) ORDER BY RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))*1)
f.ID AS Seq
FROM Sample s
CROSS APPLY dbo.ParseValues(s.[Message],';')f
WHERE ISNUMERIC(RTRIM(LTRIM(STUFF(Val,1,CHARINDEX(':',Val),'')))+'0.0E0')=1
SELECT ID,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'X' ORDER BY Seq FOR XML PATH('')),1,1,'') AS XCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Y' ORDER BY Seq FOR XML PATH('')),1,1,'') AS YCol,
STUFF((SELECT ' ' + Val FROM CTE WHERE ID = c.ID AND Pattern = 'Z' ORDER BY Seq FOR XML PATH('')),1,1,'') AS ZCol
FROM (SELECT DISTINCT ID FROM CTE)c
ParseValues can be found here
http://visakhm.blogspot.in/2010/02/parsing-delimited-string.html
Numeric check logic is as per below
http://visakhm.blogspot.in/2014/03/checking-for-integer-or-decimal-values.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
What are the numeric data types in Oracle? I created the following table:
CREATE TABLE CONTRACT (
CONTRACT_ID INTEGER NOT NULL,
QUOTE_ID LONG,
BOOK_RATE NUMBER,
IBTSS_CONTRACT_NUM VARCHAR2(20)
But in the Object Browser, the data type of CONTRACT_ID becomes NUMBER which can accept numbers such as 123.25. This is not my intention. I thought LONG is not an acceptable data type but it actually works and the data type of QUOTE_ID shown in the Object Browser is correctly LONG. However, both LONG and INTEGER behave like NUMBER because I can insert values such as 123.56 into columns CONTRACT_ID and QUOTE_ID.
So my questions are
1. What are the supported numeric data types in Oracle?
2. Are we supposed to use INTEGER or LONG at all since they do not behave as expected? Are we supposed to always use NUMBER(n) instead?
Thanks.
Edited by: user10896541 on Apr 23, 2009 2:43 PMLONG in Oracle is not an integer data type. LONG is a depricated data type that was designed to store text more than 4k in length. Oracle has been asking folks to stop using LONG and use CLOB (or BLOB for binary data) since 8.1.5.
INTEGER maps to NUMBER(38) which does not allow decimal values. You might be confused because Oracle truncates values if you insert them into a column that has less precision than the column allows
SQL> create table x (
2 col1 integer
3 );
Table created.
SQL> desc x;
Name Null? Type
COL1 NUMBER(38)
SQL> insert into x values( 1 );
1 row created.
SQL> insert into x values( 1.25 );
1 row created.
SQL> select * from x;
COL1
1
1
SQL>Justin -
Incorrect numeric date displayed in month view
today is Saterday July 1st however when I open iCal it shows the current date to be Friday June 30th... (the icon on the dock is correct showing the 1st) In day and week views iCal believes that the current date is Friday June 30th however stranger things happen when viewing by month. Here the current DAY is correct (showing Saturday in light blue) however all of the numeric DATES are shifted ahead by one. My calendar shows the first day of July being Sunday with the 4th of July being Wednesday. All the events in the calendar are on the correct DAY ie, the 4th is on Tuesday, etc. Also the top of the month window says "June 2006" even though I am looking at the events in July.
Very strange... any ideas on what is happening are appreciated. Oh and the date on the computer is correct... go figure.
Thanks
PowerBook G4 Ti Mac OS X (10.4.7)
PowerBook G4 Ti Mac OS X (10.4.7)The real answer is given: No, this is not configurable as it depends on how many weeks a month spans; rarely this is 4 weeks, most often this is 5 weeks, sometimes this is 6 weeks. It is called the "'Month" view, not the "4-weeks view" or anything like
that.
Your feature request is of course valid and to submit it as such, it is best to contact Microsoft Support by phone. You may need to provide credit card information to open a case but it of course won't be charged for a feature request. You'll get a reference
ID so you can track the status of your request.
You may want to refine your request with a business case as well and give a clear example of what you want it to look like and what exactly should be configurable.
For instance, the default Multi-Week View should show; last week, this week and the next 2 weeks.
Robert Sparnaaij
[MVP-Outlook]
Outlook guides and more: HowTo-Outlook.com
Outlook Quick Tips: MSOutlook.info -
Corrupt SRUDB.dat in WIndows 8.1 - Event ID 476
Hi all,
I have an issue slight issue with a Windows 8.1 machine (non domain joined). The user was complaining that the system/applications would become unresponsive. I ran a "Chkdsk /f /r" and it came back with a few bad clusters of which some where located
in the "\Windows\System32\sru\SRUDB.dat" file.
In the Application Event Log I see an event ID 476 raised which contain the following:
svchost (1300) SRUJet: The database page read from the file "C:\WINDOWS\system32\SRU\SRUDB.dat" at offset 2195456 (0x0000000000218000) (database page 535 (0x217)) for 4096 (0x00001000) bytes failed verification because it contains no page data.
The read operation will fail with error -1019 (0xfffffc05). If this condition persists then please restore the database from a previous backup. This problem is likely due to faulty hardware. Please contact your hardware vendor for further assistance
diagnosing the problem.
I'm running an "sfc /scannow", but it looks as though the actual SRUDB.dat database has become corrupt. What does this DAT file contain and is there a way to recreate?
SFC retunred:
Windows Resource Protection found corrupt files but was unable to fix some
of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For
example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not
supported in offline servicing scenarios.
I can post the CBS.log file if required, but toward the end there are some interesting entries:
2014-11-30 16:04:31, Info CSI 000008c5 [SR] Verify complete
2014-11-30 16:04:31, Info CSI 000008c6 [SR] Repairing 2 components
2014-11-30 16:04:31, Info CSI 000008c7 [SR] Beginning Verify and Repair transaction
2014-11-30 16:04:31, Info CSI 000008c8 [SR] Cannot repair member file [l:32{16}]"bootmgfw.efi.mui" of Microsoft-Windows-BootEnvironment-Core-BootManager-EFI.Resources,
Version = 6.3.9600.17031, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture = [l:10{5}]"en-GB", VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-11-30 16:04:32, Info CSI 000008c9 Hashes for file member \SystemRoot\WinSxS\amd64_prncacla.inf_31bf3856ad364e35_6.3.9600.17415_none_95dd5540d57f8c01\Amd64\CNBJ2530.DPB
do not match actual file [l:36{18}]"Amd64\CNBJ2530.DPB" :
Found: {l:32 b:Lj30AtCo6GC4fXRo0EX1GOwFbEaWFP3FS+YNHfv0SZ4=} Expected: {l:32 b:n520k714Uu3utHa5JGQ6HQYbZphKhlMWq5pEmfnCDuw=}
2014-11-30 16:04:32, Info CSI 000008ca [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version =
6.3.9600.17415, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-11-30 16:04:32, Info CSI 000008cb [SR] Unable to repair \SystemRoot\WinSxS\amd64_microsoft-windows-b..nager-efi.resources_31bf3856ad364e35_6.3.9600.17031_en-gb_68408c0dc1958b90\\[l:32{16}]"bootmgfw.efi.mui"
2014-11-30 16:04:32, Info CSI 000008cc [SR] Cannot repair member file [l:32{16}]"bootmgfw.efi.mui" of Microsoft-Windows-BootEnvironment-Core-BootManager-EFI.Resources,
Version = 6.3.9600.17031, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture = [l:10{5}]"en-GB", VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type neutral, TypeName neutral, PublicKey neutral in the store, file is missing
2014-11-30 16:04:32, Info CSI 000008cd [SR] This component was referenced by [l:168{84}]"Package_2145_for_KB2919355~31bf3856ad364e35~amd64~~6.3.1.14.2919355-4305_neutral_GDR"
2014-11-30 16:04:32, Info CSI 000008ce Hashes for file member \SystemRoot\WinSxS\amd64_prncacla.inf_31bf3856ad364e35_6.3.9600.17415_none_95dd5540d57f8c01\Amd64\CNBJ2530.DPB
do not match actual file [l:36{18}]"Amd64\CNBJ2530.DPB" :
Found: {l:32 b:Lj30AtCo6GC4fXRo0EX1GOwFbEaWFP3FS+YNHfv0SZ4=} Expected: {l:32 b:n520k714Uu3utHa5JGQ6HQYbZphKhlMWq5pEmfnCDuw=}
2014-11-30 16:04:32, Info CSI 000008cf [SR] Cannot repair member file [l:36{18}]"Amd64\CNBJ2530.DPB" of prncacla.inf, Version =
6.3.9600.17415, pA = PROCESSOR_ARCHITECTURE_AMD64 (9), Culture neutral, VersionScope = 1 nonSxS, PublicKeyToken = {l:8 b:31bf3856ad364e35}, Type = [l:24{12}]"driverUpdate", TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-11-30 16:04:32, Info CSI 000008d0 [SR] This component was referenced by [l:166{83}]"Package_2709_for_KB3000850~31bf3856ad364e35~amd64~~6.3.1.8.3000850-6825_neutral_GDR"
2014-11-30 16:04:32, Info CSI 000008d1 [SR] Repair complete
2014-11-30 16:04:32, Info CSI 000008d2 [SR] Committing transaction
2014-11-30 16:04:32, Info CSI 000008d3 Creating NT transaction (seq 2), objectname [6]"(null)"
2014-11-30 16:04:32, Info CSI 000008d4 Created NT transaction (seq 2) result 0x00000000, handle @0xf0c
2014-11-30 16:04:32, Info CSI 000008d5@2014/11/30:16:04:32.816 Beginning NT transaction commit...
2014-11-30 16:04:32, Info CSI 000008d6@2014/11/30:16:04:32.891 CSI perf trace:
CSIPERF:TXCOMMIT;82527
2014-11-30 16:04:32, Info CSI 000008d7 [SR] Verify and Repair Transaction completed. All files and registry keys listed in this transaction
have been successfully repaired
Following this I ran a "Dism /Online /Cleanup-Image /RestoreHealth", which seems to have repair a few packages as seen in the CBS log, therefore I can an "sfc /scannow" once more - this time SFC reported there were no integrity violations.
However, the Event ID 476 and corrupt SRUDB.dat still persists. Is there anything that anyone can suggest?
Cheers
Chris
ChrisHi Swinter,
“WD diagnostic showed there were unrecoverable errors” “the system seems to be stable”
Since there are unrecoverable errors and it has much possibility to relate to the drive. The error will occur again if the hardware issue is not be resolved. If the issue is under tolerant , I recommend you to back up your important data to a separate media.
This is vital to avoid of losing important data due to the unexpected drive corruption. Making a full system imagine is a better choice, though the error may be included.
If you decide to replace the hard drive ,this video may be helpful.
Video: Restoring your PC after a hard drive failure
http://windows.microsoft.com/en-HK/windows7/help/videos/restoring-your-pc-after-a-hard-drive-failure#tab=system
Best regards -
Can I insert into a form build in FORMSCENTRAL, a Formula with the numerical data that are updated by a given formula, like in Excel?
Hello danna,
please have a look there as a first step: http://helpx.adobe.com/acrobat-com/formscentral/topics.html >>> Formula syntax for built-in functions >>> http://helpx.adobe.com/acrobat-com/formscentral/help/formula-syntax-built-in-functions.htm l
Hans-Günter -
Is it possible to upload non-numeric data into Planning from ODI?
Dear All,
I have problem to upload non-numeric data into planning?
Regards,
ThomasI am not sure what that has to do with non-numeric data and planning.
If you want to move your ODI environment then have a look at this post :- Re: move full ODI environment to another Machine...
Cheers
John
http://john-goodwin.blogspot.com/ -
How do I import non-numeric data into DIAdem?
I have some non-numeric data in an Excel file which I would like to import into DIAdem. DIAdem recognizes the file and imports some of the data, but it only imports those cells that are purely numeric. Cells containing non-numeric characters are ignored. But I need that non-numeric data! How do I force DIAdem to import everything? (Some controls appear in the import dialog that seem like they might be useful here but they're greyed out.)
Hi There,
You can not load text columns from ASCII files into DIAdem 8.1 DATA channels (numbers only). But the ASCII Import Wizard will let you send those text values to either a separate ASCII file, which DIAdem can use to put them on a graph as labels, or to a DIAdem string array, which DIAdem can use to display them at various places in its environment.
The below attachments demonstrate reading an ASCII text column into a DIAdem string array and displaying the values on a DIAdem table in GRAPH. Note that the index values of the string array are placed in a DIAdem DATA channel.
Ask if you have further questions,
Brad Turpin
NI
Attachments:
ASCII_Text_Column.txt 1 KB
ASCII_Text_Column.STP 1 KB
ASCII_Text_Column.LPD 3 KB -
How to solve java.io.IOException: Corrupt form data: premature ending
hei evryone!
Does anyone knows how to solve this bug?
java.io.IOException: Corrupt form data: premature ending
Im using Oreilly's cos.jar MultipartRequest
here is my form :
<FORM METHOD="POST" NAME="uploadform" action="mbbfile" ENCTYPE="multipart/form-data">
<TR>
<TD>Select a File:</TD>
<TD><INPUT TYPE="FILE" NAME="srcfile" style="width:400px"/></TD>
</TR>
<TR><TD><INPUT TYPE="SUBMIT" VALUE="Send"/></TD></TR>
</FORM>
HERE IS mbbfile which is a servlet :
package mbb.servlet;
import java.io.IOException;
import java.sql.Connection;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.oreilly.servlet.MultipartRequest;
import org.jconfig.Configuration;
import org.jconfig.ConfigurationManager;
public class MBBFileServlet extends HttpServlet{
private static final Configuration conf = ConfigurationManager.getConfiguration("ConfigFile");
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
String filePath = conf.getProperty("FilePath", "", "test");
try{
MultipartRequest multi = new MultipartRequest(req,filePath,5*1024*1024);
}catch(Exception e){
System.out.println("MBBFileServlet Exception ---> "+e.getMessage());
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
doGet(req,res);
Sometimes it works meaning the file is uploaded in the directory without any exception, sometimes the file is uploaded but with exception on the log saying "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". and sometimes the files is not uploaded at all and when i check the error is : "MBBFileServlet Exception ---> Corrupt form data: Premature Ending". Can anyone please help me on this matter. Thx!
Your response would be deeply appreciated.
br,
TACHi all!
Since I've spent some days now trying to figure out what was wrong with my file upload in Struts 1.1, I would like to share my solution with the rest of you in order to spare you for the same amout of wasted time I've spent :-)
My platform is Resin 3.0.8 and Struts 1.1. My problem was that JPEG's got corrupted when arriviving at the server. After a few days searching on the net, I tried with a plain servlet and the O'Reilly package, and the app worked perfect.
Here is my servlet:
package no.yourcompany.yourapp.servlet;
import com.oreilly.servlet.multipart.MultipartParser;
import com.oreilly.servlet.multipart.Part;
import com.oreilly.servlet.multipart.FilePart;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.ServletException;
import javax.servlet.ServletContext;
import javax.servlet.RequestDispatcher;
import java.io.IOException;
import java.io.ByteArrayOutputStream;
public class ImageUpload extends HttpServlet {
private static final String PAGE_RECEIPT = "/popImageUploadReceipt.do";
private static final int MAX_FILE_SIZE_IN_BYTES = 10000000; // 10 M
* Extracts image from request and puts it into person form.
* @see HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// custom beans from my project, not defined here
PersonRegistrationForm personRegistrationForm = null;
PortraitImage portraitImage = null;
ByteArrayOutputStream outputStream = null;
Part currentPart = null;
FilePart currFilePart = null;
personRegistrationForm = (PersonRegistrationForm) request.getSession().getAttribute(DsnSessionKeyConstantsIF.KEY_PERSON_FORM);
portraitImage = personRegistrationForm.getPortraitImage();
try {
MultipartParser parser = new MultipartParser(request, MAX_FILE_SIZE_IN_BYTES);
while ((currentPart = parser.readNextPart()) != null) {
if (currentPart.isFile()) {
currFilePart = (FilePart) currentPart;
outputStream = new ByteArrayOutputStream();
currFilePart.writeTo(outputStream);
// portraitImage is just a bean for encapsulating image data, not defined in this posting
portraitImage.setContentType(currFilePart.getContentType());
portraitImage.setImageAsByteArray(outputStream.toByteArray());
portraitImage.setOriginalFileName(currFilePart.getFileName());
break;
} // if (currentPart.isFile())
} // while ((currentPart = parser.readNextPart()) != null)
} catch (IOException ioe) {
// noop
// redirect to receipt page
ServletContext servletContext = this.getServletContext();
RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(PAGE_RECEIPT);
requestDispatcher.forward(request, response);
} // doPost
} // ImageUpload
AND ADD THIS TO YOUR WEB.XML
<servlet>
<servlet-name>ImageUpload</servlet-name>
<servlet-class>no.yourcompany.yourapp.servlet.ImageUpload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImageUpload</servlet-name>
<url-pattern>imageUpload.do</url-pattern>
</servlet-mapping>
AND THE HTML-FORM IS HERE
<form action="/yourapp/imageUpload.do" method="post" enctype="multipart/form-data" accept="image/*">
<p>
<input type="file" name="portraitImage" />
</p>
<p>
<input type="image" src="/dsn/img/btn_last_bilde.gif" border="0">
</p>
</form> -
How to convert numeric data to binary decimal in java
How to convert numeric data to binary decimal in java Pleas egive me code example
There is no numeric data. It's all binary. If you're talking about Strings, look at the Integer class.
-
Testing for non-Numeric Data in a varchar2
Hello -
What is the easiest way to test see if there is non-numeric data in a varchar2 column? The column holds ssn values, but I am unable to convert these values to numeric data, because somewhere the column is storing non-numeric data.
Thanks in advance.Maybe something like this ?
SQL> create or replace function test_num (var1 in varchar2) return varchar2
2 is
3 num number;
4 begin
5 num := to_number (var1);
6 return ('Number');
7 exception
8 when others then
9 return ('Character');
10* end;
SQL> /
Function created.
SQL> select test_num ('111') from dual;
TEST_NUM('111')
Number
SQL> select test_num ('aaa') from dual;
TEST_NUM('AAA')
Character
SQL> -
MultipartRequest java.io.IOException: Corrupt form data: premature ending
i try to upload a file using MultipartRequest
i want to get the name of the file uploaded with html form
and display it on jsp page (just for now to see if it works)
in server.log i see Error creating file: java.io.IOException: Corrupt form data: premature ending
thank YouThen whatever is uploading the file, isn't doing it correctly.
-
Numeric, date field data to be in English format
My Characterset on 10g AS & 10gdb, NLS_LANG=ARABIC_KUWAIT.AR8MSWIN1256
In my all arabic screen numerical number & date fields are in arabic. Instead all numeric & date fields should be in English. I have tried settting NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256 on Application Server. But no use & also by doing this just runtime application is doing flip,,ie from left to right.
i know I can query using below
TO_CHAR(hiredate, 'DD/MON/YYYY', 'nls_date_language = ENGLISH')
Is there any way of doing that at database level, so that all fields of applicaton of type numeric & date are in english.
thanksIn reports I am getting Numeric & date format in English. But only forms all these are in arabic.
Maybe you are looking for
-
Error while installing NWDS CE 7.1 during update manager stage
Hi, I have downloaded the EHP 1 for SAP NetWeaver Developer Studio (NWDS) 7.1 setup and trying to install. But when the update manager is trying to download all features i get the following errors. Unable to complete action for feature "SAP NetWeaver
-
Creating a s:list via AS3 doesn't show the data?
If I do something like this below the list shows up on the screen but the items in the dataprovider don't show up. If I throw the List in via MXML tags it shows up fine. Any suggestions? And yes, I know the data is there as it works when using an
-
Nokia Ovi Suite 2.2.1.23 Problem
I am trying to syn my music using the ovi suite with my nokia N8 and every time i press sync it says Operation failed could not copy tracks. then it tells me to reconnect the usb cable or do it by bluetooth so i replugged my usb and restarted and it
-
What is the clustering algorithm in IMAQ AutoMThreshold VI?
Hello! I am looking at the IMAQ AutoMThreshold (as well as the AutoBThreshold) and it does not tell us which algorithms are being used to set the thresholds. Does anyone know the underlying details? There are about 40 different techniques described i
-
HT1353 Why won't my ipod (model #MC086LL) update to ios5 or ios6?
?