java.sql.SQLException: No more data to read from socket
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Sunday, January 7, 2007 02:40 AM

i'm receiving this exception runing my program. my code is as below: public void insertDB() throws SQLException { // dbThread = new Thread(new Runnable(){ // public void run() //{ final String docName = acc; try { System.out.println("insertDB before connection"); getConnected(); System.out.println("insertDB after connection"); st=con.createStatement(); //String docName = acc; String text = formatFree; //String formatted = finalText; //con.setAutoCommit(false); commented String qry = "INSERT INTO DOCUMENT VALUES('"+docName+"','"+text+"','"+formatted+&   More>>

i'm receiving this exception runing my program. my code is as below:


public void insertDB() throws SQLException
{
// dbThread = new Thread(new Runnable(){

// public void run()
//{
final String docName = acc;
try
{

System.out.println("insertDB before connection");
getConnected();
System.out.println("insertDB after connection");
st=con.createStatement();
//String docName = acc;

String text = formatFree;
//String formatted = finalText;
//con.setAutoCommit(false); commented
String qry = "INSERT INTO DOCUMENT VALUES('"+docName+"','"+text+"','"+formatted+"','"+uiid+"')";
//String qry="INSERT INTO DC_IMAGETESTRESULT(ACCESSION_NO,RADIOLOGICAL_FINDING) values('"+acc+"','"+finds+"')"; commented
System.out.println("parentqry"+qry);
int ok=0;

ok=st.executeUpdate(qry);

if(ok==1)
{
con.commit();
con.close();

System.out.println("INSERTION SUCCESS= "+ok);
System.out.println("Image List Size"+ imgList.size());


// inserting into child
dbThread = new Thread(new Runnable(){

public void run()
{

for(int i=0;i
{
try
{


getConnected();
// st = con.createStatement();
System.out.println("New Connection");
//con.setAutoCommit(false);
String imgPath = ""+imgList.get(i);
System.out.println("db"+imgPath);

FileInputStream fin = new FileInputStream(imgPath);
BufferedInputStream bufStr = new BufferedInputStream(fin);
byte[] imgByte = new byte[bufStr.available()];

//int imgID = i;
String img = "" + imgNameList.get(i);

System.out.println("imgid="+i);

PreparedStatement ps = null;

ps = con.prepareStatement("INSERT INTO DOCIMAGE VALUES(?,?,?)");
ps.setString(1,docName);
ps.setString(2,img);
ps.setBinaryStream(3, bufStr, (int) imgByte.length);

ps.execute();

// dbThread.sleep(100);

ps.close();

//con.commit();
con.close();
}catch(Exception ex)
{
System.out.println(ex.toString());
}


}
}
});
dbThread.start();

}
else
{

System.out.println("INSERTION NOT SUCCESS");
}


}catch(Exception err){

System.out.println(err.toString());
}



/* }
});
dbThread.start(); */
}






if the program is run independent of oracle form, it runs fine..but problem is when it's run from oracle form. if anyone has idea to get around this please let me know...i've been suffering a lot with this.


regards

rashed>    <<Less

Re: java.sql.SQLException: No more data to read from socket

Posted By:   WarnerJan_Veldhuis  
Posted On:   Sunday, January 7, 2007 06:57 AM

I can't read this. Try posting code between
 tags
About | Sitemap | Contact