X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 662689FA380 for ; Wed, 13 Sep 2006 14:02:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 60761-01 for ; Wed, 13 Sep 2006 14:02:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.232]) by postgresql.org (Postfix) with ESMTP id 9C20A9FA20E for ; Wed, 13 Sep 2006 14:02:26 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id t13so2521485wxc for ; Wed, 13 Sep 2006 10:02:25 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=sXv+V480y4HgVaribuXhyCLwO/tnPb4BEgr4gXUosLCz8SpYzolh4InCwx6paPfPGcnDtpAcQAYE4fvQ51xxCYRmaUmawgd+kI6aKRyDBGNZUPtSBh+W1K1l4S4il3qq8JUgtc+xkTSUy9PvWomconUgcOUFqPSrD3irphsUJPU= Received: by 10.70.75.14 with SMTP id x14mr10742324wxa; Wed, 13 Sep 2006 10:02:25 -0700 (PDT) Received: by 10.70.48.18 with HTTP; Wed, 13 Sep 2006 10:02:25 -0700 (PDT) Message-ID: <6daed2a30609131002x70758ecftb75810809729212e@mail.gmail.com> Date: Wed, 13 Sep 2006 19:02:25 +0200 From: "=?ISO-8859-1?Q?Enrique_Rodr=EDguez_Lasterra?=" To: pgsql-jdbc@postgresql.org Subject: PreparedStatement and CreateTable MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_244680_2426395.1158166945329" X-Google-Sender-Auth: 1959aebc96e1c860 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.195 tagged_above=0 required=5 tests=AWL, HTML_30_40, HTML_MESSAGE, SPF_PASS X-Spam-Level: * X-Archive-Number: 200609/49 X-Sequence-Number: 15767 ------=_Part_244680_2426395.1158166945329 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I get an error when i create a table using preparedstatement with some parameters "?". Is this a non standard function? With JDBC 7.4 it runs prefectly but with 8.x no. Here is all the info. Code package test; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; /** * DB * * @version 1.0 * @since 13-sep-2006 */ public class DB { public static void main(String[] args) { Connection connection =3D null; try { Class.forName("org.postgresql.Driver"); connection =3D DriverManager.getConnection("jdbc[tongue]ostgresql://192.168.4.221/canyamo-= test", "canyamo-test", "canyamo-test"); PreparedStatement stmt =3D connection.prepareStatement("create table orders ( id integer not null, client character varying(15) default ? not null)"); stmt.setObject(1, "without-name"); stmt.executeUpdate();//stmt.execute(); } catch (Exception e) { e.printStackTrace(); } } } Exception org.postgresql.util.PSQLException: ERROR: there is no parameter $1 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse( QueryExecutorImpl.java:1527) at org.postgresql.core.v3.QueryExecutorImpl.processResults( QueryExecutorImpl.java:1311) at org.postgresql.core.v3.QueryExecutorImpl.execute( QueryExecutorImpl.java:190) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute( AbstractJdbc2Statement.java:452) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags( AbstractJdbc2Statement.java:354) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate( AbstractJdbc2Statement.java:308) at test.DB.main(DB.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke( DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.intellij.rt.execution.application.AppMain.main(AppMain.java :90) Versions JDBC: 8.1.404 Database: 8.1.4 --=20 _______________________________ Enrique Rodriguez Lasterra lasterra AT javahispano DOT org http://www.javahispano.org Asociaci=F3n sin =E1nimo de lucro sobre java Spanish non profit association about java ------=_Part_244680_2426395.1158166945329 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I get an error when i create a table using preparedstatement with some para= meters "?".

Is this a non standard function?

With J= DBC 7.4 it runs prefectly but with 8.x no.

Here is all the info.

Code

package test;
=
import java.sql.Connection;
import java.sql.DriverManager;
import= java.sql.PreparedStatement;

/**
* DB
*
* @version 1.0
* @since 13-sep-2006
*/
public class DB {
   public stat= ic void main(String[] args) {
       Conne= ction connection =3D null;
       try {           Class.forName= ("org.postgresql.Driver");
      = ;     connection =3D=20 DriverManager.getConnection("jdbc[tongue]ostgresql://192.168.4.221/can= yamo-test", "canyamo-test", "canyamo-test");
&n= bsp;          PreparedStatemen= t stmt =3D connection.prepareStatement("create table orders ( id integ= er not null, client character varying(15) default ? not null)");
           stmt.setOb= ject(1, "without-name");

     &nb= sp;     stmt.executeUpdate();//stmt.execute();
 = ;      } catch (Exception e) {
  &nbs= p;        e.printStackTrace();
 =       }
   }
}

Exception

org.postgresql.util.PSQLException: ERROR: there is= no parameter $1
       at org.postgresql.= core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1527)=
       at org.postgresql.core.v3.QueryExe= cutorImpl.processResults (QueryExecutorImpl.java:1311)
       at or= g.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:190)<= br>       at org.postgresql.jdbc2.AbstractJdb= c2Statement.execute(AbstractJdbc2Statement.java:452)
       at org.postgresql.jdbc2.AbstractJdbc2S= tatement.executeWithFlags(AbstractJdbc2Statement.java:354)
  &= nbsp;    at org.postgresql.jdbc2.AbstractJdbc2Statement.exec= uteUpdate(AbstractJdbc2Statement.java:308)
     = ;  at=20 test.DB.main(DB.java:23)
       at sun.ref= lect.NativeMethodAccessorImpl.invoke0(Native Method)
   &= nbsp;   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMeth= odAccessorImpl.java:39)
       at sun.refl= ect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
     &nb= sp; at java.lang.reflect.Method.invoke(Method.java:324)
  &nbs= p;    at com.intellij.rt.execution.application.AppMain.main(= AppMain.java:90)


Versions
JDBC: 8.1.404
Database: 8.1.4

--
_______________________________=
Enrique Rodriguez Lasterra
lasterra AT javahispano DOT org
http://www.javahispano.org
Asociaci= =F3n sin =E1nimo de lucro sobre java
Spanish non profit association about java ------=_Part_244680_2426395.1158166945329--