Example : A Complete JSP & Oracle 10g/11g Connectivity Code using Net Beans 8.2 IDE [JSP Connectivity Code].
<%--
Document : JSP & Oracle Connectivity
Created on : 6 May, 2019, 9:39:23 AM
Author : Codershelpline
--%>
<%@page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" import="java.util.*" errorPage=""%>
<%
Connection conn = null;
PreparedStatement pst=null;
ResultSet rs;
Statement st=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:
orcl","oracleusername","oraclepassword");
out.println("Database Connected... ");
%>
//------------- OR ---------------
Connect.jsp (Connectivity Code File)
<%--
Document : All Integrated Code
Created on : 14 May, 2019, 2:15:53 PM
Author : Codershelpline
--%>
// JSP & Oracle 10g Connectivity Code
<%@page contentType="text/html; charset=utf-8" language="java" import="java.sql.*"import=
"java.util.*" errorPage=""%>
<%
Connection conn=null;
PreparedStatement pst=null;
ResultSet rs;
Statement st=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","putusernamehere",
"putpasswordhere");
out.println("Database connected");
%>
UserRegistration.jsp
<%@include file="Connect.jsp"%> // Calling of Connectivity Code file here
<%
--------
--------
--------
%>
NB : Both files must be stored in same project folder.
0 Comments