Getting Byte[] data with MySQL -Cast(... AS BINARY)

This is a discussion on Getting Byte[] data with MySQL -Cast(... AS BINARY) within the MySQL Database forums, part of the Database Forums category; Hi, I am trying to get (and transfer over ASP.NET) some encrypted data from some MySQL fields. Since the ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-06-2008
ist
 
Posts: n/a
Default Getting Byte[] data with MySQL -Cast(... AS BINARY)

Hi,

I am trying to get (and transfer over ASP.NET) some encrypted data
from some MySQL fields. Since the data contains many unicode
characters, I tried to get the data as a series of ASCII values,
transfer those numeric values over ASP.NET. I had no problem doing
this on my local computer, by getting the field with "cast(field as
BINARY)" so that on ASP.NET I have a byte[] array.Then send every
field of array over ASP.Net.

However when I upload application to remote server, "cast(field as
BINARY)" returns field data as String type. I have tried many ways to
convert this string data to byte array, however data always become
corrupted. So I have to get data as a byte array directly from MySQL.

As I've said, I had no problem doing this on my local computer,
however, on my local computer I was connecting to same computer using
same driver (MySQL Odbc 3.51), so when I upload the ASP.NET page to
remote server, ONLY thing that is changing is location and -maybe-
ASP.NET version (I am sure both are ASP.NET 2 , maybe different
builds)

So, the bottom line is: I am trying to get MySQL data as byte[] type,
on local web server I have no problem, on remote web server
(connecting to SAME MySQL Server) I get data as String, instead of
Byte[]. How can I achieve same result on remote server?
Reply With Quote
  #2 (permalink)  
Old 03-06-2008
Cowboy \(Gregory A. Beamer\)
 
Posts: n/a
Default Re: Getting Byte[] data with MySQL -Cast(... AS BINARY)

First, let's step back. You are using encrypted data, which means you have
char > 255. This was a problem in traditional ASP, but should not be a
problem in ASP.NET, as strings are Unicode by default. I have not played
extensively with MySQL, so I cannot be completely sure, but I have done
extensive work with encryption in other databases, requiring no need to pull
as binary.

I would try pulling the string out straight rather than running from string
to byte[] and back to Unicode string.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"ist" <saygin@gmail.com> wrote in message
news:7ed964cd-9a3e-4c64-91f1-c601a2080fde@p73g2000hsd.googlegroups.com...
> Hi,
>
> I am trying to get (and transfer over ASP.NET) some encrypted data
> from some MySQL fields. Since the data contains many unicode
> characters, I tried to get the data as a series of ASCII values,
> transfer those numeric values over ASP.NET. I had no problem doing
> this on my local computer, by getting the field with "cast(field as
> BINARY)" so that on ASP.NET I have a byte[] array.Then send every
> field of array over ASP.Net.
>
> However when I upload application to remote server, "cast(field as
> BINARY)" returns field data as String type. I have tried many ways to
> convert this string data to byte array, however data always become
> corrupted. So I have to get data as a byte array directly from MySQL.
>
> As I've said, I had no problem doing this on my local computer,
> however, on my local computer I was connecting to same computer using
> same driver (MySQL Odbc 3.51), so when I upload the ASP.NET page to
> remote server, ONLY thing that is changing is location and -maybe-
> ASP.NET version (I am sure both are ASP.NET 2 , maybe different
> builds)
>
> So, the bottom line is: I am trying to get MySQL data as byte[] type,
> on local web server I have no problem, on remote web server
> (connecting to SAME MySQL Server) I get data as String, instead of
> Byte[]. How can I achieve same result on remote server?



Reply With Quote
  #3 (permalink)  
Old 03-07-2008
ist
 
Posts: n/a
Default Re: Getting Byte[] data with MySQL -Cast(... AS BINARY)

Hi,
I've 'played' with some MySQL connection properties (Character set,
collation etc.), and converted String data to byte array at ASP.NET
side ('played' here with some combinations too) and got a good result
for now. Thanks..



On 6 Mart, 16:44, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> First, let's step back. You are using encrypted data, which means you have
> char > 255. This was a problem in traditional ASP, but should not be a
> problem in ASP.NET, as strings are Unicode by default. I have not played
> extensively with MySQL, so I cannot be completely sure, but I have done
> extensive work with encryption in other databases, requiring no need to pull
> as binary.
>
> I would try pulling the string out straight rather than running from string
> to byte[] and back to Unicode string.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> *************************************************
> | Think outside the box!
> |
> *************************************************" ist" <say...@gmail.com> wrote in message
>
> news:7ed964cd-9a3e-4c64-91f1-c601a2080fde@p73g2000hsd.googlegroups.com...
>
>
>
> > Hi,

>
> > I am trying to get (and transfer over ASP.NET) some encrypted data
> > from some MySQL fields. Since the data contains many unicode
> > characters, I tried to get the data as a series of ASCII values,
> > transfer those numeric values over ASP.NET. I had no problem doing
> > this on my local computer, by getting the field with "cast(field as
> > BINARY)" so that on ASP.NET I have a byte[] array.Then send every
> > field of array over ASP.Net.

>
> > However when I upload application to remote server, "cast(field as
> > BINARY)" returns field data as String type. I have tried many ways to
> > convert this string data to byte array, however data always become
> > corrupted. So I have to get data as a byte array directly from MySQL.

>
> > As I've said, I had no problem doing this on my local computer,
> > however, on my local computer I was connecting to same computer using
> > same driver (MySQL Odbc 3.51), so when I upload the ASP.NET page to
> > remote server, ONLY thing that is changing is location and -maybe-
> > ASP.NET version (I am sure both are ASP.NET 2 , maybe different
> > builds)

>
> > So, the bottom line is: I am trying to get MySQL data as byte[] type,
> > on local web server I have no problem, on remote web server
> > (connecting to SAME MySQL Server) I get data as String, instead of
> > Byte[]. How can I achieve same result on remote server?- Alıntıyı gizle -

>
> - Alıntıyı göster -


Reply With Quote
  #4 (permalink)  
Old 03-07-2008
Cowboy \(Gregory A. Beamer\)
 
Posts: n/a
Default Re: Getting Byte[] data with MySQL -Cast(... AS BINARY)

Glad you found an answer that works. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"ist" <saygin@gmail.com> wrote in message
news:a3590367-7334-4710-b3a8-239a96447c6d@y77g2000hsy.googlegroups.com...
Hi,
I've 'played' with some MySQL connection properties (Character set,
collation etc.), and converted String data to byte array at ASP.NET
side ('played' here with some combinations too) and got a good result
for now. Thanks..



On 6 Mart, 16:44, "Cowboy \(Gregory A. Beamer\)"
<NoSpamMgbwo...@comcast.netNoSpamM> wrote:
> First, let's step back. You are using encrypted data, which means you have
> char > 255. This was a problem in traditional ASP, but should not be a
> problem in ASP.NET, as strings are Unicode by default. I have not played
> extensively with MySQL, so I cannot be completely sure, but I have done
> extensive work with encryption in other databases, requiring no need to
> pull
> as binary.
>
> I would try pulling the string out straight rather than running from
> string
> to byte[] and back to Unicode string.
>
> --
> Gregory A. Beamer
> MVP, MCP: +I, SE, SD, DBA
>
> *************************************************
> | Think outside the box!
> |
> *************************************************" ist" <say...@gmail.com>
> wrote in message
>
> news:7ed964cd-9a3e-4c64-91f1-c601a2080fde@p73g2000hsd.googlegroups.com...
>
>
>
> > Hi,

>
> > I am trying to get (and transfer over ASP.NET) some encrypted data
> > from some MySQL fields. Since the data contains many unicode
> > characters, I tried to get the data as a series of ASCII values,
> > transfer those numeric values over ASP.NET. I had no problem doing
> > this on my local computer, by getting the field with "cast(field as
> > BINARY)" so that on ASP.NET I have a byte[] array.Then send every
> > field of array over ASP.Net.

>
> > However when I upload application to remote server, "cast(field as
> > BINARY)" returns field data as String type. I have tried many ways to
> > convert this string data to byte array, however data always become
> > corrupted. So I have to get data as a byte array directly from MySQL.

>
> > As I've said, I had no problem doing this on my local computer,
> > however, on my local computer I was connecting to same computer using
> > same driver (MySQL Odbc 3.51), so when I upload the ASP.NET page to
> > remote server, ONLY thing that is changing is location and -maybe-
> > ASP.NET version (I am sure both are ASP.NET 2 , maybe different
> > builds)

>
> > So, the bottom line is: I am trying to get MySQL data as byte[] type,
> > on local web server I have no problem, on remote web server
> > (connecting to SAME MySQL Server) I get data as String, instead of
> > Byte[]. How can I achieve same result on remote server?- Alıntıyı
> > gizle -

>
> - Alıntıyı göster -



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:26 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0