how can store .gif into oracle ?
843833Oct 6 2001 — edited Nov 14 2002Hai,
when i am inserting .gif file into oracle,i getting the sql error message at run time like java.sql.sqlException [oracle][odbc]No data at execution values pending.
I have placed a valid .gif file path ,while i have creating file objct.
i have used below the coding to insert .gif into oracle,
Demox.java
public class Demox
{
public static void main(String x[])
{
ResultSet rs;
Connection con;
Statement st,st1;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:mydsn","scott","cipl");
st=con.createStatement();
File file = new File("c:/mahesh/oracle.gif");
System.out.println("file cotent is"+file);
InputStream inStream = new FileInputStream(file);
System.out.println("before prepstmt");
PreparedStatement psmt =con.prepareStatement("INSERT INTO + demo(id,pict)VALUES(?,?)");
psmt.setString(1, "Logo");
psmt.setBinaryStream(2, inStream, (int)file.length());
psmt.execute();
//HRER ONLY I GOT THE ERROR MSG LIKE [oracle][odbc]No data at execution values pending.//
System.out.println("after execute");
if(psmt != null)
psmt.close();
if(con != null)
con.close();
}
catch(Exception q)
{System.out.println("Hai:"+q);}
}}
In database i have used long raw datatpe to store .gif file,meanwhile
I have tried blob as datatype to store .gif,still i got the same exception
:[oracle][odbc]No data at execution values pending....
So,any one could me out from this probs.It's little bit urgent....
Regards,
mahesh.