aparna rudra

Greenhorn
+ Follow
since Apr 06, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by aparna rudra

hiii

i have a problem here, which couldnt be solved. i have written a JDBC program, i am trying to insert data into a table. when i compile the program, i get the output. it also gives me the number of rows inserted too. but when i open my data base i couldnt see any data inserted, i dont understand where the data is getting stored.

when i do the selection process data is being retreived. i do not have any problem for selection. why isnt this not working with insertion? is there any problem with data base? i am using MSACCESS.

HERE IS my program with insertion. please anyone help me.

thank u



output: enter the employee name:
aparna
enter the employee salary:
3000
number of rows inserted:1

[edited to add UBB code tags]
[ November 03, 2004: Message edited by: Jeanne Boyarsky ]
hii

i am new to JSP. i have JDK1.3 and JAVA WEB SERVER installed in my system, how do i compile jsp file?

are there any steps as we have in servlets such as copying html file to public_html and servlet file to servlets directory?

please any one tell me how do i compile and run JSP file.

thank u
15 years ago
JSP
hii

when i am trying to compile my filewritten in servlets i get this compuilation error. wht does this error means?

can anyone help me?
thanks

dservlet.java uses or overrides a deprecated API.
Recompile with -deprecation for details.
15 years ago
hii
i am trying to insert data in database this program compiles but doesnt work. have been struggling past 3 days, plzz anyone help me to solve this problem.

i am using jbuilder for this. please anyone help me in solving this. i get the error as data not found,null pointer exception....... wht do i do?
please help me.

thanks

package spackage;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Date;
import java.sql.*;
import java.text.*;

/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/

public class Servletin extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
Statement st;
//Initialize global variables


public void init(ServletConfig sc) throws ServletException {
try{
super.init(sc);
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc dbc:appy");
st = con.createStatement();
}
catch(Exception e){
e.printStackTrace();
}
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
try{
response.setContentType(CONTENT_TYPE);


/* String df = request.getParameter("dateofflight");
String df2 = " ";
try {
SimpleDateFormat sdf = new SimpleDateFormat(df);
sdf.setLenient(false);
// String df3= sdf.parse(df);
System.out.println("Date u entered is correct =" + df2 + "(" + df + ")");
//request.getParameter("d");
}
catch (Exception e) {
e.printStackTrace();
}*/

String flyfrom = (request.getParameter("flyfrom"));
String flyto = (request.getParameter("flyto"));
String name = (request.getParameter("name"));
String airline = (request.getParameter("airline"));

Date d1 = new Date(2004, 10, 25, 11, 6, 6);

/* GregorianCalendar liftOffApollo11 = new GregorianCalendar(16, 9, 32);
Date d = liftOffApollo11.getTime();
// DateFormat df2 = DateFormat.getTimeInstance(DateFormat.SHORT);
// String s2 = df2.format(d);
//System.out.println(s2);
String s2 = request.getParameter("departuretime");
// date arrivaltime= (Integer.parseInt(request.getParameter("arrivaltime")));
//("<response.getParametr("name")>");*/
int orderno = Integer.parseInt(request.getParameter("orderno").trim());
int tickets = Integer.parseInt(request.getParameter("tickets").trim());
int price = Integer.parseInt(request.getParameter("price").trim());
int total = Integer.parseInt(request.getParameter("total").trim());
int i=st.executeUpdate("INSERT INTO udetails(flyfrom,flyto,name,airline,orderno,tickets,price,total,arrivaltime,departuretime,dateofflight) VALUES('"+flyfrom+"','"+flyto+"','"+ name+"','"+airline+"',"+orderno+","+tickets+","+price+","+total +",'"+d1+"','"+d1+"','"+d1+ "')");


System.out.println("values u enetered are:" + i);
}
catch(SQLException e){
e.printStackTrace();
}
}
}
15 years ago
hii srini

thanks for ur reply, i got the values from html and the values got printed. i donot know the problem, been trying out from past 3 days.

please any one help me. i donot understand where the problem is? i am using JBuilder software.

plzzz anyone help me.
hiii
this is the program in servlets for inserting data in database. the program compiles but no data is inserted. can anyone help me in solving this problem.



[ added code tags, fixed smilie problem - Dave ]

[ October 26, 2004: Message edited by: David O'Meara ]

[ edit again to give it a meaningful subject name ]
[ September 21, 2005: Message edited by: David O'Meara ]
i have a question here.

while taking an exam of java 2 1.4(scjcp), before the exam starts a survey is taken by sun abt the rating of the topics.

does the questions depends on the ratings asked?

i do not undestand? anyone who has taken an exam of java2 1.4, please reply me.

thank u
15 years ago
i have a question here.

while taking an exam of java 2 1.4(scjcp), before the exam starts a survey is taken by sun abt the rating of the topics.

does the questions depends on the ratings asked?

i do not undestand? anyone who has taken an exam of java2 1.4, please reply me.

thank u
hii
the other question here.

all interfaces are abstract, am i right?

then how can it be instantiated, n the code here is valid?

interface IFace{}


class CFace implements IFace{}

class Base{}

public class ObRef extends Base{

public static void main(String argv[]){

ObRef ob = new ObRef();

Base b = new Base();

Object o1 = new Object();

IFace o2 = new CFace();

}}


o1=o2

b=ob

o1=b
and if i insert these lines here all are valid how can ol=o2?

Edited by Corey McGlone: Fixed Misspelled Subject
[ May 28, 2004: Message edited by: Corey McGlone ]
can a constructor be protected?
hii

i have a question here.


if a calss is abstarct, then the class that extends the abstract class should implemnt all the methds. or the class itself should be declared as abstarct.



how come this program compiles and generates an ouput?
here class is abstarct, public void another() is also considered as abstract? is that so. eventhough not declared as abstract. cos class is abstarct. n only MYFUNC IS THE OUTPUT HOW?

unable to understand this anyone please explain it.



Edited by Corey McGlone: Fixed misspelled subject and added CODE tags.
[ May 28, 2004: Message edited by: Corey McGlone ]
wpould anyone tell me wht is the output? and how does the control execution takes place.

class Level1Exception extends Exception {}
class Level2Exception extends Level1Exception {}
class Level3Exception extends Level2Exception {}
class Purple {
public static void main(String args[]) {
int a,b,c,d,f,g,x;
a = b = c = d = f = g = 0;
x = 1;
try {
try {
switch (x) {
case 1: throw new Level1Exception();
case 2: throw new Level2Exception();
case 3: throw new Level3Exception();
} a++; }
catch (Level2Exception e) {b++;}
finally {c++;}
}
catch (Level1Exception e) { d++;}
catch (Exception e) {f++;}
finally {g++;}
System.out.print(a+","+b+","+c+","+d+","+f+","+g);
}}
here are the two questions which i am not able to get. they are from the mock exams taken from certification4career.com.
Double a=new Double(Double.NAN)
Double b= new Double(Double.NAN);
if (a.equals(b))
System.out.println("true);
System.out.println("false");
here the out put is true.
wht abt this question
class MyClass
{
int maxElements;

MyClass(int maxElements)
{
this.maxElements = maxElements;
}
}
public class Q19
{
public static void main(String[] args)
{
MyClass a = new MyClass(100);
MyClass b = new MyClass(100);
if(a.equals(b))
System.out.println("Objects have the same values");
else
System.out.println("Objects have different values");
}
}
the output is objects have different values.
why is this so. whether i declare it as static or not the ouput is same. why is this?
hii
here are the two questions which i am not able to get. they are from the mock exams taken from certification4career.com.
Double a=new Double(Double.NAN)
Double b= new Double(Double.NAN);
if (a.equals(b))
System.out.println("true);
System.out.println("false");
here the out put is true.
wht abt this question
class MyClass
{
int maxElements;

MyClass(int maxElements)
{
this.maxElements = maxElements;
}
}
public class Q19
{
public static void main(String[] args)
{
MyClass a = new MyClass(100);
MyClass b = new MyClass(100);
if(a.equals(b))
System.out.println("Objects have the same values");
else
System.out.println("Objects have different values");
}
}
the output is objects have different values.
why is this so. whether i declare it as static or not the ouput is same. why is this?
15 years ago