SQLite3 Integer Max Value

Regarding the second question:

You can store IP address in DB in 2 ways:

  1. As a String. This is recommended as it will support both IPv4 and IPv6 and does not require no additional hassle with IP address conversions.
  2. As an integer. IP is basically 4 bytes that can all be merged into one integer value. However, do you really want that? That will give you loads of pain converting it to/from string any time it is required.

INTEGER. The value is a signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.

The INTEGER storage class, for example, includes 6 different integer datatypes of different lengths. This makes a difference on disk. But as soon as INTEGER values are read off of disk and into memory for processing, they are converted to the most general datatype (8-byte signed integer).

from http://www.sqlite.org/datatype3.html

Unless you have some other reason not to, you can store IP address using TEXT.


  1. Look at http://www.sqlite.org/datatype3.html Minimum is -(263) == -9223372036854775808 and maximum is 263 - 1 == 9223372036854775807
  2. I would think you should use a varchar
  3. http://www.sqlite.org/lang_attach.html
  4. http://www.sqlite.org/lang_createtable.html
  5. might be of help SQLite 'no such table' error

in general check out the sqlite documentation