Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id A44CA2E008C for ; Thu, 27 Mar 2008 15:02:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 85336-03-2 for ; Thu, 27 Mar 2008 15:02:34 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by postgresql.org (Postfix) with ESMTP id 1CE2A2E0097 for ; Thu, 27 Mar 2008 15:02:36 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 315E7D559A; Fri, 28 Mar 2008 03:02:30 +0900 (WST) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 99DE01E0434; Fri, 28 Mar 2008 03:02:31 +0900 (WST) Message-ID: <47EBE137.8060009@postnewspapers.com.au> Date: Fri, 28 Mar 2008 03:02:31 +0900 From: Craig Ringer User-Agent: Icedove 1.5.0.12 (X11/20070607) MIME-Version: 1.0 To: Shavonne Marietta Wijesinghe Cc: pgsql-sql@postgresql.org Subject: Re: link to Jsp References: <013001c89019$88e91d20$0602a8c0@DREAM> In-Reply-To: <013001c89019$88e91d20$0602a8c0@DREAM> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/201 X-Sequence-Number: 30529 Shavonne Marietta Wijesinghe wrote: > Hello > > I'm trying to connect to my postgresql db from a JSP page but my db is on one computer and the jsp in another.. > > Has anyone done something like this before?? > > private synchronized Connection getConnection() throws ClassNotFoundException, > SQLException { > final String DRIVER = "org.postgresql.Driver"; > final String URL = "jdbc:postgresql:FormAjax"; Read the documentation for the PostgreSQL JDBC layer, particularly the part about the JDBC URL. I quote: ------------ The JDBC URL In JDBC all url's begin with jdbc:protocol: This is the standard. After this is driver specific, and no two drivers are the same. So our url? It's one of the following: jdbc:postgresql:database jdbc:postgresql://host/database jdbc:postgresql://host:port/database where database is the database to connect to, host the server to connect to, and port the port number. If left out, host defaults to localhost (not 127.0.0.1 see applets!) and port to 5432 (configurable at build time). ----------- -- Craig Ringer