Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite database supporting Unicode data

Tags:

sqlite

I'm using java swing application which needs unicode string to drag into jtable.Is it possible to store unicode data in SQLITE database? If so,which SQLite does support unicode..I need free sqlite not the premium..

like image 281
user2881444 Avatar asked Oct 16 '13 01:10

user2881444


People also ask

What is a Unicode database?

A Unicode database is a database with a UTF-8 character set as the database character set. There are three Oracle character sets that implement the UTF-8 encoding. The first two are designed for ASCII-based platforms while the third one should be used on EBCDIC platforms.

What data model does SQLite use?

Most SQL database engines (every SQL database engine other than SQLite, as far as we know) uses static, rigid typing. With static typing, the datatype of a value is determined by its container - the particular column in which the value is stored. SQLite uses a more general dynamic type system.

Is Unicode a data type?

Unicode Data Types. Data types nchar, nvarchar, and long nvarchar are used to store Unicode data. They behave similarly to char, varchar, and long varchar character types respectively, except that each character in a Unicode type typically uses 16 bits.

Is SQLite human readable?

You can't. SQLite database files are binary files, not text files. Opening them in a text editor will only produce semi-readable results because not all bytes (or sequences of bytes) represent valid characters regardless of the character encoding.


1 Answers

SQLite always stores text data as Unicode, using the Unicode encoding specified when the database was created. The database driver itself takes care to return the data as the Unicode string in the encoding used by your language/platform.

If you have conversion problems, either your application tried to store an ASCII string without converting it to Unicode, or you tried to read one value and force a conversion on it.

SQLite uses a kind of dynamic typing, where each value is stored using a specific storage class. A column's type specifies the affinity or how the value is treated. For example:

A column with NUMERIC affinity may contain values using all five storage classes. When text data is inserted into a NUMERIC column, the storage class of the text is converted to INTEGER or REAL

There are five storage classes, NULL, INTEGER, REAL, TEXT, BLOB. TEXT stores string data using the Unicode encoding specified for the database (UTF-8, UTF-16BE or UTF-16LE).

What specific problem are you facing, or is this a general question?

like image 169
Panagiotis Kanavos Avatar answered Nov 05 '22 16:11

Panagiotis Kanavos