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
Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified
Accepted Solution

Help storing audio as BLOB in SQLite database

[ Edited ]

Hello everyone,

 

I've been trying to store audio into my SQLite database as a BLOB.  I think that I'm having an issue converting the audio to bytes, however, as the value stored in the database is always in the following format:

 

[B@d7266d3b

 

Here is the code that I'm using:

 

InputStream responseData = connection.openInputStream();

byte[] data = IOUtilities.streamToBytes(responseData); System.out.println("DATA: " + data); // Value here is [B@d7266d3b DatabaseFunctions.setAudio(tid, data);

Is there some other way to convert the InputStream into bytes?  The audio is a couple of seconds in length, there should be a lot more bytes...

 

By the way, I am using bind() when storing the actual bytes into the BLOB column of the database.  But I think the problem lies before I do this.

 

Thanks!

Developer
Posts: 409
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: Help storing audio as BLOB in SQLite database

What's the size of you byte[]. The problem may come from that.

You must be aware that a blob is limited at 4kb in the BB's implementation of SQLite. Bug already reported and the fix will not be dont at all. 

Developer
Posts: 367
Registered: ‎11-25-2009
My Device: Not Specified

Re: Help storing audio as BLOB in SQLite database

Ah, good to know!  A lot of the audio files I've been working with are at least 250kb in size.  I thank you for your help!

Trusted Contributor
Posts: 184
Registered: ‎11-26-2010
My Device: Not Specified

Re: Help storing audio as BLOB in SQLite database

Hello behrk, I am facing the same issue, what is the alternative you are using to save the music? How about storing it on filesystem? Is it  correct approach?

 

A Y.

Developer
Posts: 409
Registered: ‎06-03-2010
My Device: Z10 Red
My Carrier: Free

Re: Help storing audio as BLOB in SQLite database

I'm interested to know what the solution behrk found. But I think that using the file system is the only one, the cod file is limited to 8Mo of resources, so there is only the file system left.