silly question- should that be 'CoffeePot' in the url?
also call getConnection(url); rather than passing empty username/password
regards, paul
> -----Original Message-----
> From: Tarik Makota [mailto:[EMAIL PROTECTED]]
> Sent: 09 August 2000 17:37
> To: [EMAIL PROTECTED]
> Subject: DB Access problem
>
>
> 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
===========================================================================
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