Solved

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

Posted on 2010-09-02
10
1,267 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
ID: 33593783
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
ID: 33611177
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
ID: 33611798
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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:deshaw
ID: 33636026
>>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
ID: 33636180
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
 
LVL 1

Author Comment

by:deshaw
ID: 33637403
>>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
ID: 33644094
>>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
ID: 33937603
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
ID: 33945064
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
ID: 33949014
Unfortunately the provided solution is not optimal.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Stored Proc - Performance Enhancement 15 52
SQL Backup Question 2 29
TSQL Challenge... 7 35
use of sqlCmd command through exec master..xp_cmdshell 7 9
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how the fundamental information of how to create a table.

792 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