on 10-25-2010 11:52 AM
Hello all,
Does anybody know something about this JDBC problem?
I have a problem with JDBC driver. I using version 7.06.05.
Example of my code
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("SELECT null as LONG_COL FROM DUAL");
rs.next();
addResultItem("LONG_COL", String.valueOf(rs.getLong(1)));
The exception is:
com.sap.dbtech.jdbc.translators.ConversionExceptionSapDB: Cannot convert SQL type CHAR BYTE to Java type long.
at com.sap.dbtech.jdbc.translators.DBTechTranslator.newGetException(DBTechTranslator.java:1195)
at com.sap.dbtech.jdbc.translators.DBTechTranslator.getLong(DBTechTranslator.java:596)
at com.sap.dbtech.jdbc.ResultSetSapDB.getLong(ResultSetSapDB.java:1121)
at com.sap.dbtech.jdbc.trace.ResultSet.getLong(ResultSet.java:180)
But when I run this sql code inside MaxDB Studion - Everything is ok,
Please help me
Thanks all
Hi,
beside the fact that I do not catch, what you really want to do or to test:
SELECT fixed(NULL) from dual (no matter if the output-column is renamed or not)
returns the NULL-value, when the result ist fetched/the next resultrow got.
Of course, the select itself, returns the fact, that there is no error with the returncode 0.
We do not see, where you catch the 0 from and therefore we assume that you mix something up during this select.
Elke
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried now this
... = st.executeQuery("SELECT FIXED(null) as LONG_COL FROM DUAL");
and this works. But return value 0 instead of NULL.
Is this correct solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>Example of my code
>
> Statement st = conn.createStatement();
> ResultSet rs = st.executeQuery("SELECT null as LONG_COL FROM DUAL");
> rs.next();
> addResultItem("LONG_COL", String.valueOf(rs.getLong(1)));
>
> The exception is:
> com.sap.dbtech.jdbc.translators.ConversionExceptionSapDB: Cannot convert SQL type CHAR BYTE to Java type long.
> at com.sap.dbtech.jdbc.translators.DBTechTranslator.newGetException(DBTechTranslator.java:1195)
> at com.sap.dbtech.jdbc.translators.DBTechTranslator.getLong(DBTechTranslator.java:596)
> at com.sap.dbtech.jdbc.ResultSetSapDB.getLong(ResultSetSapDB.java:1121)
> at com.sap.dbtech.jdbc.trace.ResultSet.getLong(ResultSet.java:180)
>
Why do you think that you get a LONG datatype back, when you rename the column as "LONG_COL" ?
You select NULL and don't cast any datatype. In that case you get a CHAR back instead of a LONG.
In MaxDB Database Studio the resultset is first examined for its datatypes and fetched afterwards.
BTW: why do you want to select NULL into a LONG datatype?
regards,
Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.