1

Im using MYSQL Workbench in my project,while inserting data into a table I got an error Cannot get geometry object from data you send to the GEOMETRY field. The query I use was the following insert into user(user_name,password,type,specialize,f_name,address,phone,email,designation,institute,in_email) values('salini','salu','setter','SE','salini','Sreesailam SRPMPO thazhava karunagappally','8000000000','salureju@gmail.com','HOD','SNT','snt@gmail.com') here the field address has the datatype Multiline String. Is that is the error?? All other fields are int and varchar. How can i solve this?

JJJ
  • 32,902
  • 20
  • 89
  • 102
Salini L
  • 829
  • 5
  • 15
  • 43
  • plz somebody help me to solve this problem – Salini L Aug 10 '13 at 17:49
  • 1
    can you post the results of `describe table user`? It appears from the error message you've posted that one or more columns are spatial-enabled. – Mark Oct 03 '13 at 04:37
  • @MarkS Yes You are correct. She might enabled the Geometry datatype instead of Multiline or something. – ArunRaj Mar 03 '14 at 13:14

1 Answers1

0

Short answer

Addresses in postal format should probably use the varchar data type, since MySQL’s regular text data types are quite capable of storing strings with line breaks, and addresses have a limited length.

Explanation

The multilinestring data type is (counter-intuitively) for storing geometry data, not text data. To store text data, use one of MySQL’s string data types. While two below are the most common, other types do exist for more specialized use cases.

  • varchar for strings up to a certain number of characters long. Specify the max length in parentheses, like varchar(255).
  • text for strings that might take more storage space than MySQL and your database engine would normally allow in a single row.

Storing a string with line breaks in MySQL depends on how you write your queries, and might be as simple as surrounding the string in parentheses and quotes.

Credit to this answer for pointing me in the right direction!

David
  • 1
  • 1