[Fwd: What may be the url we need to use to connect the Postgres Database with Java]

Поиск
Список
Период
Сортировка
От Jesus Sandoval
Тема [Fwd: What may be the url we need to use to connect the Postgres Database with Java]
Дата
Msg-id 3BCBB3DD.1337B3CD@mzt.megared.net.mx
обсуждение исходный текст
Список pgsql-admin
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


В списке pgsql-admin по дате отправления:

Предыдущее
От: "Moovarkku Mudhalvan"
Дата:
Сообщение: Re: What may be the url we need to use to connect the Postgres Database with Java
Следующее
От: "Nick Fankhauser"
Дата:
Сообщение: Re: What may be the url we need to use to connect the Postgres Database with Java