Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%--
- Document : data
- Created on : Mar 6, 2017, 4:00:32 PM
- Author : admin
- --%>
- <%@page contentType="text/html" pageEncoding="UTF-8"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Database</title>
- <%@page import="java.sql.*"%>
- </head>
- <body>
- <%
- Statement stmt;
- Connection con;
- ResultSet rs;
- try
- {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","system");
- stmt = con.createStatement();
- stmt.executeQuery("create table happy(Name varchar(25),Rollno varchar(15))");
- out.println("Created");
- rs = stmt.executeQuery("insert into happy values('KRISHNA','TE306362')");
- if(rs.next())
- {
- out.println("inserted");
- }
- else
- {
- out.println("Not Inserted");
- }
- }
- catch(Exception e)
- {
- out.println("Error"+e);
- }
- %>
- </body>
- </html>
Add Comment
Please, Sign In to add comment