• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SIGNAL PRBLEM......

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pls check friends..for telling..nice way
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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

 
sandeep balyan
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ummmmmm...pl. let me know how you are connecting to the DB?
Are you using JDBC or so,ething else?
regds.
- satya
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for u r nice ans..
Iam trying process
======
if(it works)
{
..than okee..
}
else
{
again here to post...
}
=======
sandeep balyan
 
reply
    Bookmark Topic Watch Topic
  • New Topic