我在我的代码中有这个查询。我试图在最后一栏(blob)中将图像归入表格。它显示无效的十六进制数。任何人都能帮我解决这个问题吗?
@ManagedBean(name="userprofile",eager=true)
@SessionScoped
public class Profile {
@ManagedProperty("#{jdbcTemplate}")
public JdbcTemplate jdbcTemplate;
private String firstName,lastName,email,description;
private UploadedFile photo1;
private int contactNumber;
private String insertQry;
public JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public UploadedFile getPhoto1() {
return photo1;
}
public void setPhoto1(UploadedFile photo1) {
this.photo1 = photo1;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getContactNumber() {
return contactNumber;
}
public void setContactNumber(int contactNumber) {
this.contactNumber = contactNumber;
}
public void insertProfile() throws Exception{
InputStream is=photo1.getInputstream();
System.out.println(is);
insertQry="insert into profile
values('"+getFirstName()+"','"+getLastName()+"','"+getContactNumber()+"',
'"+getEmail()+"','"+getDescription()+"','"+utl_raw.cast_to_raw(is)+"')";
System.out.println(insertQry);
int num=jdbcTemplate.update(insertQry);
System.out.println(num);
}
}
任何形式的回应都会提前得到赞赏。
答案 0 :(得分:0)
此错误:
invalid hex number ora-01465
表示您不发送Hexa。
<强>解决方案:强>
请在插入图片之前尝试将InputStream
转换为Hexa
。