Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

[Q] violating unique constraint

3 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-05-20 20:31:25.0Z
Michiel Veen Posted on 1997-05-07 08:55:50.0Z
Message-ID: <33704396.6F0E@tcf.nl>
Date: Wed, 07 May 1997 10:55:50 +0200
From: Michiel Veen <michiel@tcf.nl>
Reply-To: michiel@tcf.nl
Organization: The Connection Factory
X-Mailer: Mozilla 3.01 (WinNT; I)
MIME-Version: 1.0
Subject: [Q] violating unique constraint
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 24
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:867
Article PK: 252618

Hi all,

I have created a database with a number of fields defined as
NOT NULL UNIQUE, when I try to insert a duplicate field I get
the proper SQLException. (SQLState: 23000, Message: Attempt to
insert duplicate key row in object 't4' with unique index
't4_v2_17301052042')

I would like to return the database field name of the field that
is violating the Unique Constraint. However I only have the unique
index to work with. (see message above) My table and field names
are rather long so I can not rely on the message (the fieldname
after the first underscore is shortened).

Is there a way (JDBC call) to get the fieldname that is violating
unique constraint? I looked at all the method calls available in
the java.sql package but could not find anything, maybe I missed
something?

Kind Regards
Michiel

--

#-- michiel@tcf.nl
#-- The Connection Factory b.v.
#-- http://www.tcf.nl


Lance Andersen Posted on 1997-05-19 21:13:43.0Z
Message-ID: <3380C287.3D28@sybase.com>
Date: Mon, 19 May 1997 17:13:43 -0400
From: Lance Andersen <lancea@sybase.com>
X-Mailer: Mozilla 3.01Gold (X11; I; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
To: michiel@tcf.nl
Subject: Re: [Q] violating unique constraint
References: <33704396.6F0E@tcf.nl>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 41
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:818
Article PK: 252570

I don't believe that there is a way to accompish what you
request.

Once we implment the rest of the DatabaseMetaData ,you will
be able to get a list of the keys that make up the index.

Michiel Veen wrote:
>
> Hi all,
>
> I have created a database with a number of fields defined as
> NOT NULL UNIQUE, when I try to insert a duplicate field I get
> the proper SQLException. (SQLState: 23000, Message: Attempt to
> insert duplicate key row in object 't4' with unique index
> 't4_v2_17301052042')
>
> I would like to return the database field name of the field that
> is violating the Unique Constraint. However I only have the unique
> index to work with. (see message above) My table and field names
> are rather long so I can not rely on the message (the fieldname
> after the first underscore is shortened).
>
> Is there a way (JDBC call) to get the fieldname that is violating
> unique constraint? I looked at all the method calls available in
> the java.sql package but could not find anything, maybe I missed
> something?
>
> Kind Regards
> Michiel
>
> --
>
> #-- michiel@tcf.nl
> #-- The Connection Factory b.v.
> #-- http://www.tcf.nl

--
===============================================================================
Lance J. Andersen Email: lancea@sybase.com
Sybase Technical Support Phone:(617) 564-6336
77 South Bedford Street Fax: (617) 564-6148
Burlington, MA 01803

The Dark Knight Returns!!! Let's Go Penguins!!!
===============================================================================


David Clegg Posted on 1997-05-20 20:31:25.0Z
Message-ID: <33820A1D.1CB91E0E@sybase.com>
Date: Tue, 20 May 1997 13:31:25 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: Lance Andersen <lancea@sybase.com>, michiel@tcf.nl
Subject: Re: [Q] violating unique constraint
References: <33704396.6F0E@tcf.nl> <3380C287.3D28@sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 53
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:806
Article PK: 252556

The information you are looking for DOES get returned as parameters
as part of the EED stream that comes back from the server. jConnect
has no way to return these to the application so they are discarded.

In the next release (jConnect3.0) was are planning to provide a way
to allow the application to access this information. For now, this
is just not possible.

dave

>
> I don't believe that there is a way to accompish what you
> request.
>
> Once we implment the rest of the DatabaseMetaData ,you will
> be able to get a list of the keys that make up the index.
>
> Michiel Veen wrote:
> >
> > Hi all,
> >
> > I have created a database with a number of fields defined as
> > NOT NULL UNIQUE, when I try to insert a duplicate field I get
> > the proper SQLException. (SQLState: 23000, Message: Attempt to
> > insert duplicate key row in object 't4' with unique index
> > 't4_v2_17301052042')
> >
> > I would like to return the database field name of the field that
> > is violating the Unique Constraint. However I only have the unique
> > index to work with. (see message above) My table and field names
> > are rather long so I can not rely on the message (the fieldname
> > after the first underscore is shortened).
> >
> > Is there a way (JDBC call) to get the fieldname that is violating
> > unique constraint? I looked at all the method calls available in
> > the java.sql package but could not find anything, maybe I missed
> > something?
> >
> > Kind Regards
> > Michiel
> >
> > --
> >
> > #-- michiel@tcf.nl
> > #-- The Connection Factory b.v.
> > #-- http://www.tcf.nl
>
> --
> ===============================================================================
> Lance J. Andersen Email: lancea@sybase.com
> Sybase Technical Support Phone:(617) 564-6336
> 77 South Bedford Street Fax: (617) 564-6148
> Burlington, MA 01803
>
> The Dark Knight Returns!!! Let's Go Penguins!!!
> ===============================================================================