• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

ORA-01460: unimplemented or unreasonable conversion requested

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am going to insert/retrieve image in database

table:

create table MyPictures (
id INT PRIMARY KEY,
name VARCHAR(11),
myphoto BLOB
)

my java class

public class InsertPictureToOracle {
public static void main(String[] args) throws Exception, IOException, SQLException {
Connection conn = null;
DBUtils.loadDriver();
conn = DBUtils.fetchConnection();
FileInputStream fis = null;
PreparedStatement ps = null;
Statement stmt = null;
String INSERT_PICTURE = "insert into MyPictures(id, name, myphoto) values (?, ?, ?)";
System.out.println("i am here");
try {
conn.setAutoCommit(false);
File file = new File("com/cisco/wipro/dca/GAJANANBABA.jpg");
fis = new FileInputStream(file);
ps = conn.prepareStatement(INSERT_PICTURE);
ps.setString(1, "001");
ps.setString(2, "psm");
ps.setBinaryStream(3, fis, (int) file.length());
System.out.println("i am there");
ps.executeUpdate();

conn.commit();
System.out.println("insert image successfully");
ResultSet rs =stmt.executeQuery("select myphoto from MyPictures where id=001");
byte[] imgbytes=null;
if(rs.next()) {
imgbytes=rs.getBytes(1);
}
rs.close();
System.out.println("populate image successfully");
} catch(Exception SQLexp){
SQLexp.printStackTrace();
System.out.println("Exception while interacting with the database " + SQLexp);
} finally {
DBUtils.closeConnection(conn);
try {
stmt.close();
} catch(Exception e) {
e.printStackTrace();
}

}

i am getting following error:

ORA-01460: unimplemented or unreasonable conversion requested

please help
 
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i am getting following error:

ORA-01460: unimplemented or unreasonable conversion requested

At which line do you get the error?

Regards, Jan
 
Pradeep
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got error in following line


ps.executeUpdate();
 
Jan Cumps
Bartender
Posts: 2653
18
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For several users, this was solved by getting the latest jdbc driver.
See these links:
http://forums.oracle.com/forums/thread.jspa?messageID=1808509
http://forum.java.sun.com/thread.jspa?threadID=5164500&tstart=255

Regards, Jan
 
Pradeep
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks

i solved that error

now i am getting following error when try to insert big size image


ORA-01461: can bind a LONG value only for insert into a LONG column
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
I have a problem whit a stored procedure. I would like to insert blob data into a database. For this reason i have created a procedure. This is my procedure:

CREATE OR REPLACE PROCEDURE load IS
l_bfile BFILE;
l_blob BLOB;
BEGIN
INSERT INTO SCR_REPORTS(ID, REPORT, TYPE_REPORT, TYPE_ARCH, ALL_ARCH, ALL_OFICS, ALL_PERFS,DESCRIPTION, DATA)
VALUES (11, '103.zip', 1, 1, 1, 1, 1, 'RelaciĆ³n diaria por destino del registro de entrada', empty_blob())
RETURN DATA INTO l_blob;

l_bfile := BFILENAME('C:\Documents and Settings\hernandezga\Escritorio\SIGEM_Ayto.Z\ZIP_Reports', '9_614CBEB75C5C3BF42E9A716686F15984_1233036294172_1233036397698.zip');
DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
DBMS_LOB.loadfromfile(l_blob,l_bfile,DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);

COMMIT;

EXCEPTION WHEN OTHERS THEN
ROLLBACK;
RAISE;
END;

When I execute this I have encountered an exception. The error is in line DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly); and this says that:

ORA-00604: error occurred at recursive SQL level string
ORA-01460: unimplemented or unreasonable conversion requested
ORA-06512: "POSTGRES.LOAD", line 19
ORA-06512: line 2

If i look, in debug mode, where is the error, I can see this, when I find the expression DBMS_LOB:
undeclared identifier 'DBMS_LOB'

Can someone help me?

Thank you very much!!

Bye
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I'm also facing the same problem.

When I try to insert a blob data of size 3kb its inserting fine.
But when the size increase to just 7 kb its giving error that

ORA-01460: unimplemented or unreasonable conversion requested

String sql = "insert into table_name(column1column2,column3,column4,column5) values(?,?,?,?,?)";

PreparedStatement stmt;
try {
stmt = con.prepareStatement(sql);

stmt.setString(1, "test1");
stmt.setString(2, "test2");
stmt.setString(3, "test3");

File image = new File("D:\\test.bmp");//file size is 128kb
FileInputStream fis = new FileInputStream(image);
stmt.setBinaryStream(4, fis, (int) image.length());
stmt.setString(5, "test5");
stmt.executeUpdate();

System.out.println("inserted the text file");

fis.close();

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Has anyone found a solution for this problem of: java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!