wood burning stoves 2.0*
The moose likes JDBC and the fly likes Oracle 8i  Insertion of records...Very Urgent.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle 8i  Insertion of records...Very Urgent.." Watch "Oracle 8i  Insertion of records...Very Urgent.." New topic
Author

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

prasad bhn
Greenhorn

Joined: May 04, 2001
Posts: 28
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.


prasad bhuvanam
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
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

Joined: May 04, 2001
Posts: 28
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

Joined: May 04, 2001
Posts: 28
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

Joined: May 04, 2001
Posts: 28
i got the solution and it is based on Synthetic Primary key only.
------------------
iic systems pvt ltd.,
babukhan millennium center,
somajiguda,
hyderabad-38.
 
Consider Paul's rocket mass heater.
 
subject: Oracle 8i Insertion of records...Very Urgent..
 
Similar Threads
What fields does java.util.Date.equals compare?
java.util.Date - after function not considering time?
how do i get todays dat without the time
Losing time when manipulating a date time and sending it to database (java.sql.Date)
Representing MilliSeconds in JDBC using Oracle