JDBC using REFERENCES

From: Arbol One <ArbolOne(at)hotmail(dot)ca>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>, PostGreSQL MailingList <pgsql-general(at)postgresql(dot)org>
Subject: JDBC using REFERENCES
Date: 2024-11-25 02:15:09
Message-ID: BYAPR12MB280839EFBCE89927FF95E7D4BA2E2@BYAPR12MB2808.namprd12.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

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 [ í ]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Arbol One 2024-11-25 02:15:27 JDBC using REFERENCES
Previous Message Michel Pelletier 2024-11-25 02:02:17 Re: Using Expanded Objects other than Arrays from plpgsql