How to retrieve nVarchat data from Sql Server DB
How can I retrieve data of NVARCHAR data type from Sql Server 2000.Do I have to user ResultSet.getCLOB() or ResultSet.getBLOB() ?thx
# 1
I have no idea, but you can find out the classname which is mapped by JDBC at the following ways:
// Retrieve mapped class name by metadata.
ResultSetMetaData metaData = resultSet.getMetaData();
String className = metaData.getColumnClassName("columnname");
System.out.println(className); // Prints the mapped class name. I.e. java.sql.Blob or java.sql.Clob
// Or just upcast to object and lookup the instantiated class.
Object object = resultSet.getObject("columnname");
String className = object.getClass().getName();
System.out.println(className); // Prints the mapped class name. I.e. java.sql.Blob or java.sql.Clob
# 2
I am still facing problem retreiving NVARCHAR data type./I am using JDBC-ODBC driver.Can driver be the problem...?
# 3
What about my suggestion to find out the mapped object type?What about the "problem"? Elaborate it in detail. There are countless definitions of "problem".
# 4
I used ur solution but when I use getObject(), it trows NullPointerException.I dont know why it is doing that. There is a value that exists but still it trows NullPointerException.
# 5
When I call getString("columnName") on the DB column which is NVARCHAR, it returns null even though a value exists there.I am really frustrated now.....I am using JDBC-ODBC Driver.reply as soon as possible.thx
# 6
> I used ur solution but when I use getObject(), it
> trows NullPointerException.
> I dont know why it is doing that. There is a value
> that exists but still it trows NullPointerException.
Then the value is simply null. And what about the another suggestion?
# 7
As far as your second suggestion is concernedRetrieve mapped class name by metadata it returns java.lang.String.Problem still remains the same....Message was edited by: Java_person
# 8
Then just use getString(). If it is actually not null in the database, then the driver may be buggy or simply having it's shortcomings. Have you tried the manfacturer's own JDBC driver?
# 9
I have also tried getString() but no success....No, I have not yet tried manufacturer's own JDBC driver.Which one would you recommend?Did u tried any good one?
# 10
> I have also tried getString() but no success....
> No, I have not yet tried manufacturer's own JDBC
> driver.
> Which one would you recommend?
> Did u tried any good one?
I really don't think the manufacter's own driver is going to help you here. The manufactures's own JDBC driver is a copy of the sourceforge one with more bugs added.
What driver are you using exactly?
Have you consulted the FAQ's for said driver with regards to ensuring unicode support?