다음 코드를 사용하여 데이터베이스에 파일을 업로드합니다. 코드는 이미지와 함께 정상적으로 작동합니다. 다른 파일의 경우 작동하지 않습니다. 마지막으로 스택 추적을 게시합니다.데이터베이스에 파일을 업로드 할 수 없습니다.
내 두 번째 값은 BLOB에게 있습니다
String strFilePath = null;
Hashtable<Object,Object> fileTable = null;
InputStream input = null;
CosUploadFile file = null;
fileTable = multiPartFormData.getFiles();
file = (CosUploadFile)fileTable.get("filepath");
input =file.getInpuStream();
prepare = connection.prepareStatement("insert into all_files values(?,?,?)");
prepare.setString(1, strFileSplit[0]);
prepare.setBinaryStream(2,input);
prepare.setString(3,strFileSplit[1]);
prepare.execute();
오류 :
J2CA0206W: A connection error occurred. To help determine the problem, enable the Diagnose Connection Usage option on the Connection Factory or Data Source.
J2CA0056I: The Connection Manager received a fatal connection error from the Resource Adapter for resource datasource. The exception is: java.sql.SQLRecoverableException: Io exception: Connection reset by peer: socket write error:java.net.SocketException: Connection reset by peer: socket write error
com.ibm.websphere.ce.cm.StaleConnectionException: Io exception: Connection reset by peer: socket write error
이 나는 문서 파일을 업로드하기 위해 노력하고있어 동안 스택 추적입니다. 어떻게해야합니까?
편집 : 다음 내 연결 코드
DBConnect dbConnect = new DBConnect();
Connection connection = dbConnect.connect();
DbConnect 클래스
public Connection connect()
{
Connection con = null;
try
{
InitialContext context = new InitialContext();
DataSource datasource = (DataSource)context.lookup("datasource");
con = datasource.getConnection("TRAIN2012", "xyz123");
return con;
}
Oracel 데이터베이스에 연결 하시겠습니까? 다른 데이터베이스는 무엇입니까? – bonCodigo
이미지 나 기타 파일을 저장하는 경우에는 차이가 발생하지 않습니다. 코드 한 번에 하나의 파일 만 테스트하십시오. – Kai
오라클의 얇은 드라이버 10 – sagar