473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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

ist
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?
Mar 6 '08 #1
3 5982
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" <sa****@gmail.comwrote in message
news:7e**********************************@p73g2000 hsd.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?

Mar 6 '08 #2
ist
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.netNoSpamMwrote:
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.comwrote in message

news:7e**********************************@p73g2000 hsd.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 -
Mar 7 '08 #3
Glad you found an answer that works. :-)

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

*************************************************
| Think outside the box!
|
*************************************************
"ist" <sa****@gmail.comwrote in message
news:a3**********************************@y77g2000 hsy.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.netNoSpamMwrote:
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:7e**********************************@p73g2000 hsd.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 -

Mar 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Langen R. M. | last post by:
I'm writing my own GPS12XL data downloading program in VB, I know there are several program out there, But my aim is to go further onto Generating Rinex Files. Till now, I'm able to to send data...
4
by: projecktzero | last post by:
Well, I've managed to get an image into a postgre database, but now I'm having trouble getting it out. #! /usr/bin/env python from pyPgSQL import PgSQL def main(): connectdb =...
0
by: Stefan | last post by:
Hi! I'm interested in which one is better for performance issues? The binary distribution or a self compiled one? Thanks for your answers. Stefan
0
by: lglmi | last post by:
'********************START OF BAS MODULE******************** Option Explicit Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long...
1
by: NathanV | last post by:
I have a stored procedure that returns the binary representation of an image from a SQL Server db. The following code returns an "Invalid parameter" error on the System.Drawing... line. I am...
0
by: Goutam Paruchuri | last post by:
Hello, 2 questions ! Question 1 Iam trying to load binary data from sql server to postges. Do i have to write a script .. ?? Question 2 How i do load text data with newlines into...
3
by: piotrek | last post by:
Hi I would like to ask you a question. Ian creating app. that download from server directory structure ( whole tree ) and those data are placed in proper places into my treeview control. I...
0
by: LGR | last post by:
I am taking backups of my databases with mysqlhotcopy. MySQL keeps all binary logs. I only need the most recent binary logs after the backups to do forward recovery. I would like to copy all logs...
2
by: DBuss | last post by:
OK, I'm reading a multicast socket. It attaches fine, reads fine, all of that. The problem is that while some of the data I get is normal text (ASCII String), some of it is Binary Integer. ...
7
by: vikuba | last post by:
HI I'm new to this forum I'm having a peculiar problem I'm trying to read a 64 bit data binary file I have 5 integer variables a b c d e the problem is I have to read the 64 bit data ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.