You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Øyvind Harboe <oy...@zylin.com> on 2008/09/25 09:32:27 UTC

Problems with MS SQL Server and creating merger tokens

I had a database connection set up incorrectly, the
database user did not have the correct
access rights to the database. Not that uncommon
when messing around with restoring MS SQL databases...

This cause the code below to return a list of tokens that tables should
be added to the database.

		DbMerger merger = new DbMerger();
		List<MergerToken> tokens = merger.createMergeTokens(dataNode, dataMap);


I take it that the implementation does not distinguish between failing
to find a database table and not having access to it?


Ideally I'd like the above to throw an exception upon failure...


-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Problems with MS SQL Server and creating merger tokens

Posted by Tore Halset <ha...@pvv.ntnu.no>.
On Sep 26, 2008, at 9:12 , Øyvind Harboe wrote:

> Is there any way I can tell Cayenne to fail(throw exception) if it is
> not able to enumerate the tables?

The jdbc driver/database did not return those tables in the list of  
tables. You can try for your self with some simple jdbc code.

  - Tore.

Re: Problems with MS SQL Server and creating merger tokens

Posted by Øyvind Harboe <oy...@zylin.com>.
On Thu, Sep 25, 2008 at 10:28 PM, Øyvind Harboe <oy...@zylin.com> wrote:
> It turned out in my case that the default schema for that user made it,
> correctly, be zero tables available.

I take this back.

The correct schema was used, but the user did not have the access
rights to enumerate the tables.

Is there any way I can tell Cayenne to fail(throw exception) if it is
not able to
enumerate the tables?




-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Problems with MS SQL Server and creating merger tokens

Posted by Øyvind Harboe <oy...@zylin.com>.
It turned out in my case that the default schema for that user made it,
correctly, be zero tables available.

I.e. there was no error condition and Cayenne did the right thing,
produce the create table merger tokens.



-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

RE: Problems with MS SQL Server and creating merger tokens

Posted by Scott Anderson <sa...@airvana.com>.
I'm not familiar with MSSQL, but in MySQL that's definitely the case - both database and table visibility are opt in, not opt out.

-----Original Message-----
From: oyvindharboe@gmail.com [mailto:oyvindharboe@gmail.com] On Behalf Of Øyvind Harboe
Sent: Thursday, September 25, 2008 4:16 AM
To: user@cayenne.apache.org
Subject: Re: Problems with MS SQL Server and creating merger tokens

On Thu, Sep 25, 2008 at 9:52 AM, Tore Halset <ha...@pvv.ntnu.no> wrote:
> Hello.
>
> The merger get the table info using DbLoader that does a
> jdbcConnection.getMetaData().getTables() to pick up info on all the tables.
> My guess is that the database/jdbc-driver simply does not list the tables
> for your misconfigured user.

So that means that there *is* no way to distinguish between the case where there
are no tables and where the database user does not have access to enumerate
the tables?

Not even in principle?

Ouch!

I wonder how I might deal with this in my application, especially
since it is intended to
run unsupervised(or by a  user not capable of supervising).



-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Problems with MS SQL Server and creating merger tokens

Posted by Øyvind Harboe <oy...@zylin.com>.
On Thu, Sep 25, 2008 at 9:52 AM, Tore Halset <ha...@pvv.ntnu.no> wrote:
> Hello.
>
> The merger get the table info using DbLoader that does a
> jdbcConnection.getMetaData().getTables() to pick up info on all the tables.
> My guess is that the database/jdbc-driver simply does not list the tables
> for your misconfigured user.

So that means that there *is* no way to distinguish between the case where there
are no tables and where the database user does not have access to enumerate
the tables?

Not even in principle?

Ouch!

I wonder how I might deal with this in my application, especially
since it is intended to
run unsupervised(or by a  user not capable of supervising).



-- 
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer

Re: Problems with MS SQL Server and creating merger tokens

Posted by Tore Halset <ha...@pvv.ntnu.no>.
Hello.

The merger get the table info using DbLoader that does a  
jdbcConnection.getMetaData().getTables() to pick up info on all the  
tables. My guess is that the database/jdbc-driver simply does not list  
the tables for your misconfigured user.

  - Tore.

On Sep 25, 2008, at 9:32 , Øyvind Harboe wrote:

> I had a database connection set up incorrectly, the
> database user did not have the correct
> access rights to the database. Not that uncommon
> when messing around with restoring MS SQL databases...
>
> This cause the code below to return a list of tokens that tables  
> should
> be added to the database.
>
> 		DbMerger merger = new DbMerger();
> 		List<MergerToken> tokens = merger.createMergeTokens(dataNode,  
> dataMap);
>
>
> I take it that the implementation does not distinguish between failing
> to find a database table and not having access to it?
>
>
> Ideally I'd like the above to throw an exception upon failure...
>
>
> -- 
> Øyvind Harboe
> http://www.zylin.com/zy1000.html
> ARM7 ARM9 XScale Cortex
> JTAG debugger and flash programmer
>