插入十六进制值mysql [英] Inserting hex value mysql
问题描述
我已经使用Java创建了一个sql数据库,对于sql来说我是一个菜鸟,但是 有配置和设置它,我创建了一个表,该表有两列,第一列是 一个递增的大整数,第二个我尝试将其定义为char,varchar和binary,但我仍未获得所需的功能,例如我尝试将0a存储为十六进制数 char列出现错误,我将0x附加到开头似乎存储了,但是当我打印出内容为空白时,或者在某些情况下,我得到了诸如'/'或'?'之类的字符,我也尝试过使用sql Explorer,它在查看表时也得到相同的结果,
I have created an sql database using Java, I am a noob when it comes to sql but have it configured and set up, i have a table created which has two columns, the first being a big integer which increments, the second I have tried defining it as a char, varchar and binary but im still not getting the desired function, say i try and store 0a a hex number into the char column i get an error, i appended 0x to the beginning a it seems to store, but when i print out the contents it is blank or in some cases i get characters such as '/' or '?', I also tried using sql explorer and it gives me the same result viewing the table,
我的问题是我需要存储一个八个字符的十六进制字符串,例如eb8d4ee6.
My problem is i need to store an eight character hex string such as eb8d4ee6.
有人可以告诉我如何做到这一点吗?
Could someone please advise me of how this can be done?
推荐答案
在这里,我经常引用一篇很棒的博客文章,以提醒自己有关十六进制值和二进制字段的正确处理,并提出了一些性能方面的建议.
Here's a great blog post I always refer to to remind myself of the proper handling of hex values and binary fields, and lays out some performance implications.