From: Jesus Sandoval <meli@mzt.megared.net.mx>
To: pgsql-admin@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: [Fwd: What may be the url we need to use to connect the Postgres Database with Java]
Date: Tue, 16 Oct 2001 00:13:18 -0400
Message-ID: <3BCBB3DD.1337B3CD@mzt.megared.net.mx> (raw)
Well let me send yo a little example program how to connect to postgresql from
java:
import java.sql.*;
public class Cias {
// Declara e inicializa variables
protected int idCia;
protected String nombre;
public ResultSet rs;
public Cias() throws ClassNotFoundException, SQLException
{
idCia = 0;
nombre = new String();
Class.forName("org.postgresql.Driver");
Connection db =
DriverManager.getConnection("jdbc:postgresql://localhost/prueba","jesus","jesus");
Statement st = db.createStatement();
rs = st.executeQuery("SELECT * from cias");
}
public int getidCia()
{
return idCia;
}
public String getnombre()
{
return nombre;
}
public void leeuno() throws SQLException
{
rs.next();
idCia = rs.getInt(1);
nombre = rs.getString(2);
}
public void leenext() throws SQLException
{
rs.next();
idCia = rs.getInt(1);
nombre = rs.getString(2);
}
}
I hope this help you.
Jesus Sandoval
from Mexico
Moovarkku Mudhalvan escribió:
> Hi friends,
> Greetings. if we use the oracle as backend with Java programming we use
> the url like
>
> jdbc.oracle.thin@ipaddress
> like this do we have any url need to be used in Postgres if so let me know.
>
> The Driver i got it from the Package...
>
> Thanks
> Mudhalvan M.M
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: meli@mzt.megared.net.mx, tgl@sss.pgh.pa.us
Subject: Re: [Fwd: What may be the url we need to use to connect the Postgres Database with Java]
In-Reply-To: <3BCBB3DD.1337B3CD@mzt.megared.net.mx>
References: <3BCBB3DD.1337B3CD@mzt.megared.net.mx>
* 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