473,587 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5996
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.c omwrote in message
news:7e******** *************** ***********@p73 g2000hsd.google groups.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.netNoS pamMwrote:
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.c omwrote in message

news:7e******** *************** ***********@p73 g2000hsd.google groups.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.c omwrote in message
news:a3******** *************** ***********@y77 g2000hsy.google groups.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.netNoS pamMwrote:
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.c om>
wrote in message

news:7e******** *************** ***********@p73 g2000hsd.google groups.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
2097
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 to GPS (For Almanac Downloading) and I'm obtaing some data in terms of bytes. So, Please help me to translate this data into Hex format so that...
4
2402
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 = PgSQL.connect('server:port:database:username:password') cur = connectdb.cursor()
0
1394
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
5490
by: lglmi | last post by:
'********************START OF BAS MODULE******************** Option Explicit Private Type OSVERSIONINFO dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long
1
1659
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 converting this code from Access. Any ideas? Thanks! byte imageData = (byte)(command.ExecuteScalar()); MemoryStream ms = new...
0
2649
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 postgres database .. (as
3
4431
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 decided that the most effective way would be : When i connect to the server once, I download the list and disconnect, instead of connecting every time...
0
1518
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 to a NFS mount point (where they will be copied to TSM) and remove them from the active log directory. Thoughts?
2
4356
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. The binary data is how they send numbers (they call it "Big Endian"). I only know at run time whether a byte is going to be text or binary (one of the...
7
4237
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 like 0-7 bits as integer value to a
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7843
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6621
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.