JSP database connectivity

Reply

Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

JSP database connectivity

 
0
  #1
Sep 9th, 2009
Hello.
I was studying the database connectivity tutorial .
I set it up with the database in MySQL.

However I tried to set it up using Netbeans6.7.1. just to see if I could get it to run. it's not working out.

Can this be setup in netbeans? I have attached the program.
at:
http://cid-b5cb457363230793.skydrive...olTutorial.zip
I also plan to try to recreate it step by step with netbeans if possible.

any feed back on what is wrong with the example setup with netbeans would be appreciated.
-ceyesumma
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,612
Reputation: adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of adatapost has much to be proud of 
Solved Threads: 464
Moderator
adatapost's Avatar
adatapost adatapost is offline Offline
Posting Maven

Re: JSP database connectivity

 
0
  #2
Sep 9th, 2009
@ceyesuma : Can this be setup in netbeans?
-- YES or NO - It may be.

But I have a suggestion for you. Read & act this tutorial throughly - JDBC(TM) Database Access
Failure is not fatal, but failure to change might be. - John Wooden
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,190
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 483
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: JSP database connectivity

 
-1
  #3
Sep 9th, 2009
@ceyesuma: Your question is confusing, if you have problems to link MySQL with NetBeans have look at this tutorial else please provide better explanation
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

Re: JSP database connectivity

 
0
  #4
Sep 9th, 2009
Thanks
Those links will be helpful.
I have not started the tutorial supplied on the JSP page.

I have the database connection in netbeans and I need to learn how to access it.

I was just starting the tutorial and I set up the whole project in netbeans and the package was a little different . It all seemed to compile but I get the error that it will not deploy.

I was trying to quickly get the example to run in the netbeans.

I plan on tearing the tutorial apart to understand how it is using the MVC Model 2

I guess I will start by creating a java web app using JSF1.2. Will this be a good start?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,190
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 483
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: JSP database connectivity

 
-1
  #5
Sep 9th, 2009
Leave JSF till you get good understanding of JSP and servlets

When you getting errors please post them toether with any code they reference to...
Last edited by peter_budo; Sep 9th, 2009 at 11:27 am.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

Re: JSP database connectivity

 
0
  #6
Sep 10th, 2009
As I am re-writing the jsp database connectivity tutorial I noticed there is a lot of good stuff in it.

it is setting up nice in netbeans so far.

I'll have to decide which code to use for the LoginServlet.
Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

Re: JSP database connectivity

 
0
  #7
Sep 16th, 2009
Topic
The topic of this question is: db_Connect does not connect.
Hello and Thank you in advance for any assistance.


System info:netbeans project,database attached or provided at:
http://cid-b5cb457363230793.skydrive...lic/school.zip



The purpose of this post is: Try to get a sql statement to work



The functionality of this code is:
  1. · "SELECT u.uid, firstName, lastName, address1, address2, city, postCode, email, phone, ug.groupName as userGroup "
  2. · +"FROM user u, usergroup ug WHERE uid='"+userName+"' AND password='"+password+"' AND groupName IN"
  3. · +" (SELECT groupName FROM usergroup WHERE groupid =(SELECT groupid FROM usergroup_mapping WHERE uid=u.uid))";



My question concerning this code is: What is wrong with the sql statement provided in tutorial. Or a description of its function .



The errors related to this code are:
  1. Initializing Sun's JavaServer Faces implementation (1.2_04-b22-p05) for context '/school'
  2. Initialize <------------>jdbcDriver<------------>
  3. 12345678<------------>12345678
  4. SQLException:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user u,usergroup ug WHERE uid='12345678' AND password='12345678' AND groupName I' at line 1
  5. Error on DB return
  6. java.lang.NullPointerException
  7. at servlets.LoginServlet.doPost(LoginServlet.java:82)
  8.  



Code description:



Thanks again.
-ceyesuma


[u]

Note:

________________________________________________________________________

Code description:

Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 315
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 50
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz

Re: JSP database connectivity

 
0
  #8
Sep 16th, 2009
I think you are missing brackets in the sql statement, when using the in clause, somthing like this :
  1. where groupId in (1,2,3)
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

Re: JSP database connectivity

 
0
  #9
Sep 16th, 2009
I was told to add table qualifiers to the WHERE statement.


The whole thing is confusing. I'm not sure what
"add table qualifiers to the where statement"

means exactly.

Is it possible for someone to breakdown what it says(laymens terms) so I can start understanding how to change it?
-ceyesumma
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 238
Reputation: ceyesuma is an unknown quantity at this point 
Solved Threads: 0
ceyesuma ceyesuma is offline Offline
Posting Whiz in Training

Re: JSP database connectivity

 
0
  #10
Sep 17th, 2009
Topic
The topic of this question is:
Hello and Thank you in advance for any assistance.


System info:

Noted in previous post.


The purpose of this post is:

Display supplied stmt from above mentioned tutorial. Stmt throws an error as noted in previous post.

Display my new stmt.


Code description:supplied stmt

  1. "SELECT u.uid, firstName, lastName, address1, address2, city, postCode, email, phone, ug.groupName as userGroup "
  2. +"FROM user u, usergroup ug WHERE uid='"+userName+"' AND password='"+password+"' AND groupName IN"
  3. +" (SELECT groupName FROM usergroup WHERE groupid =(SELECT groupid FROM usergroup_mapping WHERE uid=u.uid)
  4.  

Code description: my new statement

  1. String strQuery = "SELECT u.uid, u.password,ug.groupName FROM user AS u,usergroup AS ug,usergroup_mapping AS ugm WHERE u.uid='userName' AND u.password='password' AND u.uid=ugm.uid AND ugm.groupid=ug.groupid";



My question concerning this code is:

If my new stmt produces the required field when I run it on the databases. Why doesn’t the login except username=10101010 password =StealthProject which is in the data base?


The errors related to this code are:

  1. Initializing Sun's JavaServer Faces implementation (1.2_04-b22-p05) for context '/school'
  2. Initialize <------------>jdbcDriver<------------>
  3. 10101010<------------>StealthProject
  4. Error on DB return
  5. java.lang.NullPointerException
  6. at servlets.LoginServlet.doPost(LoginServlet.java:82)
  7.  



Thanks again.
-ceyesuma
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC