Showing posts with label type. Show all posts
Showing posts with label type. Show all posts

Wednesday, March 28, 2012

Images in SQL database or filesystem

We are wondering which storage type to choose. The number of images will be
about 30 million and the size of one image will be about 30kb.
What are the advantages and divantages of the two storage areas?
Is there anyone who can help me with his expertise in this area?
Please no answers like: On my filesystem everythings works great.I prefer to store images on the file system, but I know that there are
others that don't share my view. In any case there are advantages and
divantages for each method.
The advantages of storing the BLOB in the database are:
1) You don't need to worry about synchronizing the data in the DB and
the images.
2) When you backup the database you already backup the images.
3) You can manage permissions in the database only.
The divantages of storing the files in the database are:
1) Backup and restore time for the database will increase
significantly.
2) Writing the code to handle the images will be harder.
3) When you work with image data type you'll might have performance
problem (comparing to storing the images on the file system). I have
to admit that I only read it and never tested it.
Adi|||Hi
You will probably get a few replies saying "Put it on the File System".
The issue with that is:
1. How do you keep the DB and FS in sync so during a restore, you don't
loose links? With difficulty.
2. All file systems start have performance problems if you have too many
files in one directory. 30 Million files does result in a very complicated
structure to keep the number of files at a manageable level (10'000 or less,
mileage may vary)
3. You have permissioning issues. If you want to read/write to the files,
the people need read/write access to the files. Files can get modified and
deleted very easily. You control the DB, and once written, you can stop
modifications.
I am in favor of DB storage.
Regards
Mike
"morerice" wrote:

> We are wondering which storage type to choose. The number of images will b
e
> about 30 million and the size of one image will be about 30kb.
> What are the advantages and divantages of the two storage areas?
> Is there anyone who can help me with his expertise in this area?
> Please no answers like: On my filesystem everythings works great.
>|||My rule of thumb (but rule are meant to be broken) is that if you have a
large number of small files, it is better to store them in the database
because of synchronization issues and file system problems managing a large
number of files.
In your case though, you say that you have them in a fileSystem and
everything works great.
I don't know how things will evolve in you situation (file modifications, 40
million files next year, etc.), but unless you have a very good reason to
change a good working system... don't.
"morerice" <morerice@.discussions.microsoft.com> wrote in message
news:FB2F0C09-5E26-4996-8022-CFBC57D3960B@.microsoft.com...
> We are wondering which storage type to choose. The number of images will
be
> about 30 million and the size of one image will be about 30kb.
> What are the advantages and divantages of the two storage areas?
> Is there anyone who can help me with his expertise in this area?
> Please no answers like: On my filesystem everythings works great.
>|||Morice,
It sounds like you will have a headache coming one way or the other. My
experience working with blobs is that they stink. Database size tend grow ou
t
of control, online backup start to become expensive if you pay for storage
like we do and maintenance on the database get longer and longer. Here's a
link to an article that describe a problem you will encounter one day.
http://support.microsoft.com/?id=324432
My point is this: DO YOUR HOMEWORK and communicate, communicate communicate
before you embark on putting the images in the database.
Joseph
"morerice" wrote:

> We are wondering which storage type to choose. The number of images will b
e
> about 30 million and the size of one image will be about 30kb.
> What are the advantages and divantages of the two storage areas?
> Is there anyone who can help me with his expertise in this area?
> Please no answers like: On my filesystem everythings works great.
>

Monday, March 26, 2012

Images are not showing in the report.

new bie to sql server reporting here.

I have made a report here in Sql server Reporting and added a picture in the header of report.

Picture type is embeded in the report.

when i run the report by using Webservice of report server. in my asp.net web application all the contents of the reports are showing fine. but not picture ,,picture is missing there .

i am unable to find tha error.

kind help me to solve this solution

Thanks

ASIF

Make sure the image dimensions do not exceed the space of the header. Resize the image in the designer and preview until you get a good fit.

Image storing

How do i store an image in the db?

I guess i have to chose image as the type of the column.

Do i really need to build an application that will fetch the image and put it in a query?

or can i use directly use sql server management studio?

thanks,If you are on SQLServer2005 you should better choose VARBINARY(MAX), IMAGE and Text will be deprecated in the future. YOu have to use an application which will convert the physical file to the actual byte array.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de|||

Jens Suessmeyer wrote:

If you are on SQLServer2005 you should better choose VARBINARY(MAX), IMAGE and Text will be deprecated in the future. YOu have to use an application which will convert the physical file to the actual byte array.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Do you know an application that will convert the file to actual byte? or i have to code it ?|||Hi,

thats realllllyy easy, have a look at this snippet:

http://www.codeproject.com/aspnet/PicManager.asp

HTH; jens SUessmeyer.

http://www.sqlserver2005.de

Image Sizing

Hi
I have done some research re image sizing and have not been able to confirm
if the following be done. Has anybody had this type of request and solved
it? ..
Logo to display on the page in specific place, limit the image size to a
width of 4cm wide or 2cm high. whichever dimension is exceeded first. Image
should maintain its apect ratio
Many thanks
IanCan you just resize the image file? Or create new version(s) in the
size(s) you require?|||Thank you for the reply, ... unfortunately the details of the requirements
ended up being slightly different (image resizing was not reventually
equired) to what I had been led to believe and the research that I was doing .
"toolman" wrote:
> Can you just resize the image file? Or create new version(s) in the
> size(s) you require?
>sql

Friday, March 23, 2012

Image rendering in IE

Hi All,
I cannot get any of my images to display in reports. I have tried all type
of image storage..embedded, external and database and they preview ok but
when i display the report through report manager or URL, the images will not
show. Any ideas?
regardsIt wouldn't be security settings preventing the display of images would it?
"ACC365" <ACC365@.discussions.microsoft.com> wrote in message
news:A865D853-BA28-4FAE-8EC9-14B305F02A3B@.microsoft.com...
> Hi All,
> I cannot get any of my images to display in reports. I have tried all type
> of image storage..embedded, external and database and they preview ok but
> when i display the report through report manager or URL, the images will
not
> show. Any ideas?
> regards|||Well I have found the solution. It is to do with the name of the
server...there is an underscore in it. IE doesn't view an underscore as a
valid charecter so it cannot resolve the pictures. The solution was to either
rename the server or change the "UseSessioncookies" flag in the reporting
services db. In the table configurationInfo I changes the flag to false and
lo and behold it worked.
much happier.
Andy

Image Property from Business object in Reporting Service 2005


Hi

I have a question from Reporting service 2005
I use Business Objects in My Report
and one of My object's property's type is "Image" or "BitMap"

when i Drop that property in my report and set value in "Fields!MyPicture.Value" and Run that then i see "#Error"

when i drop an "Image" from Toolbar and set that in "Database" and set value in "Fields!MyPicture.Value" and Run that then i see a red "X"

how can i show my image property from business object in my Report (.rdlc)

Thanks alot

Please read my answer in your other thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=467270&SiteID=1

-- Robert

Image Property from Business object in Reporting Service 2005

Hi

I have a question from Reporting service 2005
I use Business Objects in My Report
and one of My object's property's type is "Image" or "BitMap"

when i Drop that property in my report and set value in "Fields!MyPicture.Value" and Run that then i see "#Error"

when i drop an "Image" from Toolbar and set that in "Database" and set value in "Fields!MyPicture.Value" and Run that then i see a red "X"

how can i show my image property from business object in my Report (.rdlc)

thanks alotI have not used RS2005, but in Rs2000 that you need drop and drag a image component to your report and set database filed to this image, and then drag the image to you grid or matrix.
hope this can help you

Image data type. Tricks and tips anyone?

Tools I want to use...

Sql2k/MSDE
ADO 2.x
VB6

Before I waste time experimenting, thought I'd ask the veterans:

I want to store Jpgs into a table, using the image datatype.

Will ADO auto-magically pick up that I'm streaming an image in when I try to do this...

Dim Pic as StdPicutre, RS as ADODB.Recordset
RS.open "select * from...."
set pic = Rs!MyImage

Or do I have to go through bizarre motions like this...

Dim Pic as StdPicutre, RS as ADODB.Recordset
Dim Blob() as byte

Blob = rs!MyImage

Open MyFilePath for Binary as #FileNum
Put #FileNum,,Blob
Close #FileNum

Set Pic = LoadPicture(MyFilePath)

Any thoughts?

(Please don't recommended linked controls, I hate those damn things with a passion.)

Thanks for reading!Agree about linked controls.
If you search you can find code related to inserting images.
Do you need to hold them in the database?
I usually hold them in files on the ado application server with the filename in the database - this saves the network traffic in saving and retrieving and gets round the transaction/trigger issues.|||I found some code, yes. All ways to acomplish this are easy, don't get me wrong...just looking for the simplest solution.

You seam to be implying that you do not recomend storing the actually image bits in the database itself...at all. The system you talk off is similar to what I'm doing now.

If it's not broken, don't fit it?

Is there anything to gain by placing these images into a table?

Thanks!|||Don't see what you would gain - you can't do a lot with them anyway.
If you do want to save them in a table then I would make this a separate database so that it doesn't compromise the rest of the data.
Would still prefer to leave them in files though.

Image data type to character string

I have a table with an image datatype field.

When I retrieve it it displays as a binary array. How do I convert that array back and forth to get the underlying text?

Post the SQL statement used in this regard, you need to use READTEXT statement, also http://www.codeproject.com/cs/database/ImageSaveInDataBase.asp fyi..

If you are using any application to display that image column then refer to http://www.akadia.com/services/dotnet_load_blob.html link for more information.

Image data type Size

I need to store images in MS SQL. I have the upload procedures and stuff but I'm missing the point about the image data type size.

It is supposed to be able to store up to 2Gb!!! but when I declare the data field image I can't specify the max size for the field and by default is 16 !!

16 bytes!! what can I do with that?
How can I insert a file?

Please helpThe pointer to the data is the only thing stored in this database row. The data is stored elsewhere and can be up to 2G. You don't get to specify the size.

Bill|||Thanks for the reply!

But that leads me to this question: How can I write the Insert Statement for the image field?

create table ImgTest (
imgID Int,
imgFName varchar(30),
imgFType varchar(30),
imgFile image
)

All I got so far is a procedure in vb net that tryes to insert a byte array asigned to parameter value:

Insert Into ImgTest Values (1, 'file.jpg', 'image file', @.bytearray)

That's where I'm having trouble because it returns the error: "Data will be truncated" or something like that. I guess it's because it tryes to store the file in the 16bytes that are reserved for the pointer...

Oh.. I'm so lost..

Thank you!sql

Wednesday, March 21, 2012

Image Date Types

Hi,
Can any one tell me how to change an existing
Image column in a table to binary type. I am looking at
the T-SQL .
Thanks and Regards,
SajeevCREATE TABLE Tmp_myImageTable ( imagefield binary(1000) )
GO
EXEC ('INSERT INTO Tmp_testimage (im)
SELECT CONVERT(binary(1000), imagefield) FROM myImageTable ')
GO
DROP TABLE myImageTable
GO
EXECUTE sp_rename N'Tmp_myImageTable', N'myImagetable', 'OBJECT'
GO
Nathan H.O.

Image DataType Default Value

Hi ,

Iam using sqlserver 2005. what default value i can set to image data type.

Thanks

vijay

The Image Datatype is actualy a Binary datatype.

But you can try setting it to 0x00. That does work for VarBinary(max)

Why are you wanting to set a default value?

Image data type. Tricks and tips anyone?

Tools I want to use...

Sql2k/MSDE
ADO 2.x
VB6

Before I waste time experimenting, thought I'd ask the veterans:

I want to store Jpgs into a table, using the image datatype.

Will ADO auto-magically pick up that I'm streaming an image in when I try to do this...

Dim Pic as StdPicutre, RS as ADODB.Recordset
RS.open "select * from...."
set pic = Rs!MyImage

Or do I have to go through bizarre motions like this...

Dim Pic as StdPicutre, RS as ADODB.Recordset
Dim Blob() as byte

Blob = rs!MyImage

Open MyFilePath for Binary as #FileNum
Put #FileNum,,Blob
Close #FileNum

Set Pic = LoadPicture(MyFilePath)

Any thoughts?

(Please don't recommended linked controls, I hate those damn things with a passion.)

Thanks for reading!Agree about linked controls.
If you search you can find code related to inserting images.
Do you need to hold them in the database?
I usually hold them in files on the ado application server with the filename in the database - this saves the network traffic in saving and retrieving and gets round the transaction/trigger issues.|||I found some code, yes. All ways to acomplish this are easy, don't get me wrong...just looking for the simplest solution.

You seam to be implying that you do not recomend storing the actually image bits in the database itself...at all. The system you talk off is similar to what I'm doing now.

If it's not broken, don't fit it?

Is there anything to gain by placing these images into a table?

Thanks!|||Don't see what you would gain - you can't do a lot with them anyway.
If you do want to save them in a table then I would make this a separate database so that it doesn't compromise the rest of the data.
Would still prefer to leave them in files though.

Image data type, doesn't return the data on selected

I don't know much about the Image data type. When I query a record and get
only 16bits of the an Imaeg field, instead of the actual data?
Any documentation and guidance for this problem? It seems not on the Books
Online.
Thanks very much.Check out the 'Retrieving ntext, text, or image Values' topic in the SQL
Server Books Online.
HTH
Jerry
"zhaounknown" <zhaounknown@.discussions.microsoft.com> wrote in message
news:686F627B-885B-4C6E-9134-4148CFFD824F@.microsoft.com...
>I don't know much about the Image data type. When I query a record and get
> only 16bits of the an Imaeg field, instead of the actual data?
> Any documentation and guidance for this problem? It seems not on the Books
> Online.
> Thanks very much.|||Thanks for your reply.
I checked the topic of "retrieving ntext, ...".
What it says is :
The full amount of data is returned if the length is less than TEXTSIZE.
The DB-Library API also supports a dbtextsize parameter that controls the
length of ntext, text, and image data that can be selected. The Microsoft OL
E
DB Provider for SQL Server and the SQL Server ODBC driver automatically set
@.@.TEXTSIZE to its maximum of 2 GB.
I am using MSDE, and @.@.TextSize is 64512. However, my object's length counts
56424, which is less than 64512 and is supposed to return the data in full.
But it seems doesn't.
"Jerry Spivey" wrote:

> Check out the 'Retrieving ntext, text, or image Values' topic in the SQL
> Server Books Online.
> HTH
> Jerry
> "zhaounknown" <zhaounknown@.discussions.microsoft.com> wrote in message
> news:686F627B-885B-4C6E-9134-4148CFFD824F@.microsoft.com...
>
>|||I found the problem is the data has not been stored into the SQL Server.
The reason is:
I create a update command using ADO.Net wizard by entering the command text
manually in the wizard, which will generate the Image field to have size at
16, instead of 2147483647, which causes the problem.
Hope, this may help anyone.
"zhaounknown" wrote:
> Thanks for your reply.
> I checked the topic of "retrieving ntext, ...".
> What it says is :
> The full amount of data is returned if the length is less than TEXTSIZE.
> The DB-Library API also supports a dbtextsize parameter that controls the
> length of ntext, text, and image data that can be selected. The Microsoft
OLE
> DB Provider for SQL Server and the SQL Server ODBC driver automatically se
t
> @.@.TEXTSIZE to its maximum of 2 GB.
> I am using MSDE, and @.@.TextSize is 64512. However, my object's length coun
ts
> 56424, which is less than 64512 and is supposed to return the data in full
.
> But it seems doesn't.
>
> "Jerry Spivey" wrote:
>

Image data type to character string

I have a table with an image datatype field.

When I retrieve it it displays as a binary array. How do I convert that array back and forth to get the underlying text?

Post the SQL statement used in this regard, you need to use READTEXT statement, also http://www.codeproject.com/cs/database/ImageSaveInDataBase.asp fyi..

If you are using any application to display that image column then refer to http://www.akadia.com/services/dotnet_load_blob.html link for more information.

Image data type Size

I need to store images in MS SQL. I have the upload procedures and stuff but I'm missing the point about the image data type size.

It is supposed to be able to store up to 2Gb!!! but when I declare the data field image I can't specify the max size for the field and by default is 16 !!

16 bytes!! what can I do with that?
How can I insert a file?

Please helpThe pointer to the data is the only thing stored in this database row. The data is stored elsewhere and can be up to 2G. You don't get to specify the size.

Bill|||Thanks for the reply!

But that leads me to this question: How can I write the Insert Statement for the image field?

create table ImgTest (
imgID Int,
imgFName varchar(30),
imgFType varchar(30),
imgFile image
)

All I got so far is a procedure in vb net that tryes to insert a byte array asigned to parameter value:

Insert Into ImgTest Values (1, 'file.jpg', 'image file', @.bytearray)

That's where I'm having trouble because it returns the error: "Data will be truncated" or something like that. I guess it's because it tryes to store the file in the 16bytes that are reserved for the pointer...

Oh.. I'm so lost..

Thank you!sql

Image data type and publication problem

Hello there,

I have set up a publisher and ditributor on server1. an article in publication is a Pictures table that consists of Image data type column.

that's ok.

I' ve developed a data entry interface.

but when I try to insert a new 4KB or more image via that interface, I encouter with an error, namely "unspecified error occurred".

I can insert only images with 3KB or less sizes.

what shall I do?

Thanks in advance for your help,
Ali AghabagheriHi
There is a server option called MaxTextReplSize...its default value is pretty small, set it up to the needed amount...this states the maximum amount of data an image/text column can replicate
Des|||It appears that the default value for this setting is 65536 bytes. Isn't it 64K? I think aghabagheri's issue is in the was the image is being stored.|||rdjabarov is right on both counts...(guess i was used to 64K being pretty small!)

Image data type

I have been asked to write a piece of code that will insert an image object into a database using a stored procedure and the Microsoft Enterprise Library. Has anyone done this before? Do you have any code examples about how to update a database with an image datatype that needs to be chunked, etc...

In this instance, I need to open up a word document and save the contents as an image in a database.

basically you want to get the uploaded file into a byte array and then you can assign it to a sql param of type image, no chunking needed

here's a snip from one of my projects. I'm using business objects so its not showing the actual sql code but behind the scenes it is just assigning it to a param of type image

byte[] fileBytes = new byte[replacementFileInput.ContentLength];
Stream contentStream = replacementFileInput.FileContent;

contentStream.Read(fileBytes, 0, (int) replacementFileInput.ContentLength);
contentStream.Close();

DocumentFile newFile = new DocumentFile(true);
newFile.DocumentID = originalDocument.ID;
newFile.DocumentType = documentType.Name;
newFile.DocumentImage = fileBytes;
newFile.Save();

I should note that in my example I'm usingNeatUpload, so replacementFileInput is the NeatUpload file input and has a little different syntax then the regular .NET file input

NeatUpload can handle large file uploads gracefully with a progress bar and is free and open source

Hope it helps,

Joe|||

I downloaded the NeatUpload. This does look pretty cool. However, in the instance I'm currently in, I have a Word Document already on the server that I need to convert to a binary object and upload to SQL. The answer is probably right in front of me, so... following your initial tip.

How do I convert an existingWord Document into a byte array?

|||Yes, you can easily do this. In my previous example I was using the contentStream from the uploaded file, but any subclass of stream could be used, so in your case FileStream which you can get with something like this:

FileStream fileStream = File.Open("pathtoyourfile", FileMode.Open);
byte[] fileBytes = new byte[fileStream.Length];
fileStream.Read(fileBytes, 0, (int)fileStream.Length);

now fileBytes has the file and you can assign it to your sql image param

Hope it helps,

Joe|||

This is great, thanks! I think I got the record in there... Now I just have to read it! Big Smile

Thanks for your help, Joe.

-Scott

|||

Okay, I have been struggling to convert the following code from C# to VB. Particularly at the point of creating the New Byte. Can anyone help?

SqlCommand cmdSelect=new SqlCommand("select Picture" +
" from tblImgData whereID=@.ID",this.sqlConnection1);
cmdSelect.Parameters.Add("@.ID",SqlDbType.Int,4);
cmdSelect.Parameters["@.ID"].Value=this.editID.Text;

this.sqlConnection1.Open();
byte[] barrImg=(byte[])cmdSelect.ExecuteScalar();
string strfn=Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs=new FileStream(strfn,
FileMode.CreateNew, FileAccess.Write);
fs.Write(barrImg,0,barrImg.Length);
fs.Flush();
fs.Close();
pictureBox1.Image=Image.FromFile(strfn);

Image Data Type

Where can I find information about the IMAGE data Type
for MSDE2000?
Thanks, Charlie
The SQL Server Books Online.
http://www.microsoft.com/sql/techinf...2000/books.asp
"Charlie" <anonymous@.discussions.microsoft.com> wrote in message
news:1b4f01c4dbf2$47c86320$a401280a@.phx.gbl...
> Where can I find information about the IMAGE data Type
> for MSDE2000?
> Thanks, Charlie
sql

Image Data Type

I have a column that has audit details stored as an image data type. How do i convert that into meaningful data that i can read.
Example:
0x78F992BD69BF23BE243134839506265892223083981A6104 A389A1B1918129B6303035B434C7748FAF63508887A33B99CB AE4C8C4C8D71B68DCC8CCC8C0D4D71350040B246C603309AEE 1810E0EAE8437046C3C440D7C48892414E007B1F8BED
I am guessing this is text with fomatting instructions. Because in the software that utilized this database, this field seems to be interpreted as a hierarachial table showing the audit details of an event.

please offer any suggestions you can.
thanks so muchActually this is binary data. The only way to access or read it is through an application. See www.asp.net for some examples of how to access the data.|||Is this a BLOB file that i can use a filestream object to import into a VB application? Sorry for my newbieness.

thanks

Mardi|||Yes, an IMAGE is a blob. Typically, it is at least an 8 kb blob in order to use the database space effectively, although it can be smaller.

-PatP