I am trying to process the DSRequest of an image upload and manually add the record to the database. But I get the following timeout and exception.
I am running in development mode using SmartGwt 4.0 Eval nightly build from 2/10.
I am running v 5.5.x of MySQL server. And the table in question here is an isam table.
Shown here is my server side java code to manually put the image in the database. Is there some additional processing that I should be doing here?
Note that when I don't do the DMI processing and just let the SmartGwt server handle the saveData() call from the client then the image
is added to the database successfully.
My datasource
The exception
I am running in development mode using SmartGwt 4.0 Eval nightly build from 2/10.
I am running v 5.5.x of MySQL server. And the table in question here is an isam table.
Shown here is my server side java code to manually put the image in the database. Is there some additional processing that I should be doing here?
Note that when I don't do the DMI processing and just let the SmartGwt server handle the saveData() call from the client then the image
is added to the database successfully.
Code:
public DSResponse onePhotoUploader(DSRequest dsq) throws SQLException { try { ISCFileItem f = dsq.getUploadedFile("imgfile"); InputStream is = dsq.getUploadedFileStream("imgfile"); Map values = new HashMap(); values.put("imgfile", is); values.put("imgfile_filename", f.getFileName()); values.put("imgfile_filesize", f.getSize()); values.put("imgfile_date_created", new Date()); values.put("ser_no", dsq.getValues().get("ser_no").toString()); DSRequest inner = new DSRequest("photoupload", "add"); inner.setValues(values); inner.execute(); } catch (Exception e) { e.printStackTrace(); } DSResponse dsResponse = new DSResponse(); dsResponse.setStatus(0); return dsResponse; }
Code:
<DataSource dbName="Mysql" tableName="photoupload" ID="photoupload" dataSourceVersion="1" generatedBy="8.1/SDK Development Only 2011-08-02" serverType="sql" > <fields> <field name="ser_no" type="text" primaryKey="true"></field> <field name="album_name" length="50" type="text" hidden="true"></field> <field name="caller" length="50" type="text" hidden="true"></field> <field name="signedUser" type="text" hidden="true"></field> <field name="error_msg" length="80" type="text" hidden="true"></field> <field name="imgfile" type="binary" customSQL="true" multiple="true"></field> </fields> <serverObject lookupStyle="new" className="com.bc.ft.server.PhotoAppServer" /> <operationBindings> <binding operationType="fetch" serverMethod="onePhotoUploader"> <serverObject lookupStyle="new" className="com.bc.ft.server.PhotoAppServer" /> </binding> </operationBindings> </DataSource>
Code:
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2427) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2345) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2330) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:102) at com.isomorphic.sql.SQLDriver.doUpdate(SQLDriver.java:750) at com.isomorphic.sql.SQLDriver.update(SQLDriver.java:711) at com.isomorphic.sql.SQLDriver.executeUpdate(SQLDriver.java:824) at com.isomorphic.sql.SQLDataSource.executeNativeUpdate(SQLDataSource.java:455) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1528) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:342) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:294) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1429) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2226) at com.bc.ft.server.PhotoAppServer.onePhotoUploader(PhotoAppServer.java:79) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:972) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2223) at com.isomorphic.sql.SQLDataSource.getLastRow(SQLDataSource.java:574) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1568) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:342) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:294) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1429) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2226) at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216) at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173) at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138) at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097) at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:324) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Comment