Hi,

I ran your code with slight changes and it works. I
suggest you look at the odbc configuration.

ron

modified code below. if you set break points inside
the rs.next loop you will see the names.


import java.util.*;
import java.sql.*;
import java.net.URL.*;

public class DBLoginBean6{
 private boolean isValid = false;
 private String userName;
 private String userPassword;

 public static void main( String[] args ) {
   DBLoginBean6 db = new DBLoginBean6();
   System.out.println( "n " + db.userName );
 }
 public DBLoginBean6() {
     userName="Initalized";
     userPassword="";
     String url = "jdbc:odbc:d003";
     String query = "SELECT * FROM EMPLOYEE";
     String firstName;
     String lastName;
     boolean more;
     try
     {
        userName="First Try";
        try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        }
        catch (java.lang.ClassNotFoundException ex)
        {
          ex.printStackTrace();
        }
        userName=" connection begin";
        Connection con =
DriverManager.getConnection(url,"","");
        userName="I connected";
        Statement stmt = con.createStatement();
        userName="i created statement";
        ResultSet rs = stmt.executeQuery(query);
        userName="i executed statement";
        while (rs.next())
        {
             firstName = rs.getString("FIRST_NAME");
             lastName = rs.getString("LAST_NAME");
             String s = firstName + " " + lastName;
             System.out.println( s );
             userName = s + " was executed";
        }
        userName="I did while";
        rs.close();
        stmt.close();
        con.close();
        userName="And i ewxited";
     }
     catch (SQLException ex)
  {
      ex.printStackTrace();
     }
 }

 public String getuserName() {
       return userName;
 }
 public String getuserPassword() {
       return "I am user Password";
 }
}



--- Tarik Makota <[EMAIL PROTECTED]>
wrote:
> This is my acctual bean that is supposetly to
> connect to DB:
> I put the 'markers' so that i know where it stops.
>
> As soon as it hits Connection conn = ... it stops
> because in my jsp page print the propert userName
> so that i know wher do i get stuck.
> JSP page is displayed without any errors
>
>
> My DSN  is ok because i have tried User and System.
>
>
>
>
----------------------------------------------------------
> package foo;
> import java.util.*;
> import java.sql.*;
> import java.net.URL.*;
>
>
> public class DBLoginBean6{
>  private boolean isValid = false;
>  private String userName;
>  private String userPassword;
>
>  public DBLoginBean6() {
>      userName="Initalized";
>      userPassword="";
>      String url = "jdbc:odbc:CofeePot";
>      String query = "SELECT * FROM EMPLOYEES";
>      String firstName;
>      String lastName;
>      boolean more;
>      try
>      {
>   userName="First Try";
>         try{
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>   }
>   catch (java.lang.ClassNotFoundException ex)
>        {
>           ex.printStackTrace();
>       }
>       userName=" connection begin";
>         Connection con =
> DriverManager.getConnection(url,"","");
>         userName="I connected";
>         Statement stmt = con.createStatement();
>   userName="i created statement";
>         ResultSet rs = stmt.executeQuery(query);
>         userName="i executed statement";
>         while (more = rs.next())
>         {
>              firstName = rs.getString("FIRSTNAME");
>              lastName = rs.getString("LASTNAME");
>              System.out.println( firstName + " " +
> lastName);
>              userName = "I was executed";
>         }
>   userName="I did while";
>         rs.close();
>         stmt.close();
>         con.close();
>         userName="And i ewxited";
>      }
>      catch (SQLException ex)
>   {
>       ex.printStackTrace();
>      }
>
>
>
>  }
>
>  public String getuserName() {
>        return userName;
>  }
>  public String getuserPassword() {
>        return "I am user Password";
>  }
>
>  }
> ----------------------------
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to