X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6008654469 for ; Tue, 10 May 2005 14:38:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 26425-01 for ; Tue, 10 May 2005 17:38:10 +0000 (GMT) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.192]) by svr1.postgresql.org (Postfix) with ESMTP id 20DFC5445F for ; Tue, 10 May 2005 14:38:08 -0300 (ADT) Received: by zproxy.gmail.com with SMTP id 9so1383367nzo for ; Tue, 10 May 2005 10:38:08 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=Oz5GoPMEyw2Yk1bNeVJPblnwvSjUfIET9ZQxlLeWbfCLqxhcJuCQW91KGcS9XBvK/uO8dbnxOABoT9hR5AGZvFWN7q0Hfj0+fbt4O5hRn+frWxDVroHHsq94gCSygy1/grxVUYLJvvs7ZgkKu7fR6iAyXzjXnouxnBRGLiprnTc= Received: by 10.36.37.3 with SMTP id k3mr1654141nzk; Tue, 10 May 2005 10:38:08 -0700 (PDT) Received: by 10.36.106.12 with HTTP; Tue, 10 May 2005 10:38:08 -0700 (PDT) Message-ID: Date: Tue, 10 May 2005 14:38:08 -0300 From: Franco Bruno Borghesi Reply-To: Franco Bruno Borghesi To: "boleguy@adinet.com.uy" Subject: Re: java.sql.SQLException: No suitable driver Cc: pgsql-jdbc@postgresql.org In-Reply-To: <4246295D0005CB56@nfs01.in.adinet.com.uy> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2951_19723429.1115746688289" References: <4246295D0005CB56@nfs01.in.adinet.com.uy> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.631 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, HTML_60_70, HTML_MESSAGE, RCVD_BY_IP, TO_ADDRESS_EQ_REAL X-Spam-Level: X-Archive-Number: 200505/41 X-Sequence-Number: 12872 ------=_Part_2951_19723429.1115746688289 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ok, but you don't need to shout! :P Two things: 1)have you added your jar to the project's java build path? (if you did, go= =20 to the second) right click on the project name, select Properties, go to Ja= va=20 Build Path, go to the Libraries tab, click Add External Jars and find your= =20 pgxxxxxxxxxx.jar 2) be sure to load the driver first doing a Class.forName(" org.postgresql.Driver"); in your code. Also check your url, it should be=20 "jdbc:postgresql://172.16.100.110:5432/benjamin" If it works, have a mate for me ;-) 2005/5/10, boleguy@adinet.com.uy : >=20 > HI: > I'M TRYING TO CONNECT AN ECLIPSE 3.01 IDE RUNNING ON WINDOWS XP WITH A DB > POSTGRESQL VERSION 7.4.7. I USED THE FOLLOWINGS DRIVERS: PG.74.213 > /4/5/6.JDBC3.JAR > AND NO ONE WORKS. >=20 > THE MESSAGE WAS THE FOLLOWING: > Cargando clase > IWAV0055I Java Bean frenchconn.connpost started with the main method > java.sql.SQLException: No suitable driver > at java.sql.DriverManager.getConnection(Unknown Source) > at java.sql.DriverManager.getConnection(Unknown Source) > at frenchconn.connpost.agregarCliente(connpost.java:33) > at frenchconn.connpost.main(connpost.java:69) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at=20 > org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main= ( > JavaBeansLauncher.java:86) >=20 > AND THE CODE (MY CODE): >=20 > import java.sql.*; > import java.sql.DriverManager; > import java.sql.PreparedStatement; >=20 > //import samples.jdbc.JDBCTest; >=20 > /** > * @author Benjamin > * > * TODO To change the template for this generated type comment go to > * Window - Preferences - Java - Code Style - Code Templates > */ > public class connpost { >=20 > static { > System.out.println("Cargando clase"); > } >=20 > public void agregarCliente(long idCliente, > String nombre) { > try { > String url =3D "jdbc:postgres://172.16.100.110:5432/benjamin"; > Connection conn =3D null; > conn =3D DriverManager.getConnection(url,"benjamin", "benja1"); > DriverManager.getDriver("org.postgresql.Driver"); >=20 > String sql =3D > "INSERT INTO Cliente " + > "(IdCliente, Nombre) " + > "VALUES (?,?)"; >=20 > PreparedStatement ps =3D > conn.prepareStatement(sql); >=20 > ps.setLong(1, idCliente); > ps.setString(2, nombre); >=20 > ps.executeUpdate(); >=20 > ps.close(); >=20 > conn.close(); >=20 > System.out.println("Cliente insertado OK"); > } > catch (Exception ex) { > ex.printStackTrace(); > } > } >=20 > public static void main(String[] args) { >=20 > try { > // Cargo el driver JDBC de postgres > Class.forName("org.postgresql.Driver"); >=20 > connpost conn =3D new connpost(); > //jdbcTest.agregarCliente(1, "Pepe"); > //jdbcTest.agregarCliente(2, "Juan"); > conn.agregarCliente(123,"pepe"); >=20 > // jdbcTest.transaccion(); > } > catch (Exception ex) { > ex.printStackTrace(); > } > } > } >=20 > THANKS FOR EVERYTHING TO ANYONE >=20 > BENJAMIN >=20 > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > ------=_Part_2951_19723429.1115746688289 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ok, but you don't need to shout! :P

Two things:

1)have you added your jar to the project's java build path? (if you did, go= to the second) right click on the proje= ct name, select Properties, go to Java Build Path, go to the= Libraries tab, click Add External Jars and find your pgxxxxxxxxxx= .jar

2) be sure to load the driver first doing a Class.forName("org.postgresql.Driver"); in your code. = Also check your url, it should be "jdbc: postgresql://172.16.100.110:5432/benjamin"

If it works, have a mate for me ;-)


2005/5/10, boleguy@adinet.com.uy <boleguy@adinet.com.uy>:
HI:
I'M TRYING TO CONNECT AN ECLIPSE 3.01 IDE RUNNING ON WINDOWS XP WITH= A DB
POSTGRESQL VERSION 7.4.7. I USED THE FOLLOWINGS DRIVERS: PG.74.213= /4/5/6.JDBC3.JAR
AND NO ONE WORKS.

THE MESSAGE WAS THE FOLLOWING:
Cargando clase
IWAV0055I Java Bean frenchconn.connpost started with = the main method
java.sql.SQLException: No suitable driver
  = ;      at java.sql.DriverManager.getConnectio= n(Unknown Source)
        at jav= a.sql.DriverManager.getConnection (Unknown Source)
        at fren= chconn.connpost.agregarCliente(connpost.java:33)
    = ;    at frenchconn.connpost.main(connpost.java:69)
&= nbsp;       at sun.reflect.NativeMethodA= ccessorImpl.invoke0(Native Method)
      &= nbsp; at=20 sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  =       at sun.reflect.DelegatingMethodAccessor= Impl.invoke(Unknown Source)
       &n= bsp;at java.lang.reflect.Method.invoke(Unknown Source)
   = ;     at org.eclipse.ve.internal.java.vce.launcher= .remotevm.JavaBeansLauncher.main (JavaBeansLauncher.java:86)

AND THE CODE (MY CODE):

import ja= va.sql.*;
import java.sql.DriverManager;
import java.sql.PreparedStat= ement;

//import samples.jdbc.JDBCTest;

/**
* @author Benj= amin
*
* TODO To change the template for this generated type comment go= to
* Window - Preferences - Java - Code Style - Code Templates
*/<= br>public class connpost {

       = ; static {
         &n= bsp;  System.out.println ("Cargando clase");
       =    }

        = public void agregarCliente(long idCliente,
    &nbs= p;            &= nbsp;    String nombre) {
          &n= bsp;         try {
 &n= bsp;            = ;        String url =3D "jdbc:postgres://172.16.100.110:5432/benjamin";
   =             &nb= sp;      Connection conn =3D null;
         &nb= sp;            = conn =3D DriverManager.getConnection(url,"benjamin", "benja1"= ;);
           &n= bsp;         DriverManager.getDriver("org.postgresql.Driver");

 &n= bsp;            = ;        String sql =3D
          &nbs= p;            &= nbsp;"INSERT INTO Cliente " +
        &n= bsp;            = ;   "(IdCliente, Nombre) " +
         &= nbsp;           &nbs= p;  "VALUES (?,?)";

         &= nbsp;           &nbs= p;PreparedStatement ps =3D
           = ;            &n= bsp;conn.prepareStatement(sql);

      =             &nb= sp;   ps.setLong(1, idCliente);
          =             ps.= setString(2, nombre);

          = ;            ps= .executeUpdate();

        &n= bsp;            = ; ps.close();

        &= nbsp;           &nbs= p; conn.close();

       &nbs= p;            &= nbsp; System.out.println("Cliente insertado OK");
        &nb= sp;           }
&= nbsp;           &nbs= p;       catch (Exception ex) {
         &= nbsp;           &nbs= p;ex.printStackTrace();
        =             }            &= nbsp;     }

     &= nbsp;  public static void main(String[] args) {

 &nbs= p;            &= nbsp; try {
         &= nbsp;           &nbs= p;// Cargo el driver JDBC de postgres
      &nb= sp;            =    Class.forName("org.postgresql.Driver");

=             &nb= sp;         connpost conn =3D new connpost();
        = ;            &n= bsp; //jdbcTest.agregarCliente(1, "Pepe");
         = ;            &n= bsp;//jdbcTest.agregarCliente(2, "Juan");
         = ;            &n= bsp;conn.agregarCliente(123,"pepe");

//   &= nbsp;           &nbs= p;    jdbcTest.transaccion();
   &nbs= p;            &= nbsp;   }
        = ;            ca= tch (Exception ex) {
         &= nbsp;           &nbs= p;ex.printStackTrace();
        =             }        }
}

THANKS FOR = EVERYTHING TO ANYONE

BENJAMIN

---------------------------(end= of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command    (send "unregister YourEmailAddressHere" = to majordomo@postgresql.org= )

------=_Part_2951_19723429.1115746688289--