This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes SIGNAL PRBLEM...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "SIGNAL PRBLEM......" Watch "SIGNAL PRBLEM......" New topic
Author

SIGNAL PRBLEM......

sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hello Friends
Iam having two points
1)I want to know is there any way that when I insert a record in oracle using JSP code...Some signal or intimation can come to ..my side means ..hosting side that a record is inserted..
Means sort of alarm....beacuse i want to know how many records r inseted and at which time.
2)Iam having a option of delete which i provided to user ..so that he can delete his record from ..database..but I want to restrict him that he can not not use delete option after ..15 days of submiting form..
means taken privilage back...of delete or update so that he cant delete..his record..
Technology using is html/jsp some javascript...
....Thanks a lot in advance
bye and take care..
sandeep

Want to do something great will do one day
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Pls check friends..for telling..nice way
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040


1)I want to know is there any way that when I insert a record in oracle using JSP code...Some signal or intimation can come to ..my side means ..hosting side that a record is inserted..
Means sort of alarm....beacuse i want to know how many records r inseted and at which time.

Yes, but it depends on how you are accessing Oracle.
If its with JDBC, the an int (indicating the number
of records updated) is returned when you use the
executeUpdate() method.


2)Iam having a option of delete which i provided to user ..so that he can delete his record from ..database..but I want to restrict him that he can not not use delete option after
..15 days of submiting form..means taken privilage back...of delete or update so that he cant delete..his record..
Technology using is html/jsp some javascript...

Not sure how you would do this with JSP and javascript alone.
I would expect to see some JDBC involved.
regds.
- satya


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hi sir
I know abt that when a record inserts it returns an int value one..
But if pls make it more clear..
both
1 and 2 pt...
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

ummmmmm...pl. let me know how you are connecting to the DB?
Are you using JDBC or so,ething else?
regds.
- satya
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
The second one could be solved by just changing the SQL of the statements used. When the user creates his record (and you do a SQL insert) make sure to insert a TIMESTAMP column into the table with the creation date.
When you do the DELETE make sure that the DELETE has a where clause that says something like:
DELETE FROM MYTABLE WHERE ID = '123' AND TIMESTAMP > (However oracle specifies the time now minus 15 days)
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere
See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
rudayashanker
Greenhorn

Joined: Oct 25, 2001
Posts: 11
Here is a sample have a look sir

----------

<%@ page import ="java.sql.*" %>
<%
String Username = request.getParameter("username");
String Password = request.getParameter("password");
String Connection = null;
String Statement = null;
String ResultSet = null;
String sqlqu = null;
int s1=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:shank","shankar","shankar");
Statement statement = con.createStatement();
sqlqu = "select * from BV_USER where USERNAME= "+" '"+Username+"' "+"AND PASSWORD ="+" '"+ Password+"'";
ResultSet rs = statement.executeQuery(sqlqu);

while (rs.next())
{
s1 = 1;
}

if(s1 == 1)
{
out.println("Valid Login");
}
else
{
out.println("invalid login");
}
con.close();
rs.close();
}

catch(Exception e)
{
out.println(e.getMessage());
}
%>
I hope it will help u to get start sir....
I am using oracle as a back end process and i use jdbc dbc as connectivity.
There is four drivers.I used Type1 driver for connectivity.
Thanks
shankar
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Hello sir
and thanks for my ans..
sorry Iam late as i was busy in same ..things...
..------
<%
String Username = request.getParameter("username");
String Password = request.getParameter("password");
String Connection = null;
String Statement = null;
String ResultSet = null;
String sqlqu = null;
int s1=0;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:shank","shankar","shankar");
Statement statement = con.createStatement();
sqlqu = "select * from BV_USER where USERNAME= "+" '"+Username+"' "+"AND PASSWORD ="+" '"+ Password+"'";
ResultSet rs = statement.executeQuery(sqlqu);
while (rs.next())
{
s1 = 1;
}
if(s1 == 1)
{
out.println("Valid Login");
}
else
{
out.println("invalid login");
}
con.close();
rs.close();
}
catch(Exception e)
{
out.println(e.getMessage());
}
%>
I hope it will help u to get start sir....
I am using oracle as a back end process and i use jdbc dbc as connectivity.
There is four drivers.I used Type1 driver for connectivity.
Thanks
shankar
-------
Sir actually Iam using class four ..thin pure java driver ..
....But sir my ques ...is
......................
I want to get intimate or some signal at ..hosting side not client side..
this code will print out to client..
I want as any record is inserted in hosting database..
hosting side should get some ..signal..that one record inserted..or print that record using printer at ...hosting side.......
Pls check it sir..
any way thanks a lot for u r ans...and givinng precious time for me..
..sandeep
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

You can do this on the database.

Investigate using Oracle's built in triggers. A trigger on a table is 'triggered' by the insert, and you can run a Java program (!) that will send your signal to the host.

OR... just do it from the servlet that your client is using. After your servlet makes the insert to the database, have it fire of an email using JavaMail, or whatever 'signal' you choose. Perhaps have it poke an URL. The URL would be a servlet that does nothing but register a 'get' request. If it's been poked, that means a database insert just happened. And that second servlet is the thing that alerts whoever is listening on the host side, through some means (JavaMail, again, comes to mind).
sandeep balyan
Ranch Hand

Joined: Jul 25, 2001
Posts: 134
Thanks a lot for u r nice ans..
Iam trying process
======
if(it works)
{
..than okee..
}
else
{
again here to post...
}
=======
sandeep balyan
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SIGNAL PRBLEM......
 
Similar Threads
Creating LogFile
JSP include
Almost ready to hand up: Just cleaning up and have a few questions
Date and month by by default
Delete Confirmation