Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- General Development
- :
- Problem about export Blob data from SF by java
turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
0
Problem about export Blob data from SF by java
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-20-2012 12:36 AM
I want to export all Attachment data from SF, the volumn is too big(nearly 18G) and seems like it cannot be put into one csv file by DataLoader.(I tried and failed for "java heap space").
So I tried to write a java batch, use for loop, make csv file each 500 records. Then I got a very strange exception.
Here is my code:
String str = "select Id, ParentId, Name, Description, BodyLength, Body from Attachment limit 10";
QueryResult results = conn.query(str);
for (int i = 0; i < results.getSize(); i++) {
SObject obj = (SObject) results.getRecords()[i];
******
}I debugged this program, and I saw "results.getSize() = 10", but "results.getRecords() = 1"!!!
So when i comes to 1, list out of bound exception.
Then I tried not selecting the Body
String str = "select Id, ParentId, Name, Description, BodyLength from Attachment limit 10";
QueryResult results = conn.query(str);
for (int i = 0; i < results.getSize(); i++) {
SObject obj = (SObject) results.getRecords()[i];
******
}I saw "results.getSize() = 10", and "results.getRecords() = 10".
What's the problem? How can I get the Blob data?
I'm waiting for your help. Thanks.

