cancel
Showing results for 
Search instead for 
Did you mean: 

(eclipse) automatic tables => user added to table name

Former Member
3,090

hello,

I am using eclipse on mandriva and SQL Anywhere 12. when I create the tables via JPA (part of JEE5), the Java Persistence API, the tables are created, what is good, but with the format : <user_name>.<table_name>, e.g. "olivier_dba.t_item", but I would like to have "t_item". I saw the logs, and the SQL orders don't mention the user_name : the error seems to come from SQL Anywhere. and it is not a whim from me, but I can't go ahead in my project since there are errors in the java files (because the entities are not found in the DB).

can you help me?

olivier

EDIT - some news : finally I think that the user is not added to the table, but the eclipse plugin (SQL explorer) add the name of the user at the beginning of the name of the table. in sybase central I found that the names of the tables are good.

the error in eclipse is : "schema 'dbo' cannot be resolved for table <the_table>.

any suggestion?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member

If you do not specify a table owner when creating a table (e.g., "CREATE TABLE t_item( ..."), the default behavior is to assign the table to the creating user.

If you want the table to be owned by another user (i.e., in another namespace), you simply need to explicitly include the desired "creator" in the CREATE TABLE command -- for example "CREATE TABLE dbo.t_item( ..." will create a table named t_item within the dbo schema.

Just as an aside, this is a very clear difference between That Other Transact-SQL server and Sybase's product. Microsoft SQL databases default to creating tables in the dbo schema when no table owner is specified, while SQL Anywhere uses the (more rational, IMNSHO) convention of assigning ownership to the user who actually created it.

VolkerBarth
Contributor

It should be added that DBA authority is required to create database objects for different owners.

Users with RESOURCE authority (but not DBA authority) can only create database objects in their own schema.

Former Member
0 Kudos

Ah, good catch.

Thanks.