java - How does resultSet store values -


I am running a query that is loaded in a ResultSet. When I am creating my object from ResultSet, I use different method of result result. As a result, all the values ​​are stored as strings, whether they are defined in DB or not? So if the result of a query is 1 number, can I call

  rs.getString ("Result"); And rs.getInt ("Result");   

?

Or should the result be a true type of suit?

What is important here is the type of variable that will get the value obtained. For example,

, you come back without any problems RskgetString () can be used in a column that numbers valid string values ​​that ( "1234", "23.45", etc.) Are there.

But you can not use rs.getInt () in the column with string values, because the returned value will not be valid for a full variable.

MySQL Help More information:

In general, can be converted to java.lang.String any MySQL data type, and any numeric types can be converted

these Mais SQL data types can always be converted to these Java types:

      Li>

      CHAR, VARCHAR, BLOB, text, ENUM, and SET : java.lang.String, java.io.InputStream, java.io.Reader, java.sql.blob, java .sql .lob

    • Float, real, double exact, numeric, d Simal, Tininet, Smalling, Medimum, Intepr, begin : java.lang string, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Double, java.math.bigDecimal

    • dATE, TIME, DATETIME, TIMESTAMP : Jawaklangkstring, Jawaksklkdet, Jawaksklktimstmp



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -