Solved

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

Posted on 2010-09-02
10
1,235 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
 
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

867 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

18 Experts available now in Live!

Get 1:1 Help Now