ResultSet getString gets truncated
Hello,
we have developed a Webdynpro application that stores and retrives data from a MS SQL Server DB. We store a String in a vchar(500). If we read the value directly from the MS SQL Server, all the characters appear, but if we use the method getString from the resultset, some characters are not retrived so we get a truncated string.
Does anybody know what's the problem?
Thanks in advance.
Gregori Coll Ingles.
Peter,
JDBC driver bug that misreports column sizesWhich bug is that? I am not aware of that one, and I haven't encountered it.
Good Luck,
Avi.
Similar Messages
-
Data truncation when using resultset.getString() to a char type field
In my table ,there is a char type field,such as a char(4) field, for multilanguage use,I put two "double-byte" character in it,
when I using resultset.getString() to this char type field,I can't get the right result,one char was truncated, so I only get three char, for "double-byte" it 's error code
this only happen on IBM JVM on AIX 5 , when I use oracle jdbc on windows hotspot vm , it works fine (we use the same oracle on AIX)
is there any further setting for JDBC driver on AIX ? but it 's thin driver
and the varchar type works fine at any paltform
any help ?Hi jul!!!
write like this:
DATA : wa_flight_data TYPE bapisfldat,
wa_add_info TYPE bapisfladd,
wa_availability TYPE bapisflava,
it_ret TYPE STANDARD TABLE OF bapiret2,
wa_ret TYPE bapiret2.
PARAMETERS : pa_carr TYPE sflight-carrid,
pa_conn TYPE sflight-connid,
pa_date TYPE sflight-fldate.
CALL FUNCTION 'BAPI_FLIGHT_GETDETAIL'
EXPORTING
airlineid = pa_carr
connectionid = pa_conn
flightdate = pa_date
IMPORTING
flight_data = wa_flight_data
additional_info = wa_add_info
availibility = wa_availability
TABLES
*EXTENSION_IN =
*EXTENSION_OUT =
return = it_ret.
write : / 'Flight Data: ',
wa_flight_data-AIRLINEID,
wa_flight_data-AIRLINE,
wa_flight_data-CONNECTID,
wa_flight_data-FLIGHTDATE,
wa_flight_data-AIRPORTFR,
wa_flight_data-CITYFROM,
wa_flight_data-AIRPORTTO,
wa_flight_data-CITYTO,
wa_flight_data-DEPTIME,
wa_flight_data-ARRTIME,
wa_flight_data-ARRDATE,
wa_flight_data-PRICE,
wa_flight_data-CURR,
wa_flight_data-CURR_ISO.
similaryly for wa_add_info and wa_availability.
becoz u r using work area directly in WRITE statement and
wa_flight_data TYPE bapisfldat,
wa_add_info TYPE bapisfladd,
wa_availability TYPE bapisflava,
contains both int and char data so u can print all of them together..They can be printed field by field.
if any doubts..let me knw.
hope it helps.
kindly rewrd. -
A bug in the ResultSet.getString method?
Hi,
I am using a 8.1.6 database with UTF8 character set on a Win2000 machine. I've inserted some Hebrew characters into a table, and have been able to read them back properly using SQL+.
However, when I try to retrieve these values from a simple Java program using the resultSet.getString method (via Oracle JDBC driver 8.1.6) I always get the '?' character for every Hebrew character (English characters work fine). However, if I call the 'getBytes' method of the result set, and create a new String instance from that data, it works fine - help needed!
Thanks...
nullHowever, if I call the 'getBytes' method of the result set, and create a new String instance from that data, it works fine - help needed!Thanks...
Please show me how to using 'getBytes' method of the result set and create a new string instance from THAT DATA, because this way doesn't work for me. I am converting ZHT16DBT to Unicode, and all I got is ?????.
Please help me if you have any idea. THANKS
null -
Resultset.getString(). error
I'm using Oracle 10g with jrockit 1.4.2_13.
While looping through a cursor it blows up while executing resultset.getString().
This code has been working for years and just blows up on a specific piece of data.
The data it's trying to retrieve is .0548. Similar data is retrieved successfully.
at oracle.sql.LnxLibThin.lnxnuc(LnxLibThin.java:6071)
at oracle.sql.NUMBER.toText(NUMBER.java:2682)
at oracle.jdbc.driver.NumberCommonAccessor.getString(NumberCommonAccessor.java:5303)
at oracle.jdbc.driver.T4CNumberAccessor.getString(T4CNumberAccessor.java:83)
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:355)
I've tried to upgrade to the latest ojdbc14.jar driver with negative results.
Here is the code snippet:
for(int i=1;i<=size;i++){
str_columnName = (String)ht_elementMappings.get((i)+"");
sbf_rowData.append("\t\t<"+str_columnName+">");
//Blows up on the 18th column during the getString
str_columnValue = rs_object.getString(i);
sbf_rowData.append( str_columnValue );
sbf_rowData.append("</"+str_columnName+">");
sbf_rowData.append("\n");
sbf_rowData.append("\t</ROW>");
sbf_rowData.append("\n");
bufferedWriter.write(sbf_rowData.toString());
Thanks in advance for any thoughts.(1) and (3) are related to gcc versions to use with OCCI. OCCI 10.1 and 10.2 support gcc 3.2.3 (and gcc 2.96). In addition, OCCI 10.2 supports gcc 3.4.3 (libraries are available on OTN).
2) For retreiving the column names in a ResutSet, you need to use the ResultSet::getColumnListMetaData() interface. You can implement your own solution to call ResultSet::getXXX methods by column name e.g :-
vector<MetaData> md = rs->getColumnListMetaData();
map<string, int> columns;//column names to number mapping
for (int i = 0; i < md.size(); i++) columns[md[i].getString(MetaData::ATTR_NAME)] = i;
//now "use" column names!
string ename = rs->getString(columns["ENAME"));
-Shankar -
ResultSet.getString() != toString()
We have a method which retrieves values from a result
set by simply doing resultSet.getString(index). This
works fine in all cases and the result retrieved is
as if the proper type is retrieved and a toString() is
done on it, except for Timestamps. For Timestamps, we
are getting a result in the format
yyyy-M-d.h.mm. ss. fffffffff
rather than the expected Timestamp.toString() format of
yyyy-MM-dd hh:mm:ss.fffffffff
When we later do Timestamp.valueOf(), it chokes because
the format is incorrect. This is with WLS7SP2 and Oracle
9.2. Has anyone else encountered this? Any patches to
fix this available?
: jayJay Schmidgall wrote:
We have a method which retrieves values from a result
set by simply doing resultSet.getString(index). This
works fine in all cases and the result retrieved is
as if the proper type is retrieved and a toString() is
done on it, except for Timestamps. For Timestamps, we
are getting a result in the format
yyyy-M-d.h.mm. ss. fffffffff
rather than the expected Timestamp.toString() format of
yyyy-MM-dd hh:mm:ss.fffffffff
When we later do Timestamp.valueOf(), it chokes because
the format is incorrect. This is with WLS7SP2 and Oracle
9.2. Has anyone else encountered this? Any patches to
fix this available?
: jayI'll guess that you're using a type-2 driver, maybe ours. If I'm
correct, our type-2 driver will rely on Oracle's OCI functions
for most values of most data. if you call getString() we simply
ask the OCI layer for the data as a string, and it does the formatting.
The solution is to normalize to getTimestamp().
Joe -
Random NullPointerException on resultset.getstring
I have been getting random NullPointerException ever since I have moved my code to a new dev server. I was using tomcat 3 and oracle 9i but moved to tomcat 6 and oracle10g express edition.
The errors happen mostly when the server is under load.
here is the code where is breaks
while(rset.next()) {
signNum++; //LINE:2172
signed.set(rset.getString(1),"CHECKED"); //LINE:2173
mark.set(rset.getString(1)); //LINE:2174
}and here is the stack trace:
SEVERE: Servlet.service() for servlet MyServlet threw exception
java.lang.NullPointerException
at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:397)
at runner.MyServlet.getSignUp(MyServlet.java:2174)
The exception does not happen everytime. It is also odd that the previous line was able to successfully call rset.getString but the very next line gets NullPointerException. Perhaps express edition is to blame?
This is not the only code that gets exceptions. It happens all over seemingly random. It happens to resultset.getstring and resultset.getint.
FrustratingYou were right, it was a multithreading issue.
Did a google search on "servlet multithreading" and got this article:
http://www.javaworld.com/javaworld/jw-07-2004/jw-0712-threadsafe.html
And I realized My servlet had a private variable that was being shared. Been a while since I have been using servlets. The funny thing is that this code ran for years w/o problem on jserv (the really old tomcat). They must not have implemented servlets with multithreading.
Anyways, mega thanks. -
String allocation in ResultSet::getString() issue
Hi all :)
I have been learning the basics of OCCI and I am having a
problem with Debug mode in MSVC. When I retrieve a string from
ResultSet::getString, and the string goes out of scope, I get an
assert about an invalid heap pointer.
I think that somehow the ResultSet object is setting the pointer
inside of the string object in a way which would circumvent the
list of allocations on the debug heap. So that when the string
destructor is called, it tries to free the internal pointer, and
asserts.
Everything works correctly in Release mode.
Is there any suggested way of handling this? Or is there a debug
version of the OCCI?
Here is the simplistic offending code:
while (rs->next())
string username = rs->getString(1);
string passwd = rs->getString(2);
} <--- asserts here
Any help would be great :)
Thanks,
Gerald FishelOCCI has multiple copies of libraries that work with different compiler versions. Please make sure you are using the appropriate version of dll. You can search for this topic on OCCI forum.
C++ Call Interface (OCCI) -
Data getting truncated while exporting report to a text file in crystal 10?
Hi All,
I am using crystal 10.When exporting report to a text file ,a dialog prompts asking for Character perinch with a default value 9.If I change the value from 9 to 16 i am getting the correct data(that means character per inch value is 16) and it update "CharPerInch" value in registry under following location to 16.
HKEY_CURRENT_USER\Software\Crystal Decisions\10.0\Crystal Reports\Export\Text
The dialog asked for character per inch also has option to select not to prompt again and i also selected that in first go.
When i export the report again in text format it didn't prompt for number of character per inch but the data gets truncated.
What i believe is even though it updates entry in registry and reads, it is not using the same value for export. It never consider the value that is in registry, if the check box is not selected then it is using the value entered in the dialog and if the check box is selected then in the next run it uses the default value as 9.
Can anyone suggest me how to override this problem ? Is there any other setting place in registry where i can enter the number of character per inch.I don't want to crystal to prompt always for character per inch.Hi Venkateswaran,
The other option to avoid truncation of the data could be
Right click the text filed
Click on Format Text to open the Format Editor
On Common tab check the text box for Can Grow.
This will prevent the data from truncating in preview as well as while exporting to text.
Otherwise you will have to set the characters per inch to 16 each time. I donu2019t see changing the registry value causing any difference here.
Regards,
Aditya Joshi -
Error Message in selection screen Status bar is getting truncated
Hi Guys,
Error Message in selection screen Staus bar is getting truncated (full message is not getting displayed).... can anybody tell me how to reslove thisHi
Maimum we can give the error message length is 50 char. If you give more than that it will get truncated.
What you can do this split 50 and 50 like that you can give 200 chnars.
Data : Text1 type char50
Text2 type char50
If sy-surc ne 0.
Message Text1 Text2 TYPE "E'' or 'S'
endif. -
Application server file values getting truncated
Hi,
I'm sending a file to Application server with minimun 1800 characters in a singlw row. The file is getting uploaded into the server but with only 255 chars in the same row. All others are getting truncated.
Can anyone please suggest on this?
Thanks
Itishree.Hi,
You can download your file from application server using CG3Y.
And upload your file to application server using CG3Z.
I think just a typo mistake by the one who answered before me.
Regards,
Bharati Singh -
ALV Header getting truncated in excel
I am using the GRid Layout. but when i am downloading the output in the Excel sheet, the headers are getting truncated.
I have tried increasing the width in the FIELDCAT and also removing the coulmn-optimze option in the layout also. but still after trying the headers are getitng truncated.
Any pointers how can i download without the headers getting truncated.
ThanksRefer the code snippet:
Follow this way:
CONSTANTS : c_delim TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
data :it_excel_dwnld TYPE STANDARD TABLE OF t_zzidwnld_data ,
wa_excel_dwnld TYPE t_zzidwnld_data . .
CONCATENATE 'Physical Inventory Document'
'Item '
'Material '
'Material Description'
'Material Group'
'Plant'
'Sloc'
'Doc Date'
'Book Qty'
'Counted Qty'
'Value of Phy Inv Count'
'Standard Price'
'Difference Qty'
'ABS Qty'
'BUn'
INTO wa_excel_dwnld-line
SEPARATED BY c_delim.
APPEND wa_excel_dwnld TO it_excel_dwnld.
CLEAR: wa_excel_dwnld.
LOOP AT it_output INTO wa_output.
CONCATENATE wa_output-iblnr
wa_output-zeili
wa_output-matnr
wa_output-maktx
wa_output-matkl
wa_output-werks
wa_output-lgort
wa_output-bldat
v_buchm
v_menge
v_wrtzl
v_stprs
v_difqy
v_absqy
INTO wa_excel_dwnld-line
SEPARATED BY c_delim.
APPEND wa_excel_dwnld TO it_excel_dwnld.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_flname
filetype = 'ASC'
write_field_separator = '#'
TABLES
data_tab = it_excel_dwnld -
In Read_text FM, the data after 256 characters gets truncated
Hi All,
In this FM, the internal table can't have string type field. In my case the data is in multiple lines of internal table and I am concatenating into a single field which is of type DESCRIPTIONS(string). I am passing this data to a table in smartform.Only 255 characters are printed, remaining data gets truncated. I am using CONVERT_OTF and SX_TABLE_LINE_WIDTH_CHANGE FMs to create PDF. Is it the limitation or I am incorect here?Your posting title is misleading; there's nothing wrong with FM READ_TEXT. Yes, it returns a table of type TLINE, as you've noted. Perhaps you could close this post and repost in FORM PRINTING with an appropriate title like: Can't show more than 255 characters of text.....but search first, because you cannot be the first person to encounter this limitation.
-
Report output getting truncated in email attachment
Hello Gurus,
My requirement is to send a report output as an email attachment.
I have done the coding for this but have a small problem. In the attachment the report is getting truncated after certain length.
Can you advise wats the problem ?
Regards,
SuhasHello Guys,
I too was contemplating on those lines. But actually i was calculating the File Size incorrectly.
Changed the code & now it working !!!!!!!
BR,
Suhas -
Problem in download to application server- file column is getting truncated
We have a program for which there are 2 options a list output or file to be placed on the application server. The TXT file is of length 525 characters.
My problem is while the list output is generated the whole list is getting outputted, but when we take a output on the application server last 10 columns are getting truncated.
Can somebody give a help on this.
Thanks in advance.
JillyUse the function module
ARCHIVFILE_SERVER_TO_CLIENT
Pass the values: as download file and destination in the respective fields.
File to be downloaded in :(Pass the exact file name)
PATH :
SDEC01\SAPMNT\INT\HR\OUT\FMLA-20080205-0728
and
Destination to download the file in:
TARGETPATH C:\DOCUMENTS AND SETTINGS\JILFEM\MY DOCUMENTS\FMLA-20080205-0728
Regards,
Jilly -
E-mails get truncated when forwarded
When I forward an e-mail from within the e-mail app, the e-mail does not get forwarded completely. For some reason the original text gets truncated.
I first noticed this on IOS 6 on both the iPhone 5 and iPad 3rd gen.
Please advice me what to do, because this way the e-mail app is not reliable.
Kind regards.Thank you. I will have to try this out with a known troublesome link, but I don't recall getting an "open with" dialog in these circumstances. Also, as I understand these things (and I probably don't) the links I have tried to use have been communication links rather than a file opening function. The problem I got the other day was on a BBC site and the function of the link (which was an e-mail address) was to enable me to post a question. I was able to use that address to post the question without using the link shortcut - just sent an e-mail.
Maybe you are looking for
-
I am upgrading my iphone from ios 4.3 to 7. Will I lose my music? If so, how can I retrieve it after new upgrade?
-
How to publish project to get url?
how to publish project to get url?
-
Zen Touch Krusell Case [Imag
I just received the Zen Touch Krusell Case today, and must say that I finally have a true case for my MP3 Player. Anyways you can find the detail and product pictures on Krusell's website: www.krusell.se However I took some of my owm pictures to clar
-
Can't Open My AppleWorks Document!!!
I created an apple works word document, and I had prevously saved it. After I spell checked it, it wouldn't let me save. I figured that I would just close it, then open it again, and see if that would do anything. When I went to open it again, it wou
-
Hi , Please help me on this I am having a function to encrypt a string accepting a key value. CREATE OR REPLACE FUNCTION encrypt_data( enc_string IN VARCHAR2, key_value IN VARCHAR2 RETURN VARCHAR2 AS l_key RAW(256); l_stored_key RAW(256); g_master_ke