Schematool creates tables in default schema
Hi,
we are using db2 7.2 and have following problem:
We have to create all tables in a specific schema (tolina), so i set up
the kodo-properties to:
com.solarmetric.kodo.impl.jdbc.DictionaryProperties = SchemaName=tolina
I would expect that sql-code will be generated like that:
CREATE TABLE tolina.SomeBO (JDOIDX BIGINT NOT NULL, .....
The Schematool generates creates without schemaname, a bug?
Best regards Claudius
PS: We consider to update to 2.5 is that a problem with our Lizenskey we
bought?
Hi again,
I didn't notice that it worked with automatically generated tables!
When I provide the tablename in the JDO-Metadata then the
getValidTableName() method will be not used. Is that projected?
I use FlatInheritanceMapping, so I want to control the mapping and the
necessary joins through the tablenames...
I look forward to your answer and be patient with me ;o)
Best regards Claudius
Claudius Gr__ver wrote:
Hi Abe,
I have extended com.solarmetric.kodo.impl.jdbc.schema.dict.DB2Dictionary:
public class MyDB2Dictionary extends
com.solarmetric.kodo.impl.jdbc.schema.dict.DB2Dictionary {
public String getValidTableName(String name) {
return "tolina."+name;
As you can see I do not use getSchemaName() because KODO dont care about
the
com.solarmetric.kodo.impl.jdbc.DictionaryProperties = SchemaName=tolina
property. Why is that so? What I have to do to get this property?
I use kodo 2.4.3 SE (bought on 30.01.2003).
When I run the Schematool it says that my Dictionary is used:
[schematool] 10685 [main] INFO jdbc.JDBC - Using dictionary class
"de.tolina.common.jdo.DB2Dictionary" to connect to "DB2/NT" (version
"07.02.0006") with JDBC driver "IBM DB2 JDBC 2.0 Type 2" (version
"07.02.0006")
but it seems that the Schematool dont use my Dictionary because all tables
will be placed in the default db schema! I proved that by some logs.
Can you tell me what I made wrong?
Abe White wrote:
Sorry; I wasn't thinking. There's a much better workaround. Just
override the appropriate methods of the DBDictionary for your database,
and plug your new dictionary into Kodo. See the descriptions of the
com.solarmetric.kodo.impl.jdbc.DBDictionary* configuration properties in
the reference guide.
p.s. You could also use metadata extensions on M-M fields to control the
table name generated, but the above solution using the DBDictionary is
much easier, since you just have to override one method (the
getValidTableName() method, IIRC).
Similar Messages
-
How to create table in another schema of same database
Hi..
I've a database DB1
and has 2 schemas / USers in that..
Usr1 and Usr2...
And i created a TEMP table in Usr1 schema... and created
Then tried the following statement in Usr2 schema...
CREATE TABLE TEMP AS SELECT * FROM Usr1.TEMP;
Then it's giving error that ...
:00942 TABLE OR VIEW DOESN'T EXIST..
What is the reason for that...
Thank youjosh1612 wrote:
What other grants do i need to give so as to replicate the Primary Keys also...????That's not a matter of grants. It's the way the CREATE TABLE AS SELECT statement works. It does not copy over indexes, primary key constraints, unique constraints, foreign key constraints, etc.
If you want to copy all that over, you would probably want to get the DDL from the original table (using the DBMS_METADATA package if you're in a recent version), modify the DDL with the new schema name, create the table, indexes, and constraints, and then do an INSERT ... SELECT to populate the data. Or do an export & import of the table from one schema to another.
Justin -
Create table allows fancy schemas in columns based on user defined types
I just found out that in XE one can create a table with the following definition:
CREATE TABLE "TEST"."TEST" (
"ID" NUMBER,
"LINK" "ABC"."URITYPE",
CONSTRAINT "PK_EMP" PRIMARY KEY ("ID")
);even if schema "ABC" doesn't exist.
Likewise you can specify an existing schema on which you don't hold any privilege.
CREATE TABLE "TEST"."TEST" (
"ID" NUMBER,
"LINK" "SCOTT"."URITYPE",
CONSTRAINT "PK_EMP" PRIMARY KEY ("ID")
);If you get the DDL using SQLDeveloper, in the former case you'll get the column without schema, in the latter case, if will retain the schema specification.
I discovered this because SQLDeveloper 2.1.1.64 seems to add the current schema to certain objects like XMLTYPE and URITYPE, even if their schema should be SYS.
I imagine that there must some problem at the parser level but also in DBMS_METADATA.
Flavio
http://oraclequirks.blogspot.comI just found out that in XE one can create a table with the following definition:
CREATE TABLE "TEST"."TEST" (
"ID" NUMBER,
"LINK" "ABC"."URITYPE",
CONSTRAINT "PK_EMP" PRIMARY KEY ("ID")
);even if schema "ABC" doesn't exist.
Likewise you can specify an existing schema on which you don't hold any privilege.
CREATE TABLE "TEST"."TEST" (
"ID" NUMBER,
"LINK" "SCOTT"."URITYPE",
CONSTRAINT "PK_EMP" PRIMARY KEY ("ID")
);If you get the DDL using SQLDeveloper, in the former case you'll get the column without schema, in the latter case, if will retain the schema specification.
I discovered this because SQLDeveloper 2.1.1.64 seems to add the current schema to certain objects like XMLTYPE and URITYPE, even if their schema should be SYS.
I imagine that there must some problem at the parser level but also in DBMS_METADATA.
Flavio
http://oraclequirks.blogspot.com -
Creating table under SOAINFRA schema
hi all,
As iam a fresher in oracle fmw i need to know about how to create a table under SOAINFRA schema.You can't, directories are database wide objects, see:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5007.htm#i2061958
...+All directories are created in a single namespace and are not owned by an individual schema+...
HTH
Enrique -
How to create table for XML schema-based Interface form
Hi All,
With tcode SFP to crate a XML schema-based Interface form, how to create a defined table can be listed in "Data View"?
Just like APAP Dictonary- Based Interface form, that we can drag a defined table from data view to the panel.Hi,
Just follow these steps:
1. Create interactive form UI element in your view.
2. Now provide Datasource and PDFSOURCE to it in form properties.
3. Now give a template name prefix with 'Z' or 'Y'.
4. Double click on it. It will prompt for interface name.
5. Provide interface name prefixed with 'Z' or 'Y'.
6. Click on Context button in the Pop up window and provide the node you have selected as DATASOURCE.
7. Click ok and it will open the form designer.
8. In this way you can create a XML Schema based Form.
9. Activate the interface and design the form providing layout type and other details.
Hope it will help.
Regards,
Vaibhav -
HI,
is there any possibilty to create a relational table from a XML schema?Can you use a schema when we compose XML doc from Database tables?
Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me. -
Create tables in different database schemas using EJB 3 Entity Persistent
Hi All,
I would like to find out how to get the following tasks done using EJB 3.0 Java Entity Persistent:
( i ) Create tables in different schemas such as STUDENT under EDUCATION schema and table PATIENT in HOSPITAL schema. We can then reference them in SQL as EDUCATION.STUDENT and HOSPITAL.PATIENT.
( ii ) Reference these tables uniquely once they are created.
There are no pre-existing tables or naming conventions that needs to be adhere to in this situation.
I have no problem creating tables on the current schema in EJB 3.0 Java Entity Persistent.
Any suggestions would be appreciated.
Thanks,
JackUse the schema attribute of the Table annotation:
package javax.persistence;
@Target({TYPE}) @Retention(RUNTIME)
public @interface Table
String name( ) default "";
String catalog( ) default "";
String schema( ) default "";
UniqueConstraint
uniqueConstraints( ) default {};
} -
Accessing tables in other than default schema.
Hi Experts,
I am using an Enterprise Bean (Stateless) that uses Common JDBC
to connect to the Java Schema of the WAS. I have created a
DataSource alias (created on Default Datasource) and using it for connection.
My requirement is to <b>get a list of all tables created in the Default schema</b>.
But when I use DatabaseMetadta.getTables() method, for this type of connection
it throws out the following exception:
<b>java.lang.UnsupportedOperationException: Method getTables() not supported by Common JDBC</b>
I have even tried using the query "Select * from USER_TABLES", but with this one,
an SQL Exception is thrown saying:
<b>com.sap.sql.log.OpenSQLException: The SQL statement "SELECT "TABLE_NAME" FROM "USER_TABLES"" contains
the semantics error[s]: table "USER_TABLES" unknown</b>
Please tell my how can I use tables in other than the default schema.
Regards,
Alka.Hi Alka,
from your post, it is not entirely clear to me what you are atempting to do.
1) Do you need help with accessing tables in a non-default schema?
2) Do you want to determine all tables in the default schema?
If 1), please follow the hints given by Vladimir Pavlov.
If 2), currently, the method DatabaseMetaData.getTables() is unfortunately not supported in Open SQL/JDBC. We are currently preparing a new download of the NetWeaver Java EE 5 edition. In this version, the getTables() method will be supported.
Or do you just want to check for the existence of a specific database table in the default schema?
I hope this helps,
Best regards,
Adrian -
ORA-00600 problem when create XMLType table with registerd schema
Hi,
I am using Oracle9i Enterprise Edition Release 9.2.0.4.0 on RedHat Linux 7.2
I found a problem when I create table with registered schema with follow content:
<xs:element name="body">
<xs:complexType>
<xs:sequence>
</xs:sequence>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="class" type="xs:NMTOKENS"/>
<xs:attribute name="style" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="body.content">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="p"/>
<xs:element ref="hl2"/>
<xs:element ref="nitf-table"/>
<xs:element ref="ol"/>
</xs:choice>
<xs:attribute name="id" type="xs:ID"/>
</xs:complexType>
</xs:element>
Does Oracle not support element reference to other element with dot?
For instance, body -> body.content
Thanks for your attention.Sorry, amendment on the schema
<xs:element name="body">
<xs:complexType>
<xs:sequence>
<xs:element ref="body.head" minOccurs="0"/>
<xs:element ref="body.content" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="body.end" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="id" type="xs:ID"/>
<xs:attribute name="class" type="xs:NMTOKENS"/>
<xs:attribute name="style" type="xs:string"/>
</xs:complexType>
</xs:element> -
How to create table from one to another schema?
Hi,
There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
thanks in advance
Thanks,user2017273 wrote:
Hi,
There is two schema A and B. schema A want to create table on Schema. which privilege we need to provide? how to create?
thanks in advance
Thanks,When you give CREATE ANY TABLE TO A then user A will create table on any schema.But you can create stored PROCEDURE on schema B for creating table and give GRANT EXECUTE <PROC NAME> to A. -
Problems on creating table under schema for BPM Demo project
hi,
i have not enough experience in database concepts, but i can create ,insert and modify the tables and data by using SQL query in oracle database 10 g express edition
The reason behind send this qurery is i wanted to create the database tables under "Quote" schema., which is necessary to store and retrive data for my BPM demo project.
Two important . Sql scirpt file namely create_user.sql and quote.sql used to create the database tables under "quote" schema available on e:/bpm/sql
i could create "quote" schema by this command on commandline,
>cd e:/bpm/sql
>sqlplus sys/welcome as sysdba @create_user.sql quote quote
but when creating database tables under "quote" schema , i got "SP2-0734 - unknown command exception thrown
in commandline i was used like this to create table,
>sqlplus quote quote @quote.sql
Can anyone who familiar with database query concept help me to create tables on "quote " schema,
thanks in advanceHello,
Please find enclosed a complete chapter about the CREATE TABLE statement:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2095331
At the end there're many examples.
Hope this help.
Best regards,
Jean-Valentin -
Create table with references pointing to values in a different schema
Experts,
Is it possible to create table in one schema with references pointing to column values in a different schema?
Say, I have 2 schemas A and B
A has employee table and and B has dept table, I want to run the below alter statement, will this work?
ALTER TABLE A.EMP ADD (
FOREIGN KEY (DEPT_ID)
REFERENCES B.DEPT (DEPT_ID));
I know there is no sense in doing this, still would like to know for making some temporary workaround.
Regards,
Sarvan
Edited by: sarvan on Oct 21, 2011 12:30 AMYes this is possible with right privilege:
SQL> grant connect, resource to a identified by a;
Grant succeeded.
SQL> grant connect, resource to b identified by b;
Grant succeeded.
SQL> connect b/b
Connected.
SQL> create table p (x int primary key);
Table created.
SQL> grant references on p to a;
Grant succeeded.
SQL> connect a/a
Connected.
SQL> create table c (y int);
Table created.
SQL> alter table c add foreign key (y) references b.p(x);
Table altered. -
How to move one table to other schema
Hi;
imagine i have one schema A and i create table in this schema as test. Now i have one other schema,name is B. I wanna move my A.test table to B.test2
How i can do it?
thanksFollowing discussion might help How to move the table to the another schema?
-
How to create tables and views and procedures in other users as one
HI to all,
I am having a user named vijay and i am trying to create the tables in user srini as user vijay
in user vijay i'm having tables
1. company
2. department
i wrote one procedure
create or replace procedure sp_createobjects{short_name in varchar2}
{my openbracket key is not working so that i put open braces here}
as
cursor table_name is select object_name from dba_tables where object_type = 'TABLE';
var_table_name varchar2{1000};
begin
open table_name;
loop
fetch table_name into var_table_name;
execute immediate 'create table ' || short_name || '.' || var_table_name || ' as select * from '||var_table_name;
end loop;
end;
the procedure is created sucessfully. but when i am trying to execute the procedure it is throwing the error as insufficient privileges.
my 2nd question is how to create the procedures into the other user?
Thanks in advanceFirst of all, your query "from dba_tables where object_type = 'TABLE'" returns all tables, not just the tables of the user vijay.
So there are two possibilities, you may be getting the error because you cannot select from another user's table or you may be getting the error because you cannot create a table under the user srini. To create tables in another schema you need the "create any table" privilege. -
Question about GRANT CREATE TABLE permission
Hi,
How can I grant permission to UserA to create tables in UserB/SchemaB. I understand that "CREATE TABLE" will give permission to the user to create tables within its own schema and "CREATE ANY TABLE" will give permission to the user to create tables in ANY schema.
Is there a command to give CREATE TABLE to specific schema? Please advice ... Thanks!Is there a command to give CREATE TABLE to specific schema? Please advice ... Thanks!No but you can create your own solution
have SCHEMA_B create a procedure, MAKE_SCHEMA_B_TBL, that issues command below
EXECUTE IMMEDIATE CREATE TABLE ........
then do as below
GRANT EXECUTE ON MAKE_SCHEMA_B_TBL TO SCHEMA_A;
Maybe you are looking for
-
SharePoint: Workflows - Emailing hyperlink of list item.
I have a custom SharePoint (2013) list to manage tasks assigned to personnel and keep track of their statuses. I've created a workflow using SP Designer to send out an email to whom the task is assigned on the date for which it's due. The workflow is
-
I have a brand new iPhone and it has only been recognized once by iTunes and that was after a complete uninstall re-install of iTunes and connecting and re-connecting multiple times. iTunes sees the device every time I put the iPhone in recovery mode
-
Can I embed Artwork in iTunes files on my G4 Flat Panel?
Can I embed the artwork from a CD album in each file in iTunes so that they can be visible on my new Sonos sound system? I have a iMac G4 Flatpanel with OS X 10.5.8.
-
Problem in Saving Images in Single Folder in Nokia...
I want to know how to transfer images keeping it in folder. I connect my E63 with USB.I copied my "Photos" folder from my laptop,then opened "File Manager" in Nokia PC suit. There I get 2 options. 1)Memory Card 2) Phone Memory.I select memory card, I
-
My iPad is froze up, how can i restore it without losing everything?
my ipad froze up? cant do anything. how can i restore without losing everything?