public inbox for [email protected]  
help / color / mirror / Atom feed
From: Rob Sargent <[email protected]>
To: Arbol One <[email protected]>
Cc: [email protected]
Cc: PostGreSQL MailingList <[email protected]>
Subject: Re: JDBC using REFERENCES
Date: Sun, 24 Nov 2024 19:21:30 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <BYAPR12MB280839EFBCE89927FF95E7D4BA2E2@BYAPR12MB2808.namprd12.prod.outlook.com>
References: <BYAPR12MB280839EFBCE89927FF95E7D4BA2E2@BYAPR12MB2808.namprd12.prod.outlook.com>



> On Nov 24, 2024, at 7:15 PM, Arbol One <[email protected]> wrote:
> 
> 
> In an application that uses JDBC I am trying to use the following statement
> 
>                // Table parameters
>                 var sql = new MyString();
>                 sql.setData("CREATE TABLE IF NOT EXISTS ");
>                 sql.append(this.tableName);
>                 sql.append(" (");
>                 sql.append("index SERIAL NOT NULL, ");
>                 sql.append("id TEXT PRIMARY KEY, ");
>                 sql.append("day TEXT NOT NULL, ");
>                 sql.append("month TEXT NOT NULL, ");
>                 sql.append("year TEXT NOT NULL, ");
>                 sql.append("hour TEXT NOT NULL, ");
>                 sql.append("minute TEXT NOT NULL, ");
>                 sql.append("second TEXT NOT NULL, ");
>                 sql.append("millisecond TEXT NOT NULL, ");
>                 sql.append("am_pm TEXT NOT NULL, ");
>                 sql.append("admin boolean NOT NULL DEFAULT false, ");
>                 sql.append("CONSTRAIN id PRIMARY KEY (id)"); <== Error
>                 sql.append(");");
> 
> but I get a message saying :

> 
> Exception in thread "main" java.sql.SQLException: In company.contact.createTable()
> ERROR: syntax error at or near "("
>   Position: 315
> 

 Collapse all the append()s after rable e and see if parentheses are balanced.
> Does JDBC allow us to do this?
> What am I doing wrong?
> How to fix this
> 
> --
> ArbolOne ™
> Using Fire Fox and Thunderbird.
> ArbolOne is composed of students and volunteers dedicated to providing free services to charitable organizations.
> ArbolOne's development on Java, PostgreSQL, HTML and Jakarta EE is in progress [ í ]


reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: JDBC using REFERENCES
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox