File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes servlet and jdbc (urgent) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet and jdbc (urgent)" Watch "servlet and jdbc (urgent)" New topic

servlet and jdbc (urgent)

padmshree Patil
Ranch Hand

Joined: Dec 18, 2000
Posts: 54
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?
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
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

All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
padmshree Patil
Ranch Hand

Joined: Dec 18, 2000
Posts: 54

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

Thanks for all help
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
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.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Peter den Haan
Ranch Hand

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

Joined: Feb 10, 2001
Posts: 12
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

Joined: Feb 10, 2001
Posts: 12
my email is
I agree. Here's the link:
subject: servlet and jdbc (urgent)
It's not a secret anymore!