cancel
Showing results for 
Search instead for 
Did you mean: 

Sync_key NumberFormatException

Private_Member_201320
Participant
0 Kudos

Hello,

We are currently migrating from version 2.5 to 7.1, our client is a JSP application, and runs on laptops.

For some queries to the database (DB2e) consult the tables directly using SQL, in other queries accessed through the API. The problem we have is that when accessing the tables directly, SYNC_KEY field returns a string of 32 characters, then going to look through the API with that SYNC_KEY an exception occurs "NumberFormatException for input string: XXXXXX"

If the query is using the API returns a SYNC_KEY only with numbers.

Is there any method to convert the internal SYNC_KEY number when accessing the tables directly?

Thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

you need to convert it to FixedDecimal if I remeber it right. I will have a look and if wrong I will reply again.

Hope this helps!

Regards,

Oliver

Private_Member_201320
Participant
0 Kudos

Hi,

I try to convert to FixedDecimal but an exception NumberFormatException is thrown.

FixedDecimal syncKey = new FixedDecimal(synckey_char, 32, 0);

The synckey_char = 0050568C007C1ED093F710CD3C258E1E

Thanks.

Former Member
0 Kudos

Hi,

I guess now I get your issue - you had a request working in MI7.0 - and now convert it to MI7.1

While in MI7.0 it was something like:

<Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">

Funnily enough my xml file in MI7.1 as well describes:

- <Field name="SYNC_KEY" type="N" length="10" decimalLength="0" signed="false" isKey="true" isIndex="true">

Which seem to be the same to me. I did check the imported stuff in MI7.1 and can see:

SYNCKEY_MMW is 32 chars - is this your issue?

I have to check this in my code, but I would say, the 10 char is still the correct joice as long as you are running your code in compatible mode. At least I never had to change any coding to run my JSP or AWT apps inside MI7.1.

But I will have a look on this special issue.

Regards,

Oliver

Private_Member_201320
Participant
0 Kudos

Hi,

My XML is the same as yours. I think when you access with the API he does SYNC_KEY field conversion.

The code that returns me the string SYNC_KEY is:

com.sap.ip.me.persist.jdbc.IBMDB2eManager conn = new com.sap.ip.me.persist.jdbc.IBMDB2eManager();

java.sql.Statement st = conn.getStatement();

java.sql.ResultSet rs1 = null;

String sql = "SELECT \"SYNC_KEY\", \"QMNUM\", \"QMART\", \"QMTXT\", \"STTXT\", \"AUFNR\", \"TPLNRDISP\", \"EQUNR\", \"BAUTL\", \"STAT\" FROM " + tablaAnomalias + " ";

rs1 = st.executeQuery(sql);

while ( rs1.next() ) {

String sync_key = rs1.getString(Anomalia.X_TOP_SYNC_KEY);

...

}

I try to convert it to BigInteger but throws exception, and also i try convert it to BigInteger with radix 16 (hexadecimal) but throws an exception again.

Thanks and best regards.