Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
foufou
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

Datatype mismatch for blob type blackberry

I have an exception that Datatype mismatch in this line

byte[] _data = (byte[])row.getBlobBytes(1);

and in the table I have the type of column 2 is BLOB. Can any one help me ?

Please use plain text.
Trusted Contributor
foufou
Posts: 109
Registered: ‎11-15-2011
My Device: blackberry 9800
My Carrier: beginner developer

there is no one who use blob type???? public static Url...

[ Edited ]

there is no one who uses blob type???? this is the method that I use and teh exception in this line 

_data = row.getBlobBytes(1);

 

public static UrlRsc getContentUrl(String name) {
        UrlRsc elementRsc = null;
        try {
            Statement statement = DB
                    .createStatement("SELECT  * FROM table where"
                            + " Name='"
                            + name + "'");
            statement.prepare();
            Cursor cursor = statement.getCursor();
            Row row;


            while (cursor.next()) {
                row = cursor.getRow();

                byte[]_data;
                _data = row.getBlobBytes(1);


            }
            statement.close();
            cursor.close();
        } catch (DatabaseException dbe) {
            System.out.println(dbe.toString());
        } catch (DataTypeException dte) {
            System.out.println(dte.toString());
        }
        return elementRsc;
    }

 

Please use plain text.
Developer
maadani
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: there is no one who use blob type???? public static Url...

[ Edited ]

Hi @

 

Check if the result of cursor.getColumnIndex(columnName) == 1 (the index that you use for getting the BLOB).

 

Hope that helps,

 

E.

Please use plain text.