• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet and jdbc (urgent)

 
padmshree Patil
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I am doing online test System.I am using Ms-Acess ,servlet and JSP.MY problem is
For each user ,I wanted to store his mark for each question in different table.Right now I am using only one table so every time I run the program it will count previous marks also.
I tried with seting autocommit to false.but didn't work.
After login by each user can I create table dynamicaly in servlet ?? IF yes then how?
thanks,
-padmashree
 
Alex Kravets
Ranch Hand
Posts: 476
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would guess you can include user's name as table name in SQL statement using "CREATE TABLE" + username + .... .But this is going to be very expensive when you will have a table for each user. Try to utilize only one table, I don't think it's very hard.
- Alex
 
padmshree Patil
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I solved problem..
After login, I delete all rows from Result table..

Thanks for all help
-padmashree
 
Frank Carver
Sheriff
Posts: 6920
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may be missing the point here, but surely it's simple to do with one table (lets call it "exam"). you have columns "user" (text), "question" (number), "answer" (number?), "correct" (boolean)
When each user answers a question, place a new row in the table with the information on it, and calculate whether the answer was correct and store it in the "correct" column.
Then, to work out someone's score just use
SELECT COUNT FROM exam WHERE user="the user name" and correct=TRUE
Is this the sort of thing you were looking for.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by padmshree Patil:
I solved problem..
After login, I delete all rows from Result table..

Solved problem? Only if you don't expect more than one user at a time...
- Peter
 
sachin cknd
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear friend,
i have similar sort of query.
it goes as ...

> > i have a problem in multithreading which i am using
> > in my code
> > and i am not getting the path out of it.
> >
> > I have designed the servlets for online
> > examination.But the problem is that
> > only one user can give the exam at a time.
> > i have used two variables to trace score and
> > question number.
> > when one user logs in there is no problem.
> >
> > but in between if other one comes,
> > he gets his first question but his score is
> > incremented with the score of first user.
> > similarly his question.
> >
> > if user1 is on fourth question and his score=40;
> > user2 gets score=50 for his first right answer
> > infact it should be 10;
> >
> > i have incremented the score by 10 for each correct
> > answer.
> > the score and question_no are public variables.
> >
> > the test is for 10 questions and i am calling the
> > same servlet in a loop till the completion.
> > it is offcourse not fiesible to design n servlets
> > for n users.
> > i want the same servlet to be used by all the users.
> >
> > what should i do??
> > I am using jdk1.2.2 and Jsdk 2.0
> >
> > please mail me if you can help me.
> > thank you
> > sachin
 
sachin cknd
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my email is sachin_dabhade@yahoo.com
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic