pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
Cc: pgsql-sql@postgresql.org
Subject: Re: link to Jsp
Date: Fri, 28 Mar 2008 03:02:31 +0900
Message-ID: <47EBE137.8060009@postnewspapers.com.au> (raw)
In-Reply-To: <013001c89019$88e91d20$0602a8c0@DREAM>
References: <013001c89019$88e91d20$0602a8c0@DREAM>

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



view thread (2+ messages)

Message-ID: <47EBE137.8060009@postnewspapers.com.au>
Permalink:  ../47EBE137.8060009@postnewspapers.com.au/
Also on:    postgresql.org/message-id/47EBE137.8060009@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: craig@postnewspapers.com.au, shavonne.marietta@studioform.it
  Subject: Re: link to Jsp
  In-Reply-To: <47EBE137.8060009@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox