Forums Register Login

Getting java.sql.SQLException: ORA-01465: invalid hex number

+Pie Number of slices to send: Send
Please help me, i am getting this error when i am converting String in to byte[] and inserting in to database of column type BLOB.
My code is like this,
String name = "some text";
byte[] byte = name.getBytes();
System.out.println(byte); \\ here i am getting like this [B@63e563

So, whenever i am trying to insert it into db column of type BLOB i am getting the following error

ORA-01465: invalid hex number
; nested exception is java.sql.SQLException: ORA-01465: invalid hex number

Caused by: java.sql.SQLException: ORA-01465: invalid hex number

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1688)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1654)
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:368)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:342)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:375)
at com.dbxcel.webapp.action.ClassName.testNote(ClassName.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
1
+Pie Number of slices to send: Send
Mahi Rao,
Welcome to JavaRanch.

The official explanation by oracle is

ORA-01465: invalid hex number
Cause: In an UPDATE statement following a SELECT FOR UPDATE, part of the ROWID contains invalid characters. ROWID must be expressed in the proper and expected format for ROWID and within quotes.
Action: Enter the ROWID just as it was returned in the SELECT FOR UPDATE.



Seems, you got some problem with the id you are using.

Also, if it doesn't work try inserting using a prepared statement. In the prepared statement set the id and blobfile. This will disallow any discrepancy in id field.

Hope that helps
+Pie Number of slices to send: Send
Anubhav,
Can you send me any example piece of code?
+Pie Number of slices to send: Send
An example can be like :


[ April 03, 2008: Message edited by: Anubhav Anand ]
+Pie Number of slices to send: Send
thanks Anubhav
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 26696 times.
Similar Threads
integration test via AbstractTransactionalDataSourceSpringContextTests
Hibernate mapping in Spring - Getting Exception
Exception when having different class and table name
DBUnit ...looading data to database getting error of integrity constraint
JDBC Connection
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:01:59.