• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unable to insert values in database

 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am unable to insert values in my database, please somebody help me to find the error.
Please tell me where I have done mistake.

test1.jsp



test1.java



web.xml file
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try to change the wildcards '?' for real values and run another time.




Best regards,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please TellTheDetails. What errors are you getting?
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Please TellTheDetails. What errors are you getting?


Carles Gasques wrote:Hi,

Try to change the wildcards '?' for real values and run another time.




Best regards,


still not working,


I am getting this error,



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what does this:
root cause

java.lang.ClassNotFoundException: P1.test1
tell you?
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:So what does this:
root cause

java.lang.ClassNotFoundException: P1.test1
tell you?


sorry I can't understand what you are trying to say [I am a beginner in this]...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the P1.test1 class?

(By the way, P1 and test1 are not very good names for packages and classes.)
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Where is the P1.test1 class?

(By the way, P1 and test1 are not very good names for packages and classes.)



Oooooopos,

I forgot to change class name,
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It will be hard to run a jsp from command line you need to use a jsp engine (jasper for Tomcat).
Better use a editor as eclipse and an servlet container as Tomcat.

I understand that you know the difference between a servlet an a standalone java app (main).
If not, your first goal is to understand what a servlet is and how code it.

What is your environment? Eclipse, maven, Tomcat...?
How do you package your web app (war)?


There is a step by step 'hello world' example with Eclipse+Jeronimo webapp example.
If you wish to use Tomcat instead Jeronimo just change the target runtime to Tomcat in the 3 step of the wizard.


Best regards,
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carles Gasques wrote:Hi,

It will be hard to run a jsp from command line you need to use a jsp engine (jasper for Tomcat).
Better use a editor as eclipse and an servlet container as Tomcat.

I understand that you know the difference between a servlet an a standalone java app (main).
If not, your first goal is to understand what a servlet is and how code it.

What is your environment? Eclipse, maven, Tomcat...?
How do you package your web app (war)?


There is a step by step 'hello world' example with Eclipse+Jeronimo webapp example.
If you wish to use Tomcat instead Jeronimo just change the target runtime to Tomcat in the 3 step of the wizard.


Best regards,





first of alll thank you for reply sir,

actually I know this but I am beginner in database connectivity, so would you please help me good sites to learn database connectivity from beginning ?
 
Carles Gasques
Ranch Hand
Posts: 199
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All right,

If you only want to test jdbc then a standalone java app like P1.Test4 is a good starting point.

For a quick insight to jdbc see wikipedia and
once done with this examples try Sun jdbc guide.


Best regards,
 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carles Gasques wrote:All right,

If you only want to test jdbc then a standalone java app like P1.Test4 is a good starting point.

For a quick insight to jdbc see wikipedia and
once done with this examples try Sun jdbc guide.


Best regards,



Could you please temporarily help me ?? I want to insert values like (name varchar2(10),rollno number(5),class varchar2(10),mobileno number(10))

table name "student"
ip address:- 192.168.106.87
username- fuel_db
password is foel


I would be very thankful to you.
 
Davian Ramsay
Greenhorn
Posts: 6
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to rewrite the codes to see if i was able to solve the problem, but what i noticed is that your insert statement had no ( " ") to show if you were trying to input a string or and integer data type into your database, this is important as it is need to verify that the data type of the program matches that of the database..and equaling the connection variable to null is not necessary either(Connection con =null);

NB. When inputting sting in the database a (' ') is needed and none when inputting an integer or double data type.

I wasn't able to run it to see what the outcome was but take a shot and let me know what the error is if any received

regards





 
rajnish patel
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Davian Ramsay wrote:i tried to rewrite the codes to see if i was able to solve the problem, but what i noticed is that your insert statement had no ( " ") to show if you were trying to input a string or and integer data type into your database, this is important as it is need to verify that the data type of the program matches that of the database..and equaling the connection variable to null is not necessary either(Connection con =null);

NB. When inputting sting in the database a (' ') is needed and none when inputting an integer or double data type.

I wasn't able to run it to see what the outcome was but take a shot and let me know what the error is if any received

regards



thank you for this sir,
but I wanted a JSP file in which I can enter data and be redirected to this file.

could you please make changes in this ?

actually I dont know how to redirect the data entered in JSP file to above java file.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic