Hi, Im trying to write a java program that store binary data into sapdb.
I did create table with long byte. complete sql statement as follow:
create table blobtst (col1 varchar(128), a long byte)

However, when I execute the program after several insertion 
the program stop into sleeping mode.

Could anyone tell me what is wrong with this code or am I missing something while 
preparing blob in sapdb ?

I tried to trace it, and it show something with pooling.
is this related to connection to database ?

Thank you.

-aryo-

ps. sapdb is running on Linux and Solaris both are exact problem
    size of binary data is about 4.1MB

import java.sql.*;
import java.io.*;

public class Testing {

  public Testing() {}
  
  static Connection connection = null;
  static String user = "test";
  static String password ="test";
  static String url = "jdbc:sapdb://dbserver/TESTDB";

   public static void main(String[] args) throws Exception, IOException, SQLException {
     try {
       Class.forName ("com.sap.dbtech.jdbc.DriverSapDB");
     }catch(ClassNotFoundException c){
       c.printStackTrace();
     }
     Testing t = new Testing();
     t.insertBlob(args[0]);
   }

  
  public static void insertBlob(String fileName) {
    try {
      connection = DriverManager.getConnection (url, user, password);
      connection.setAutoCommit(false);
      PreparedStatement pstmt = connection.prepareStatement("insert into blobtst 
values (?,?)");
      java.io.File File = new java.io.File(fileName);
      java.io.FileInputStream fis = new java.io.FileInputStream(File);
      pstmt.setString(1,fileName);
      pstmt.setBinaryStream(2, fis, (int)File.length());
      pstmt.executeUpdate();
      connection.commit();
      connection.setAutoCommit(true);
      pstmt.close();
      connection.close();
    }catch(SQLException e){
      e.printStackTrace();
    }catch(IOException e){
          e.printStackTrace();
    }
  }
}







_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to