cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to upload file to KM using AbstractPortalComponent, getting error

Former Member
0 Kudos

Hey,

I've been following this guide to uploading a file to KM: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70a60afe-d576-2a10-68bf-9ce3988dc...

and the content displays correctly, but when I try to upload a file I get the following error:

Cannot assign a java.lang.String object of length 65 to host variable 4 which has JDBC type VARCHAR(50).  

I have no idea where to even start with troubleshooting this so any help would be greatly appreciated

Thanks,

Tom

Accepted Solutions (1)

Accepted Solutions (1)

Ryan-Crosby
Active Contributor
0 Kudos

Hi Tom,

If I had to guess it looks like it's failing because you have a string with length 65 that the application is trying to store into a database where the size is only reserved for 50 characters.  What is your file name in this instance maybe?

Regards,

Ryan Crosby

Former Member
0 Kudos

This is what I thought originally with the filename as the path was originally way longer than 50 characters. I then tested it with a new file with the full path C:\test.xlsx and still get the same error.

Ryan-Crosby
Active Contributor
0 Kudos

Hi Tom,

I'm not referring to local file name length on the client, but the filename that is generated on the server in the jspDynPage.  I would expect that the filename on the server would be the one that is potentially longer than the apparent 50 character limit.  Some simple changes to the JSP page to output the filename could be used to verify this... i.e. out.write(resourceName);

Regards,

Ryan Crosby

Former Member
0 Kudos

OK, well I was looking back at the code and the only code I could find that I think would have anything to do with the filename on the server is this:

resourceName = fileUpload.getFile().getFileName();

I changed it to resourceName = "text.xlsx";

but still no luck and the same error. The only other strings my program explicitly uses are mimetype and repository. The repository string is 12 characters long, and I assume mimetype which is currently set by:

mimetype = fileUpload.getFile().getContentType();

is shorter than 50.

Former Member
0 Kudos

mimetype being set by

fileUpload.getFile().getContentType(); was in fact longer than 50!! I've hardcoded it to

mimetype = "application/vnd.ms-excel"; which I assume will be ok as the filetype will always be excel.

Ryan-Crosby
Active Contributor
0 Kudos

Hi,

I found a couple of OSS notes related to the same type of error and it does indicate a problem with length somewhere.  Are all parameters you are referencing in your JSP application less than 50 characters?  If so, then I would suggest opening a message on OSS regarding your problem.

Regards,

Ryan Crosby

Answers (0)