Solved

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

Posted on 2010-09-02
10
1,292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

738 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