The application requires more database privileges than you have currently been granted Oracle DB

After your installation of oracle10g and if you have unlocked account like scott,hr etc , you may not be able to login,
you will be getting the following error message, to resolve this issue you have to grand the catalog role to the user.

Error Message :The application requires more database privileges than you have currently been granted

Solution : grant select_catalog_role to scott


Log In web Application using Asp.net,C#,MSSQL Server

Bangalore: In web application development you have to provide a log in form,It will allow only authorized users to log in into your application,normally Asp.net provide Windows Authentication using (AD). But in application development we wont use this we will use form based authentication. using SQL server.
People familiar with programming they know how an authentication works,for those who are new let me tell it.It will verify in  database whether the username and password you are passing from the web page is correct or not. how it will work that we will explain in our code.
So what all the things we need to create this application Visual Studio 2010,MS Sql Server.
So first create an empty web application using your visual Studio, design a Log In page.provide fields to enter username and password and a submit button also.
Your log In page look like this, below I have provided the code for creating the above page.

Login.aspx page code.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="login.login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Login</title>
</head>
<body style="background-color:Gray">
    <form id="form1" runat="server" style="padding:150px 300px 100px 400px; ">
     <asp:ValidationSummary ID="validation" runat="server" HeaderText="" ShowMessageBox="true"
        ShowSummary="false" DisplayMode="BulletList" EnableClientScript="true"/>

    <fieldset  style="width:400px; height:200px; background-color:Lime; " >
        <legend style="background-color:Yellow;">Login</legend>
        <table align="center" style="padding:20px 0px 10px 0px; " >
            <tr>
                <td>UserName</td>
                <td><asp:TextBox ID="txtLogin" runat="server"></asp:TextBox>
                </td>
                <asp:RequiredFieldValidator ID="uname" runat="server" ControlToValidate="txtLogin" ErrorMessage="Please Fill Username" Display="None"></asp:RequiredFieldValidator>
                </tr>
            <tr>
                <td>Password</td>
                <td><asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox></td>
                <asp:RequiredFieldValidator ID="pwd" runat="server" ControlToValidate="txtPassword" ErrorMessage="Please Fill Password"  Display="None"></asp:RequiredFieldValidator>
            </tr>
            <tr>
            <td colspan=2 align="center" style="padding:0px 23px 0px 0px;">
                <asp:Button runat="server" ID="btnlogin" Text="Login" 
                    onclick="btnlogin_Click" /></td>
            </tr>
        </table>
    </fieldset>
    </form>
</body>
</html>

Now we need to write the action on button click.
In your code behind page you can see a button click event [if its no there double click on the button in your form]

On Button click we are calling a method named checklogin
 protected void btnlogin_Click(object sender, EventArgs e)
        {
            checklogin();
        }

In checklogin method First it assigning username and password into two variables. and calling getconnectionstring function it will return the connection string. Then it will check the state of connection and change it into open state. Then calling the Stored procedure from SQL db and passing username and password to db. Using Sql ExecuteReader it will return its results already declared SqlDataReader  variable.
If its true means its authorized user and if its false he is not authenticated user.

        public void checklogin()
        {
            string uname=txtLogin.Text;
            string password=txtPassword.Text;
            SqlDataReader dr;

            string constr = getconnectionstring();
            SqlConnection con = new SqlConnection(constr);

            if (con.State != ConnectionState.Open)
                con.Open();

            SqlCommand cmd=new SqlCommand("LoginCheck",con);
            cmd.CommandType=CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@username", uname);
            cmd.Parameters["@username"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@password", password);
            cmd.Parameters["@password"].Direction = ParameterDirection.Input;

            dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                Response.Redirect("Home.aspx");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Credentials');", true);
            }
       con.Close();

        }

        public string getconnectionstring()
        {
            string strg = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            return strg;
        }
don't forget to declare your connection string in web.config file inside <configuration> tag after <system.web></system.web>

 <connectionStrings>
    <add name="constr" connectionString="Data Source=tonz-pc; Initial Catalog=search; Integrated Security=true;" providerName="System.Data.SqlClient"/>
  </connectionStrings>

How to Create Stored Procedure in MySql Server,Simple stored procedure with output parameter examples.

Most of the peoples who are familiar with database operations know what is a stored procedure, For the beginner's we are mentioning the definition " Its a set of SQL statements with an assigned name,its in a compiled form we can share it with many programs".
Consider we want to insert the details of a registration form into a table in  MySQL Database. Let see how we are going to insert it through stored procedure.
In Mysql stored procedure called as Routines.


If you are using MySql workbench you can see table,views,routines for a database. so right click on the Routines and create a procedure with any name. I have created an sp with name `registrationform`  now I can see my sp in routines list. so  I have right click on that routine and selected alter procedure. There I will write my queries as per my requirement.
If you are using PhpMyadmin select you database go to Routine menu and click on that, the you will see a Add Routine button click on that and create your sp there.

So here I need to pass Firstname,LastName, Username and Password to my table using submit button click there I will call my  stored procedure as per my code syntax, whether its PHP,.net,java etc.

So here I have 4 Input parameters.

So here is our stored procedure.


/* code starts here */

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `registrationform`(In FirstName varchar(20),In Lastname varchar(20),In userName varchar(50),In Pwd varchar(50))
BEGIN

/* Inserting Values into Table */
Insert into tbl_login(`FirstName`,`LastName`,`UserName`,`Password`) values (FirstName,Lastname,userName,Pwd);

END

/* Code Ends Here */
Here we are Inserting FirstName,LastName,UserName,Password details  into tbl_login .
you can call this stored procedure like this and check whether its getting inserted in table or not.

Method for calling a stored procedure.


call registrationform('tony','tom','tonytom','testing');

These 4 parameters are the input parameters that's why  we are passing that value while calling the sp itself.
Hope that you have understood it.

consider you want to get an acknowledgement after insertion so you have to use an out parameter in same stored procedure. so your sp now become like this.

/* code starts here */

-- --------------------------------------------------------------------------------
-- Routine DDL
-- Note: comments before and after the routine body will not be stored by the server
-- --------------------------------------------------------------------------------
DELIMITER $$

CREATE DEFINER=`root`@`localhost` PROCEDURE `registrationform`(In FirstName varchar(20),In Lastname varchar(20),In userName varchar(50),In Pwd varchar(50),Out ack int)
BEGIN

/* Inserting Values into Table */
Insert into tbl_login(`FirstName`,`LastName`,`UserName`,`Password`) values (FirstName,Lastname,userName,Pwd);
set ack=1;

END




/* code ends here /*
Here we have one additional parameter all other parameters we are declared like "In Param name datatype", but the fifth parameter is out parameter so we declared as "Out Param Name Datatype"

procedure to calling a stored procedure which is having an output parameter.

call registrationform('tony','tom','tonytom','testing',@x);
select @x;
so now it will return 1 if its inserted successfully in database.