I am building a web application with JBoss 7. I will be getting datasets in .xls format that I want to drop into a folder on the server. In turn, these .xls files will be imported into the database in jboss. There should be some kind of auto detection in the folder so that when a .xls file is dropped in there it is automatically imported into the database. Please can someone advise me what tools / technologies are available for importing .xls files into the database in JBoss?
You can divide this into several tasks:
Deciding of you really want to do this directly inside JBoss with a Service or with a external program connecting to a SessionBean.
Detecting changes of the directory (e.g. with Java7 and the WatchService
Reading the XLS files (e.g. with Apache POI - the Java API for Microsoft Documents
Mapping the content of the XLS files to entities of your domain model and store them into the DB.
Related
Is it possible to upload jar as a file into database ? I need to upload jars into mongodb. I don't know how to do that. I know about file upload with Spring Boot.
I know it is possible to upload zip in database. But not finding information about JAR/WAR files.
JAR and WAR files are nothing more than a renamed ZIP file. If you want to see it yourself rename something.jar to something.zip and open it using archive manager.
Since you said you know how to upload a ZIP you should follow the same procedure. If the file is small (e.g. less than 4MB) perhaps using BSON is the best approach. See Storing Large Objects and Files in MongoDB.
If you mean saving a jar file into a database - it is depends on the database's support of BLOB data types.
And if you mean use Java language based stored procedures from JAR file - with Oracle and PostgreSQL this is possible. MongoDB supports server side JavaScript stored procedures only.
I know that I can use a BLOB or an XML file, but I was wondering if there was a better way to do this, or if either of these are the correct way of doing this. The user should be able to edit their file online and then save it onto the server, and at any time get the file back into the editor and continue editing that file (similar to that of Google Drive). Any ideas? We are using Spring Framework and controllers for our site. We are using a MongoDB for file storage (files are stored on the server, file paths are stored on the MongoDB).
I developing web application using glassfish 4.0 and primefaces 4.0. application creates pdf (using Itext) , convert it to small jpeg files and saving in on disk. Unfortunately during server shutdown all these files are deleted.
Do you know what is the reason for this deletion and how to turn in off?
Regards
I have a swing application that uses many data files, these data files will change time to time. How can I load these data files on client's machine? Is there any way to create a folder like structure and run a batch file or so? Any help is appreciated.
There are several ways to do this:
Assume you want to ship your application with the datafiles, you may embed them as a zip/jar in your application-jar-file.
Extract the embedded zip to a temporary local file and use ZipFileSystemProvider to extract the content to some place on the disc.
Here is an example how to extract some content from zip/jar-file embedded in a .jar-file downloaded by JWS.
Same as 1, but skip the zip stuff and instead provide a list of all the resources you want to extract
One other way is to create the files pragmatically using either java.nio.file (java 7+) or java.io.File
I have written some code in JSP to download .docx files which is hosted on a Sun One web server. But it is getting downloaded as a .zip file, not a .docx file. I have added the appropriate MIME types in the web server configuration, but I am still facing the problem.
DOCX files are compressed. Download it, and just rename it back to .docx.
From the MS How-to:
Compact files Files are automatically compressed and can be up to 75 percent smaller in some cases. The Open XML Format uses zip compression technology to store documents, offering potential cost savings as it reduces the disk space required to store files and decreases the bandwidth needed to send files via e-mail, over networks, and across the Internet. When you open a file, it is automatically unzipped. When you save a file, it is automatically zipped again. You do not have to install any special zip utilities to open and close files in Office 2010.