Fwd: [java ee programming] Re: please tell the solution urgently

2009-03-19 Thread Manjula Srinivas
While replying click on Reply Allso  that it is respond to the
group I did not ask this question.

On Thu, Mar 19, 2009 at 12:53 AM, Chandra Bhanu Verma
chandrabhanu.ve...@utitsl.co.in wrote:
 Hello dear friend,





 Correct following things in give code:



 Before changing in code you have to do  following steps  to check mySQL
 library file added or not :



 Go to property of project and cilck on library whether   jar file
 “mysql-connector-java-3.1.11-bin.jar” added or not if not then first
 attached that.



 Then check code for following changes.



 1.  Class.forName(com.mysql.jdbc.Driver).newInstance();

 2.  Connection con=
 DriverManager.getConnection(jdbc:mysql://localhost:3306/mydb,userid,pass);



 Check with above steps.

















 

 From: java-ee-j2ee-programming-with-passion@googlegroups.com
 [mailto:java-ee-j2ee-programming-with-pass...@googlegroups.com] On Behalf Of
 Fernando Abreu
 Sent: Wednesday, March 18, 2009 9:56 PM
 To: talk2manj...@gmail.com
 Cc: fiveholida...@hotmail.com; kiran.billap...@gmail.com;
 java-ee-j2ee-programming-with-passion@googlegroups.com; kiran. b333
 Subject: [java ee programming] Re: please tell the solution urgently



 I don't know if it is the major problem but check on your code :



 try{
    pw.println(entered try);
    Class.forName(com.mysql.jdbc.Driver);
    pw.println(enter for name);
    pw.print(url);
   String durl=jdbc:mysql://localhost:3306/mydb?;
  String userid=root;
  String pass=root;
  Connection con=DriverManager.getConnection(durl, userid, pass);
     pw.print(con complete);



  What happens if you change to:



 String durl=jdbc:mysql://localhost:3306/mydb/;

 or

 String durl=jdbc:mysql://localhost:3306/mydb;



 It does not sound a great solution, but I got stuck in a  /  (forward
 slash) I forgot in an application in the past, and that drove me nuts.



 Fernando





 On Tue, Mar 17, 2009 at 2:28 PM, Manjula Srinivas talk2manj...@gmail.com
 wrote:

 Even I agree with  Evans reply, Kiran please check whether the driver
 is configured properly.

 On Tue, Mar 17, 2009 at 11:25 AM, Evans fiveholida...@hotmail.com wrote:
 Thanks for telling us about your problem. But what you didn't tell us
 however,�was the error message.

 Anyway, make sure you have the driver installed before you can use it. But
 if you think you have it installed but still not able to run your code, it
 might help by posting the error message you received.

 Good luck

 --
 Evans
 http://www.javawug.org


 - Original Message -
 From: Kiran Kumar
 To: java-ee-j2ee-programming-with-passion@googlegroups.com ; kiran. b333
 Sent: Tuesday, March 17, 2009 5:30 PM
 Subject: [java ee programming] please tell the solution urgently
 hi,

 �i have created jsp login page and servlet(with database connection) in
 netbeans 6.5. in servlet file i specified
 Class.forname(com.mysql.jdbc.Driver). whenever i click submit button, this
 servlet has to be executed. but the above command is not executed. unless
 it
 executes, i cannot work with database. so please find out the error in it.
 DUE TO THIS ERROR MY ACADAMIC PROJECT WAS STOPPED.PLEASE HELP ME.

 ��� THANK U IN ADVANCE


 JSP FILE


 %...@page contentType=text/html pageEncoding=UTF-8%
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
 �� http://www.w3.org/TR/html4/loose.dtd;

 html
 ��� head
 ��� meta http-equiv=Content-Type content=text/html;
 charset=UTF-8
 ��� titleJSP Page/title
 ��� /head
 ��� bodyform action=servlet2 method=get 
 ��� center

 ��� label for=name user name: /label
 ��� input type=text value= name=username
 ��� br
 ��� label for=PASSWORD password: /label
 ��� input type=text value= name=password
 � br
  input type=submit value=submit 
 ��� /center
 ��� /form
 ��� /body
 /html


 SERVLET


 import java.io.*;
 import java.sql.*;
 import javax.servlet.*;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;

 public class servlet2 extends HttpServlet {


 ��� @Override
 ��� protected void doGet(HttpServletRequest request, HttpServletResponse
 response)
 �throws ServletException, IOException{
 ��� String str1=request.getParameter(username);
 ��� String str2=request.getParameter(password);
 �� PrintWriter pw=response.getWriter();
 ��� response.setContentType(text/html);
 ��� pw.println(enter try);
 ��� try{
 �� pw.println(entered try);
 �� Class.forName(com.mysql.jdbc.Driver);
 �� pw.println(enter for name);
 �� pw.print(url);
 � String durl=jdbc:mysql://localhost:3306/mydb?;
  String userid=root;
  String pass=root;
  Connection con=DriverManager.getConnection(durl, userid, pass);
 

[java ee programming] Re: unclear new Object declaration

2009-03-19 Thread Lars Hermes

Hello,

to answer your question: NO it is not the same! In the first case you you only 
declare a variable of type Manager which has no reference to an object (i.e. 
null). In the second case you also create an object of type Manager and you 
immediately assign a reference to a newly created object of type Manager (i.e. 
new Manager()). If you set the reference of the variable manager to null 
afterwards, you throw the newly created object away and it will be cleared up 
by the GC. Maybe you'll take a look in the Standard Java programming course of 
Javapassion to gain a deeper understanding of OO.

Cheers
Lars 


I am trying to discern another programmer's code (good luck I know)

In a class that tests connectivity to a datasource, the first line
after the try { opening up is a statement that I am not clear on.

it is like this
import model.Manager;
public class DataSourceConnectionObject {
public static void main(String[] args) {
try {
Manager manager = null;

is this setting a new object of Manager named manager and setting it
to null ?
it this the same as if manager = new Manager and set manager =null on
second line?

just making sure its not doing something else...
thx


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Java 
EE (J2EE) Programming with Passion! group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~--~~~~--~~--~--~---



[java ee programming] Not Homework?

2009-03-19 Thread lisandrodc

Hi! The following link: http://www.netbeans.org/kb/50/tutorial-taglibrary.html,
for make homework from JSP 1.2 Custom Tags - We are not covering this
topic in this course ¿Do not it have homework?
Thanks!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Java 
EE (J2EE) Programming with Passion! group.
To post to this group, send email to 
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to 
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en
-~--~~~~--~~--~--~---