pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedlink to Jsp
2+ messages / 2 participants
[nested] [flat]
* link to Jsp
@ 2008-03-27 14:47 Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
0 siblings, 1 reply; 2+ messages in thread
From: Shavonne Marietta Wijesinghe @ 2008-03-27 14:47 UTC (permalink / raw)
To: pgsql-sql
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";
final String USERNAME = "postgres";
final String PASSWORD = "form";
Class.forName(DRIVER);
return DriverManager.getConnection(URL, USERNAME, PASSWORD);
}
Thanks
Shavonne Wijesinghe
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: link to Jsp
@ 2008-03-27 18:02 Craig Ringer <craig@postnewspapers.com.au>
parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
0 siblings, 0 replies; 2+ messages in thread
From: Craig Ringer @ 2008-03-27 18:02 UTC (permalink / raw)
To: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2008-03-27 18:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-27 14:47 link to Jsp Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
2008-03-27 18:02 ` Craig Ringer <craig@postnewspapers.com.au>
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