Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Problem with inserting IP Addresses into mySQL (2 replies)

$
0
0
I am creating an IPAddress Vault for my apps, each of which is asssigned to some specific piece of h/w.
Ideally the range should be from 192.168.100.mmm all the way to 192.168.900.nnn
So, this is a snippet:

START TRANSACTION;
DROP TABLE IF EXISTS TestIP;
CREATE TABLE TestIP (IPAddress INT UNSIGNED
    , TestBy_ID INT NOT NULL
    , InsertDateTime TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    , PRIMARY KEY (IPAddress)
)   ENGINE=INNODB AUTO_INCREMENT= 10 CHARACTER SET utf8 COLLATE utf8_general_ci;
INSERT INTO TestIP(IPAddress
	, TestBy_ID
	, InsertDateTime)
VALUES(inet_aton('192.168.600.10'), 12345, default);
SELECT inet_ntoa(IPAddress), TestBy_ID, InsertDateTime FROM TestIP
COMMIT;

mySQL workbench cannot insert address range bigger than 192.168.250.mmm, throws following error:
Incorrect string value: ''192.168.260.10'' for function inet_aton, but okay for 192.168.250.10
Weird!

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>