Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql blob data to ms-sql image field

Status
Not open for further replies.

greg0rym

Programmer
Jun 19, 2007
3
GB
hi people

I have imported "blob" data from mysql to an ms-sql 2000 "Image" field, using ms-sql enterprise manager. However my c# image veiwer does not work on the imported blob data (it does work on data I add to ms-sql via my web application).

Is there any way I can check that the blob data creates a valid image? If anyone has any ideas of how I can debug the data coming out that would be great. Or perhaps someone can point me to somewhere I can get some help?

any pointers are much appreciated!

Greg

p.s here is the code for my Image Viewer!

<%@ WebHandler Language="C#" Class="imageViewer" %>

using System;

using System.Web;

using System.IO;

public class imageViewer : IHttpHandler { public void ProcessRequest (HttpContext context) {product prod = new product(context.Request.QueryString["code"].ToString());
prod.load();

Stream stream = null;
context.Response.ContentType = "image/jpeg";

context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.BufferOutput = false;

int buffersize = 1024;
byte[] buffer = new byte[buffersize];

stream = new MemoryStream(prod.ImageThumb); int count = stream.Read(buffer, 0, buffersize);while (count > 0)
{

context.Response.OutputStream.Write(buffer, 0, count);

count = stream.Read(buffer, 0, buffersize);

}



}



public bool IsReusable {
get {

return false;
}

}

}




 
How was the data stored in the MySQL database.

You may need to write a C# app to pull the MySQL blob data and write the data to the SQL Server.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
ok thanks for the tip -

the data is stored in a blob field, when I open it in the text viewer it says it is binary data (I do not know much about mysql) does this give any more clues?

 
Sounds like it should transfer directly. But I'm not sure. You should try the MySQL forum and see what they say.

If it was me, I'd write the program.

Denny
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / Microsoft Windows SharePoint Services 3.0: Configuration / Microsoft Office SharePoint Server 2007: Configuration)
MCITP Database Administrator (SQL 2005) / Database Developer (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
ok thank you for your advice mrdenny, I will give that a go
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top