Home » Developer & Programmer » JDeveloper, Java & XML » excepion while running jsp
excepion while running jsp [message #91939] Tue, 04 November 2003 14:41
kashi
Messages: 3
Registered: November 2003
Junior Member
import java.util.*;
import java.io.*;
import java.sql.*;
import javax.servlet.ServletException;
import oracle.jdbc.driver.*;
import oracle.ord.im.OrdDoc;
import oracle.ord.im.OrdHttpUploadFile;
import oracle.ord.im.OrdMediaUtil;

public class fileSave
{

private final static String EMPTY_DOC = "ordsys.ordDoc.init()";

private OracleConnection conn;
private OraclePreparedStatement stmt;
private OracleResultSet rset;

private static Stack connStack = new Stack();
private static boolean driverLoaded = false;

String doc_id;
String to;
String from;
String sub;
String desc;
OrdDoc doc;


public void selectTable() throws SQLException
{
if (conn == null)
{
getConnection();
}
stmt = (OraclePreparedStatement)conn.prepareStatement(
"select * from doc_table");
rset =(OracleResultSet)stmt.executeQuery();
}

public void selectRowByDoc_id(String doc_id) throws SQLException
{
if (conn == null)
{
getConnection();
}
stmt = (OraclePreparedStatement)conn.prepareStatement(
"select * from doc_table where doc_number = ?");
stmt.setString(1, doc_id);
rset = (OracleResultSet)stmt.executeQuery();
}
public boolean fetch() throws SQLException
{
if (rset.next())
{
doc_id = rset.getString(1);
to = rset.getString(2);
from = rset.getString(3);
sub = rset.getString(4);
desc = rset.getString(5);
doc = (OrdDoc)rset.getCustomDatum(6,OrdDoc.getFactory() );
return true;
}
else
{
rset.close();
stmt.close();
return false;
}
}
public void insertNewPhoto(OrdHttpUploadFile uploaddoc)
throws SQLException, ServletException, IOException
{
if (conn == null)
{
getConnection();
}
conn.setAutoCommit(false);
OraclePreparedStatement stmt =
(OraclePreparedStatement)conn.prepareStatement(
"select doc_sequence.nextval from dual" );
OracleResultSet rset = (OracleResultSet)stmt.executeQuery();
if (!rset.next() ) {
throw new ServletException( "new ID not found" );
}
String doc_id = rset.getString( 1 );
rset.close();
stmt.close();

stmt = (OraclePreparedStatement)conn.prepareStatement(
"insert into doc_table(doc_number, to_user, from_user,subject, description, doc)" +
"values(?,?,?,?,?,ORDSYS.ORDDoc.init())");
stmt.setString(1,doc_id);
stmt.setString(2,to);
stmt.setString(3,from);
stmt.setString(4,sub);
stmt.setString(5,desc);
stmt.executeUpdate();
stmt.close();

stmt = (OraclePreparedStatement)conn.prepareStatement(
"select doc from doc_table where doc_number = ? for update");
stmt.setString(1, doc_id);
rset = (OracleResultSet)stmt.executeQuery();
if (!rset.next())
{
throw new ServletException("new row not found in table");
}
doc = (OrdDoc)rset.getCustomDatum(1,OrdDoc.getFactory());
rset.close();
stmt.close();

uploaddoc.loadDoc(doc);

stmt = (OraclePreparedStatement)conn.prepareStatement(
"update doc_table set doc = ? where doc_number = ? ");
stmt.setCustomDatum(1,doc);
stmt.setString(2,doc_id);
stmt.execute();
stmt.close();

conn.commit();
}

public void release() throws SQLException
{
if (rset != null)
{
rset.close();
rset = null;
}

if (stmt != null)
{
stmt.close();
rset = null;
}

if (conn != null)
{
freeConnection(conn);
conn = null;
}
}

public String getDoc_id()
{
return doc_id;
}

public void setDoc_id(String doc_id)
{
this.doc_id = doc_id;
}
public String getTo()
{
return to;
}

public void setTo(String to)
{
this.to = to;
}
public String getFrom()
{
return from;
}

public void setFrom(String from)
{
this.from = from;
}
public String getSub()
{
return sub;
}

public void setSub(String sub)
{
this.sub = sub;
}
public String getDesc()
{
return desc;
}

public void setDesc(String desc)
{
this.desc = desc;
}
public OrdDoc getDoc()
{
return doc;
}

public void setDoc(OrdDoc doc)
{
this.doc = doc;
}

private Connection getConnection()
throws SQLException
{
//Connection conn = null;

synchronized(connStack)
{
if(!driverLoaded)
{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
driverLoaded = true;
}
if (connStack.empty())
{
conn =(OracleConnection)DriverManager.getConnection
("jdbc:oracle:oci8:@", "kashif", "raojee");
try
{
OrdMediaUtil.imCompatibilityInit(conn);
}
catch (Exception e)
{
throw new SQLException(e.toString());
}
}
else
{
conn = (OracleConnection)connStack.pop();
}
}

conn.setAutoCommit(true);
return conn;
}

private void freeConnection(Connection conn)
{
if(conn != null)
{

synchronized(connStack)
{
connStack.push(conn);
}
}
}
}




Exception:
java.sql.SQLException: ORA-00917: missing comma

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java, Compiled Code)
at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java, Compiled Code)
at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java, Compiled Code)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java, Compiled Code)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java, Compiled Code)
at fileSave.insertNewPhoto(filesave.java:69)
at _demo._jsp._docInsert._jspService(_docInsert.java:154)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java, Compiled Code)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java, Compiled Code)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java, Compiled Code)
at oracle.jsp.JspServlet.internalService(JspServlet.java, Compiled Code)
at oracle.jsp.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java, Compiled Code)
at org.apache.jserv.JServConnection.run(JServConnection.java, Compiled Code)
at java.lang.Thread.run(Thread.java:479)
Previous Topic: characterset about jdbc thin drive
Next Topic: New starter trying to use Streaming
Goto Forum:
  


Current Time: Sat Jul 31 16:15:57 CDT 2021