Tech Mastery: Deep Dives into AEM, Cloud Technologies, AI Innovations, and Advanced Marketing Strate
Welcome to Tech Mastery, your expert source for insights into technology and digital strategy. Explore topics like Adobe Experience Manager, AWS, Azure, generative AI, and advanced marketing strategies. Delve into MACH architecture, Jamstack, modern software practices, DevOps, and SEO. Our blog is ideal for tech professionals and enthusiasts eager to stay ahead in digital innovations, from Content Management to Digital Asset Management and beyond.
Friday, November 16, 2012
Wednesday, November 14, 2012
Uploading the files to a database table with commons fileupload
Uploading the files to a database table with commons fileupload:
Create the web projectCreate a html file form to upload the file
<html>
<head>
<title>Add MP3</title>
</head>
<body>
<h2>Add MP3</h2>
<form id="addmp3" enctype="multipart/form-data" action="/OnlineMusicPlayer/MP3UploadServlet" method="post">
<table>
<tr><td>Enter Title :</td><td><input type="text" name="title"/></td>
</tr>
<tr><td>Select MP3</td><td><input type="file" name="photo" />
</tr>
</table>
<p/>
<input type="submit" value="Add MP3"/>
</form>
<p/>
</body>
</html>
Change the action accordingly with the servlet path.
Create a servlet to store the file to a database table.
import java.io.*;
import java.sql.*;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import db.DatabaseConnection;
public class MP3UploadServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public MP3UploadServlet() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
boolean isMultiPart = false;
PrintWriter out = response.getWriter();
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps=null;
try {
// Check that we have a file upload request
isMultiPart = ServletFileUpload.isMultipartContent(request);
System.out.println("isMultiPart=" + isMultiPart);
if (isMultiPart) {
// Create a factory for disk-based file items
FileItemFactory fileItemFactory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload servletFileUpload = new ServletFileUpload(
fileItemFactory);
List fileItemsList = servletFileUpload.parseRequest(request);
out.println("<html>");
out.println("<head>");
out.println("<title>MP3 upload</title>");
out.println("</head>");
out.println("<body>");
FileItem id = (FileItem)fileItemsList.get(0);
String songtitle = id.getString();
// get uploaded file
FileItem file = (FileItem) fileItemsList.get(1);
ps = con.prepareStatement("insert into music_store(song_id,song_title,song_data) values(song_id_sequence.nextval,?,?)");
ps.setString(1, songtitle);
ps.setBinaryStream(2, file.getInputStream(),(int) file.getSize());
ps.executeUpdate();
con.commit();
}
out.println("File Upload Success...");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
out.println("File Upload Error....");
} finally {
out.println("</body>");
out.println("</html>");
if (con != null)
try {
ps.close();
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
out.close();
}
}
}
The song_data column in the music_store table should be BLOB.
The jar files required - commons-io-2.2.jar , commons-fileupload-1.2.2.jar
Tuesday, November 13, 2012
Oracle Fusion Middleware Adapters
Details on Oracle Fusion Middleware Adapters:
Application
Adapters
|
Legacy
Adapters
|
Changed
Data Capture (CDC) Adapters
|
B2B
Adapters
|
Technology
Adapters
|
SAP
|
CICS
|
VSAM Batch
|
RosettaNet
|
File
|
PeopleSoft
|
IMS DB
|
Adabas
|
EDI
|
FTP
|
Siebel
|
IMS TM
|
DB2/390
|
Healthcare
|
JMS
|
Oracle
Applications
|
VSAM
|
Microsoft
SQL Server 2005
|
ebXML
|
Database
|
J. D.
Edwards
|
Tuxedo
|
Microsoft
SQL Server 2000
|
Advanced
Queueing
|
|
IMS/DB
|
MQ Series
|
|||
VSAM CICS
|
Socket
|
Technology adapters are included in the Oracle Internet
Application Server and WebLogic Suite license upon which the Oracle SOA Suite
has a licensing dependency. Other adapter types are licensed separately.
Financial Service adapters, along with Financial Message
Designer, are separately licensed standalone products which inter operate with
Oracle Service Bus. They are not JCA adapters like the other integration
adapters. They include:
SWIFT Adapter for
Oracle Service Bus
FIX Adapter for
Oracle Service Bus
Payments Adapter
for Oracle Service Bus
Derivatives
Adapter for Oracle Service Bus
An additional separately licensed adapter, Enterprise Link
for Business Activity Monitoring, is offered as an extension of the Oracle BAM
product for customers who are looking to leverage Oracle BAM's embedded
extract, transform and load (ETL) tooling. Enterprise Link is only one of five
major ways to source data into Oracle BAM and is not required in all customer
implementations. Customers who do not need Enterprise Link are any customers
connecting to Oracle BAM only through BPEL PM Sensors or the Web Services API
for Oracle BAM's Active Data Cache. Enterprise Link is required for all
customers connecting to Oracle BAM through JMS queues or though query-based ETL
updates. This includes customers who want to listen to JMS messages in existing
integration environments, transfer large data sets into BAM, or archive data
out of the BAM Active Data Cache on a scheduled basis.
Friday, November 2, 2012
Invoking a web service with HTTP Basic authentication – OSB 11g
Invoking a web service with HTTP Basic authentication – OSB 11g:
To invoke the webservice that is protected with basic authentication,
the Service account needs to be created and attached to the outbound business service
(the service that calls the webservice)
This post explains the steps required to invoke the basic authentication enabled service.
This post explains the steps required to invoke the basic authentication enabled service.
Steps to invoke the basic authentication enabled service
- Login to sbconsole
- Create the Service AccountA service account provides a user name and password that proxy services and business services use for outbound authentication or authentication to a local or remote resource, such as an FTP server or a JMS server. For example, if a business service is required to supply a user name and password for transport-level authentication with a Web Service, you create a service account that specifies the user name and password and then you configure the business service to include the service-account credentials in its outbound requests.
- Select Project Explorer and then select a project or folder in which to add the service account
- From the Create Resource drop-down list, select Service Account to display the Create a New Service Account page
Tuesday, October 30, 2012
The server does not support version 3.0 of the J2EE Web module specification - Eclipse
The server does not support version 3.0 of the J2EE Web module specification - Eclipse
Sometimes we used to receive the following exception when running the web application in latest eclipse version.The server does not support version 3.0 of the J2EE Web module specification.
The issue is when creating the web project in latest eclipse by default the web version will be selected as 3.0 but the server what we are having is not supporting the web 3.0.
There is two options to fix this issue.
1. Upgrade your server to latest version
2.Open org.eclipse.wst.common.project.facet.core.xml file from /workspace/<Your project name>/.settings and change jst.web version to 2.5 instead 3.0
<installed facet="jst.web" version="2.5"/>
Subscribe to:
Posts (Atom)