Hi,
make conection with DB and access data in following way from any DB.

----------------------------------------------------------------------
        Connection con = null;
          Statement stmt = null;
          ResultSet rst1 = null;
          String url = "jdbc:odbc:DSN-Name";
          String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
          String login = "username";
          String password = "password";
          String QueryStr = "";

      try
      {
          Class.forName(driver);
          con = DriverManager.getConnection(url,login,password) ;
          QueryStr = "SELECT * from LISTING_TBL";
          stmt = con.createStatement();
          rst = stmt.executeQuery(QueryStr);
          if(rst != null)
          {     while(rst.next())
                {       out.print("value of field 1= "+rst.getString(1));
                }

          }
        }
        catch(Exception e)
        {;}
----------------------------------------------------------------------

-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Sebastian Odong-Wodolam
Sent: Friday, April 06, 2001 12:19 AM
To: [EMAIL PROTECTED]
Subject: Re: JSP and Databases


I'm new to JSP and want to know how can I write code for JSP to communicate
with MicroSoft Access DataBase97. If possible, could someone show me some
code or direct me in the right direction.  Thanks.

Sebastian

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
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".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
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