create table user(
the gender varchar (2),
the name varchar(5),
ID varchar (20),
Password varchar (20)
);
I made a table like this
Connection con = null;
PreparedStatement pstmt = null;
String SQL = "insert into user values(?, ?, ?, ?)";
try {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/titleuseSSL=false","title",diviburn);
pstmt = con.prepareStatement(SQL);
pstmt.setString(1, "South");
pstmt.setString(2, "biriri");
pstmt.setString(3, "qlflfl");
pstmt.setString(4, "qlflfl");
int = pstmt.executeUpdate(); System.out.println ("changed row : " + r); }
catch (SQLException e) { System.out.println("[SQL Error : " + e.getMessage() + "]"); }
catch (ClassNotFoundException e) {
// // TODO Auto-generated catch block
e.printStackTrace();
}
When executed in this way, it is transmitted to mysql without error, but if you print it out from workbench, it is gender and name?The data is stored in digits, so what should I do in this case? What about gender?It's saved as one, and the name is saved as ??... If you insert and print it out directly as a query in workbench, it works normally, but if you do jdbc, it looks like that.
Even if you print it out as jdbc, it pops up as ?. If you know the solution, I'd appreciate it if you could help me.
I need to know the set mysql encoding...There's no explanation.If you knew, you wouldn't have asked this question, so I guess it's utf-8.
When setting the jdb curl, add the option below and test it.
jdbc:mysql://localhost:3306/title?useSSL=false&useUnicode=true&characterEncoding=utf8
© 2024 OneMinuteCode. All rights reserved.