3
Hello, I’d like to save one String[]
in Mysql, but I don’t know the type of datatype
that saves String[]
, and what method I use to store this information.
3
Hello, I’d like to save one String[]
in Mysql, but I don’t know the type of datatype
that saves String[]
, and what method I use to store this information.
0
I assume you are using the Java and JDBC language for database access, but it was not very well specified.
But you can do something like this: String[] array = { "java", "JDBC", "Hibernate" };
String vectorString = Arrays.toString(array); //a string will be: [java, JDBC, Hibernate]
Then save the String vector in the database as VARCHAR type. It is an option, but I advise to study about ORM and object persistence.
And when taking from the Database, how to turn into String[] again ??
Browser other questions tagged java mysql
You are not signed in. Login or sign up in order to post.
Have you studied about JDBC, Hibernate or some way to integrate java code with DBMS?
– Roknauta
@Douglas no, not yet.
– Lucas Caresia
I recommend studying about it. It is no secret, but it will be better for you :)
– Roknauta
Has some specific content about String[] ??
– Lucas Caresia
As I explained to you, it is better to read it, because it is a very complex area. :)
– Roknauta
@Lucascarezia I would particularly save in the bank as a single table, separated each Dice from the array by a comma in the bank. Example: value1,value2,Valor3.
– Matheus
Since array is an attribute with multi-valued data, ideally you would have a separate table for each array information, where each tuple would have the foreign key referencing who holds the array.
– Paulo Weverton