Results 1 to 8 of 8

Thread: MySQL Data Type question

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    88

    MySQL Data Type question

    I am attempting to save a string in a MySQL database, that has been generated from an encryption routine (TripleDESEncryption), but I am having trouble finding a data type to store the “string”. Here is a text visulation of the “string” from the encryption process is “捪蜋⦴ꬊ틜玩釯”.

    Within the code (C#), a variable declared as type “string” works fine and I can encrypt and decrypt without error… I just can not store that string for retrieval later.

    Any help is appreciated in advance.
    Last edited by MechEng; Mar 19th, 2009 at 04:39 PM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: MySQL Data Type question

    That looks like unicode, so you need to use a char based datatype that supports unicode.

    I don't know what MySQL calls them, but for SQL Server it is NChar/NVarChar/etc. There may be "wide" in the name/description.

    In terms of putting it into the database, make sure you use parameters - as the encrypted text is likely to (at some point) include escape characters that will cause errors if placed directly into SQL statements.

  3. #3
    Frenzied Member Campion's Avatar
    Join Date
    Jul 2007
    Location
    UT
    Posts
    1,098

    Re: MySQL Data Type question

    The column needs to be declared as 'text'.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    88

    Re: MySQL Data Type question

    I have tried type "Text", "LongText", "blob", and all the other usual suspects. The data types associated with “string” will store the text as “????????”. Type Blob places a big red “X” in the field, but will not store/retrieve the correct value.

    The only data type that begins with “N” in numeric and it also stores/retrieves “????????”.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: MySQL Data Type question

    I'd recommend reading the documentation, particularly 9.1.9:
    http://dev.mysql.com/doc/refman/5.1/...alization.html

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: MySQL Data Type question

    don't confuse the data with the font being used to display the data....

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    88

    Re: MySQL Data Type question

    I am there now trying to figure out which utf8 unicode language to use. This does look like the right area though. thanks

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Aug 2007
    Posts
    88

    Unhappy Re: MySQL Data Type question

    WEll, I can not find an MySql data type that will hold the unicode string. In my reading I have found that there are others with the same problem and most of the solutions revolve around using the convert to a base64 string. I will play around with this a bit more, but I sure could use advice if anyone has direct experience with this. Anyway- thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width