Solved

Accessing Blob objects from Java client using RBS / FILESTREAM in SQL 2008

Posted on 2010-09-02
10
1,218 Views
Last Modified: 2012-05-10
Hi,
I came to know that SQL 2008 support RBS and SharePoint 2010 recommends it for better performance and eliminate limitations on db record size. However, I am interested in implementing the same for my web application written in Java and running on Unix. Has anyone implemented RBS or FILE STREAM Data type from Java? If yes, can you point me to the right article/sample implementation.

One of my friend told me that FILESTREAM can be used only from a .Net client. Is this true? I hope it is not, as SQL server is not designed for only .Net.

Best Regards,
Venkat
0
Comment
Question by:deshaw
  • 5
  • 5
10 Comments
 
LVL 19

Accepted Solution

by:
Rimvis earned 500 total points
Comment Utility
This might help:Working with SQL Server 2008 Filestream using v1.2 JDBC driverhttp://blogs.msdn.com/b/jdbcteam/archive/2008/10/03/working-with-sql-server-2008-filestream-using-v1-2-jdbc-driver.aspx
0
 
LVL 1

Author Comment

by:deshaw
Comment Utility
Hi,
Thanks for the quick reply.
As per http://msdn.microsoft.com/en-us/library/cc949109.aspx it seems this method of accessing through TSQL gives you low throughput compared to using varbinary. Our quick test also proved the same. This method has the lowest throughput.
Does it mean that we should store the blobs in db rather than file system?
Thanks,
Venakt
0
 
LVL 19

Expert Comment

by:Rimvis
Comment Utility
Sorry, I didn't have hands-on experience with FILESTREAM, so I can't comment on that. In my opinion, it depends, how are you using these fields. If performance is critical, then I would use FILESTREAM, if not, I would stay with VARBINARY. FILESTREAM has some limitations. You can't use database mirroring, you can't use it in temp tables/table variables, and some more. You should consider this.
Here's  a good article on this topic:
http://www.simple-talk.com/sql/learn-sql-server/an-introduction-to-sql-server-filestream/

IMHO storing files on file system is never a good idea. No transactional consistency, no backup consistency. We had one project, where thousands of files were stored in single directory. There were performance problems because of number of files. Of course, it was Windows 2000 server, but I wouldn't risk to use such setup even on current OS'es
0
 
LVL 1

Author Comment

by:deshaw
Comment Utility
>>IMHO storing files on file system is never a good idea. No transactional consistency, no backup consistency.
Hi,
If this is correct, howcome Microsoft is recommending to use RBS for SharePoint?
From out tests, we found that accessing FILESTREAM objects using TSQL is very slow compared to reading varbinary objects from both Java and native windows client. Now I am confused about what are the usecase / scenarios where we should go FILESTREAM or RBS.
 
Thanks,
Venakt
0
 
LVL 19

Expert Comment

by:Rimvis
Comment Utility
By "storing files on file system" I meant "storing files separately from database". Consider photo album application, where path to photo is stored in database, but actual file is on file system.

I'm not familiar with RBS, but most likely this is much more sophisticated solution that simply "storing files on file system" .
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 1

Author Comment

by:deshaw
Comment Utility
>>I meant "storing files separately from database".
Do you mean using FILESTREAM object does not provide you the  transactional consistency? If so, how is it different from storing the file in filesystem from our code and hten store the file path in the database, which is very fast when compared to using FILESTREAM object.
Presently we are storing the files into file system from our service layer, but we want to avoid this multi step process and make use of the SQL feature to store the blobs on file system as it takes care of transactions and we don't need to worry about the file handling.
Am I doing something wrong here?
Thanks,
Venkat
0
 
LVL 19

Expert Comment

by:Rimvis
Comment Utility
>>Do you mean using FILESTREAM object does not provide you the  transactional consistency?
No, you got me wrong. FILESTREAM DOES provide  transactional consistency.

>> we want to avoid this multi step process and make use of the SQL feature to store the blobs on file system
I think you are going in right direction by trying to store files on database. The question is should you store them on FILESTREAM or simple VARBINARY field? Please see my post above (ID:33611798)


0
 
LVL 1

Author Comment

by:deshaw
Comment Utility
Sorry,
I could not see your reply for a long time.  We tried the JDBC driver option, but found that it takes more than 5 times when compared to storing the file directly in the database.
Even with native windows api, FILESTREAM method is slower than reading the files directly from a blob field.
It is little weired to me that why FILESTREAM is slower than reading blob from database directly. I am not sure whether I am missing something here.
Best,
Venkat
0
 
LVL 19

Expert Comment

by:Rimvis
Comment Utility
Hi deshaw,

Sorry, I don't think I could help you any further.
i suggest you open a new question regarding that specific problem (FILESTREAM being slower than BLOB).


0
 
LVL 1

Author Closing Comment

by:deshaw
Comment Utility
Unfortunately the provided solution is not optimal.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now