Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Images in .NET - problems with .NET provider

14 posts in General Discussion Last posting was on 2008-11-25 16:16:02.0Z
gchq Posted on 2008-11-17 17:26:27.0Z
Sender: 6266.4921a6b1.846930886@sybase.com
From: gchq
Newsgroups: ianywhere.public.general
Subject: Images in .NET - problems with .NET provider
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4921a943.62b2.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 17 Nov 2008 09:26:27 -0800
X-Trace: forums-1-dub 1226942787 10.22.241.41 (17 Nov 2008 09:26:27 -0800)
X-Original-Trace: 17 Nov 2008 09:26:27 -0800, 10.22.241.41
Lines: 73
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7155
Article PK: 5370

Hi there

Having built a new version of our 'Image-Viewer' I was
surprised to see how slowly it ran! I then wrote another
basic page (without image resizing and other bells and
whistles) and I was surprised to note that if I changed the
connection from the .NET provider to ODBC it made a hell of
a difference - a 1.5Mb image file loaded in 2 seconds
instead of the 30+ seconds with the .NET provider! Any idea
why this might be happening?

Here is the test code

If Not vTable = "" Then
'lookup the image
strSQL = "SELECT " & vImageName & ", " &
vMIMEName & " FROM " & vTable & " WHERE " & vIDName & " = "
& vID
Dim cmd As New OdbcCommand(strSQL, conn)
Try
vData = New DataConn <--- using .NET
Provider
'conn.Open() <---- using ODBC
Using Reader As IDataReader =
vData.ExecuteReader(CommandType.Text, strSQL)

'Using Reader As IDataReader =
cmd.ExecuteReader
While Reader.Read()
vImage = Reader(vImageName)
vMIMEType = Reader(vMIMEName)
End While
End Using


Catch ex As Exception
'Send to a default image
BlankImage()
vData = Nothing
End Try
vData = Nothing
If Not vMIMEType = Nothing Then

Response.ContentType = vMIMEType
'copy file to temp folder
'Dim vFileExtArray As Array =
Split(vMIMEType, "/")
'Dim vFileExt As String = vFileExtArray(1)
'Dim vPath As String =
HttpContext.Current.Server.MapPath("Temp\Temp." & vFileExt)
'Dim objfile As System.IO.File
'Dim vTempFile As New MemoryStream(vImage)
'Dim strSource As Image =
Image.FromStream(vTempFile)
'If objfile.Exists(vPath) Then
'objfile.Delete(vPath)
''End If
'strSource.Save(vPath)
' Dim strDest As String = vPath


Response.BinaryWrite(vImage)
'Display(vPath, vFileExt)
Else
BlankImage()
End If

Else
'Send to a default image
BlankImage()


End If


"Stephen Rice [Sybase]" Posted on 2008-11-18 15:24:18.0Z
From: "Stephen Rice [Sybase]" <srice[at]sybase[dot]com>
Newsgroups: ianywhere.public.general
References: <4921a943.62b2.1681692777@sybase.com>
Subject: Re: Images in .NET - problems with .NET provider
Lines: 93
Organization: Sybase
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4922de22$1@forums-1-dub>
Date: 18 Nov 2008 07:24:18 -0800
X-Trace: forums-1-dub 1227021858 10.22.241.152 (18 Nov 2008 07:24:18 -0800)
X-Original-Trace: 18 Nov 2008 07:24:18 -0800, vip152.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:7156
Article PK: 5375

I'm assuming this is SQL Anywhere...

Turn on request level logging on the server (-zr SQL+HOSTVARS) for each
scenario and see what is being sent to the server. That will give you and
idea if it is some sort of "chattiness" in .net that doesn't exist in odbc.

--
/steve
Stephen Rice, Sybase iAnywhere
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Docs : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swd/base.do
-> Choose SQL Anywhere Studio
-> Set filter to "Display ALL platforms IN ALL MONTHS"

<gchq> wrote in message news:4921a943.62b2.1681692777@sybase.com...
> Hi there
>
> Having built a new version of our 'Image-Viewer' I was
> surprised to see how slowly it ran! I then wrote another
> basic page (without image resizing and other bells and
> whistles) and I was surprised to note that if I changed the
> connection from the .NET provider to ODBC it made a hell of
> a difference - a 1.5Mb image file loaded in 2 seconds
> instead of the 30+ seconds with the .NET provider! Any idea
> why this might be happening?
>
> Here is the test code
>
> If Not vTable = "" Then
> 'lookup the image
> strSQL = "SELECT " & vImageName & ", " &
> vMIMEName & " FROM " & vTable & " WHERE " & vIDName & " = "
> & vID
> Dim cmd As New OdbcCommand(strSQL, conn)
> Try
> vData = New DataConn <--- using .NET
> Provider
> 'conn.Open() <---- using ODBC
> Using Reader As IDataReader =
> vData.ExecuteReader(CommandType.Text, strSQL)
>
> 'Using Reader As IDataReader =
> cmd.ExecuteReader
> While Reader.Read()
> vImage = Reader(vImageName)
> vMIMEType = Reader(vMIMEName)
> End While
> End Using
>
>
> Catch ex As Exception
> 'Send to a default image
> BlankImage()
> vData = Nothing
> End Try
> vData = Nothing
> If Not vMIMEType = Nothing Then
>
> Response.ContentType = vMIMEType
> 'copy file to temp folder
> 'Dim vFileExtArray As Array =
> Split(vMIMEType, "/")
> 'Dim vFileExt As String = vFileExtArray(1)
> 'Dim vPath As String =
> HttpContext.Current.Server.MapPath("Temp\Temp." & vFileExt)
> 'Dim objfile As System.IO.File
> 'Dim vTempFile As New MemoryStream(vImage)
> 'Dim strSource As Image =
> Image.FromStream(vTempFile)
> 'If objfile.Exists(vPath) Then
> 'objfile.Delete(vPath)
> ''End If
> 'strSource.Save(vPath)
> ' Dim strDest As String = vPath
>
>
> Response.BinaryWrite(vImage)
> 'Display(vPath, vFileExt)
> Else
> BlankImage()
> End If
>
> Else
> 'Send to a default image
> BlankImage()
>
>
> End If