How to save files on the sql server database using struts2 - java

I am new bee into struts2.
As I have a reqirement that stores a file into the sql server database.And retrive the same.
Please provide me a sample code or an example so that i can proceed for the same
I am using struts2.x and backend server as mysql server 2008.
Thanks in Advance.

You can found solutions on below links:
it will show you:
1. create database
2. write files
3. retrieve files
http://www.aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspx
http://chiragrdarji.wordpress.com/2007/08/31/storing-and-retrieving-docpdfxls-files-in-sql-server/

Related

How to send an automatic mail once file (one or multiple files) uploads into mysql database using jsp?

I am doing project using jsp in netbeans8.2, tomcat8, java, MySQL(xampp). I have done the coding till multiple file uploads. Now I want to send email to respective user mail id, once file uploads into MySQL database. I searched but on internet but I got for only one user mail id. I need for all users who will upload one or multiple files then immediately mail notification should be sent. Is there any tutorial or suggest me any tutorial(link) that I can refer to solve my problem??
It depends which framework you are using, there are multiple ways to achieve this.
In case you are using Spring Framework use this tutorial
https://www.baeldung.com/spring-email
https://www.javatpoint.com/spring-java-mail-tutorial
In case Plain Java
https://www.baeldung.com/spring-email
Happy to help further as and when needed.

IOS Application Fetch data fro MySql Database

I'm practicing some IOS coding in Swift 2 which consists in an app fetching information from a MySQL database.
However, I'm confused in the concept. So currently my idea of how to accomplish this is that somehow the IOS App connects to the Apache Tomcat. To be able to do this, I though about creating a Java application that connects to the MySql using JNDI. With this I fetch the data and store it in a JSON object.
However this is where I get stuck. Should I return this object to the IOS application or store it in a text file or JSON file and have the IOS application read it from there?
If I had to return the object, how can I do this? I've looked around but most examples are fetching information from an API and currently I want to do it locally.
The easiest way is to create a PHP file to connect and retrieve data from MySQL, and then you call this file by swift.
You will find a useful information in the following link :
How to make an HTTP request in Swift?

Retrieve data from lotus notes database view via Java

I am trying to retrieve data from a Lotus Notes database within which I already have a view. I manage to create an ODBC connection and use this with MS Access or Excel but I'd like to create a scheduled job on a java application to inject the data in a MS SQL Server database.
I got a bit lost in all the documentation on Internet; Do
you guys have a sample of a Java code which would allow me to
1. Connect to the database
2. "Query" the view ("SELECT * FROM..."?)
3. Get a resultset which I can iterate through
I've read that I can avoid using the Lotus SQL driver by importing the notes.jar in my project...
Thank you for your help
The best and easiest way to connect to a Lotus Notes database is by using Notes API. All you need is to connect to the database, get the view and then traverse each document. You can accomplish this by including Notes API jar file into your Libraries and then you have all Notes classes at your disposal.

modify carbon based products and use mysql

all. I hope it's not a wired dev-user case. just a simple scenario,if developers want to insert a jsp in AS, the configs (like how to link to the jsp) is set. In the jsp, he wants to create a form and a button. with filling the form and the button click. the data is persisted to mysql. But my question is, how to config MYSQL in the osgi and carbon based manner?
You want to add a MYSQL datasource configuration in to master-datasourcew.xml file and refer that configuration in your code. Also you want to add MYSQL JDBC library in to the AS server as it is not shipped by default. Then it should work. I have implemented similar sample. You can find it here. I deploy a web service (called "MediCom Web Service") in WSO2AS, and it writes and read data from MYSQL database. Please go through sample code and the configuration. Hope this would help you.

How to update android database by connecting to a remote location

Im looking to connect to a URL and download a file (.db) and if it is of a higher version then update the database on the app. e.g. currently using Database1.db and this online one is Database2.db. However I'm not really sure how to go about this. Im using sqlite.
Thanks
From server end:
Instead of uploading database from url you can post xml or json data
which will give details bout database version and sql query
From android program
connect to url get the data check for the version if version from url
is higher than that of existing one then execute the sql query that
you got to create database and take backup of your data
Scenario
Lets consider one scenario you have some data in a table named y in
old database. but the new database which you are downloading doesn't
have that y table but it has some new table then what do you want to
perform with that data. Do you want to discard or store if store and
use then to where you want to store.

Categories

Resources