Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2009, 04:47 AM
jomet
Guest
 
Posts: n/a
Default

U can use a Database class like below and include it in your jsp page and use it,
so that u get a layer of abstraction

Code:
import java.sql.*;

public class Database
{
  private String uri, username, password;

  public Database() {
    this.uri = "your_uri";
    this.username = "your_username";
    this.password = "your_password";
  }

  public Table getTable( String name ) {
    return new Table( this, name );
  }

  Connection getConnection() throws SQLException {
    Connection connection =
      DriverManager.getConnection( uri, username, password );
    return connection;
  }
}


check,
http://www.ibm.com/developerworks/ja...rap/index.html






Similar Threads
Thread Thread Starter Forum Replies Last Post
Who has the simple registration system which jsp d ½­ÄÏÎÞÇé JSP Basics 1 November 22nd, 2007 02:21 PM
problem in registration form prashant_telkar ASP.NET 1.x and 2.0 Application Design 5 July 11th, 2007 01:09 AM
server registration problem pitter SQL Server 2005 2 December 30th, 2005 11:22 AM
server registration problem pitter SQL Server 2000 1 December 27th, 2005 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.