Skip to Content
0
Former Member
Mar 28, 2006 at 12:58 PM

JDBC Access erro in portal

18 Views

Hi.

I made a simple program for accessing Oracle Database using JDBC.

So, I made a data source in Visual Admin and configured it as Native SQL.

My program read binary file and insert BLOB Column in Oracle Database.

When I run it my program, I got below error.

Please help me to fix my problem.

Regards, Arnold.

Error Trace

#----


#1.5#0012799E6E5C00630000000700006AB30004100D7CE63E43#1143550022893#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###java.s

ql.SQLException: Io exception: Broken pipe#

#1.5#0012799E6E5C00630000000800006AB30004100D7CE643A5#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)#

#1.5#0012799E6E5C00630000000900006AB30004100D7CE6442B#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)#

#1.5#0012799E6E5C00630000000A00006AB30004100D7CE644B1#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:334)#

#1.5#0012799E6E5C00630000000B00006AB30004100D7CE64534#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3649)#

#1.5#0012799E6E5C00630000000C00006AB30004100D7CE645B8#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:591)#

#1.5#0012799E6E5C00630000000B00006AB30004100D7CE64534#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TTC7Protocol.java:3649)#

#1.5#0012799E6E5C00630000000C00006AB30004100D7CE645B8#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.ttc7.TTC7Protocol.open(TTC7Protocol.java:591)#

#1.5#0012799E6E5C00630000000D00006AB30004100D7CE6463B#1143550022895#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:581)#

#1.5#0012799E6E5C00630000000E00006AB30004100D7CE646C8#1143550022896#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:

2851)#

#1.5#0012799E6E5C00630000000F00006AB30004100D7CE6474D#1143550022896#System.err#s

ap.com/irj#System.err#HO00518#516##hhied1_ED1_1374850#HO00518#abda4960be5811dac8

530012799e6e5c#SAPEngine_Application_Thread[impl:3]_3##0#0#Error##Plain###

at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatem

ent.java:644)#

#----


My Source Code

#----


package com.sap.portal.test;

import java.io.File;

import java.io.FileInputStream;

import java.sql.Connection;

import javax.naming.InitialContext;

import javax.sql.DataSource;

import com.sapportals.portal.prt.component.AbstractPortalComponent;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

public class DBConnect extends AbstractPortalComponent

{

public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)

{

Connection conn = null;

java.io.FileInputStream rBlob = null;

java.sql.PreparedStatement ps = null;

String fileName = "/tmp/m.jar";

java.io.File fBlob = new File(fileName);

try {

InitialContext ctx = new InitialContext();

DataSource ds = (DataSource) ctx.lookup("jdbc/SAPEPDS");

conn = ds.getConnection();

rBlob = new FileInputStream(fBlob);

ps =

conn.prepareStatement("insert into TMP_VEHICLE (NAME,PICTURE,BINARY) VALUES (?, ?, ?)");

ps.setString(1, "Golf");

ps.setString(2, fileName);

ps.setBinaryStream(3, rBlob, (int) fBlob.length());

ps.executeUpdate();

rBlob.close();

ps.close();

conn.close();

} catch (Exception e) {

e.printStackTrace();

} finally {

try {

rBlob.close();

ps.close();

conn.close();

} catch (Exception e1) {

}

}

}

}

#----