Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle 8i Insertion of records...Very Urgent..

 
prasad bhn
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friends,
i am in a very specific context in which i got a doubt.
here it is......
i have a link on a web page, over which 100's of hits can occur per second.
i just want to INSERT the hit on my link into the database Oracle 8i.
my problem here is, if 100 users hit my link at the SAME time, up to the same millisecond, is there any way to distinguish all the 100 users by inserting the hit in Oracle 8i, by using java.util.date/java.sql.date.
I want to store that hit date as "long" of java.util.date in the database.
my actual idea is, by differentiating all the 100 users to different time stamps(even by millisecond), i just want to make that date column UNIQUE in my database..
TIA,prasadbh.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you need it for? You could perhaps add a field with the user's session ID. Or generate a synthetic primary key using a sequence. It depends on what you need the data for.
- Peter
 
prasad bhn
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Peter..
you are right in the case of synthetic primary key using a sequence. We already planned this way, as the LAST Option.
But we believe in the long form of date, as we can get Nano seconds of the hit, by using java.sql.Timestamp class, we are hopeful that we can get the solution in some way.
But we came to notice that, when i apply MY PROBLEM for creating ordinary objects in a standalone program using below code, nano seconds concept also doesnt work.
import java.util.Date;
import java.sql.Timestamp;
public class TimeStampNanoSeconds
{
public static void main(String[] args)
{
Date d=new Date();
Nano(d);
}
public static void Nano(Date date)
{
Timestamp ts=new Timestamp(date.getTime());
System.out.print(date.getTime());
System.out.println("\tNano==="+ts.getNanos());
Date d1=new Date();
Nano(d1);
}
}
but we are hopeful that we will get a UNIQUE "long" number when it is in the case INSERTION into database table or any other databse transactions.
AM I confusing anybody?? if so, dont hesitate to clarify with me...
Many Thanks One and All,prasadbh.
 
prasad bhn
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
Can you help us by giving sample code to generate a Synthetic Primary Key( generalized/independent on the columns of the table)
..
TIA,prasadbh
 
prasad bhn
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got the solution and it is based on Synthetic Primary key only.
------------------
iic systems pvt ltd.,
babukhan millennium center,
somajiguda,
hyderabad-38.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic