Create Schema or Create Database in Java

Posted by brucejin on 28-Mar-2011 13:56

I installed OpenEdge om Wondows box. I used OEA to create a database sports2000a. I can see there is a schema PUB in this database.

Now I want to create more schemas in sports2000a using in Java code:

sql = "CREATE SCHEMA myschema";

stmt.executeUpdate(sql); 

I received this error:

Driver loaded.

Connected to: jdbc:datadirect:openedge://192.168.0.125:6000;databaseName=sports2000a

connection failed with:'[DataDirect][OpenEdge JDBC Driver][OpenEdge] Syntax error in SQL statement at or about "SCHEMA myschema" (10713)'

java.sql.SQLException: [DataDirect][OpenEdge JDBC Driver][OpenEdge] Syntax error in SQL statement at or about "SCHEMA myschema" (10713)

Can I create schema?

Thanks

All Replies

Posted by Admin on 28-Mar-2011 14:01

sql = "CREATE SCHEMA myschema";

Try to put qoutes around myschema or end the SQL statement with a semicolon.

Can I create schema?

Yes.

Posted by brucejin on 28-Mar-2011 14:07

Hi Mike,

I tried both and they fail:

create schema "myschema" or

create schema myschema;

I did this in Java JDBC code and in a SQL tool DBVisualizer.

Thanks!

Posted by Admin on 28-Mar-2011 14:16

Sorry my mistake... In OpenEdge you don't create schema. Users are the owner of all objects. So you'd create a user "myschema".

See http://documentation.progress.com/output/OpenEdge102b/pdfs/dmsrf/dmsrf.pdf for details.

Posted by brucejin on 28-Mar-2011 14:29

CREATE USER works.

create  user 'myschema','password'

Now I can create tables in 'myschema'.

I wonder when the password will be used.

Thanks so much!

Posted by Admin on 28-Mar-2011 14:36

I wonder when the password will be used.

 

Well, it's a user. So unless it get's revoked the user can login and access his data using the password.

Posted by brucejin on 28-Mar-2011 14:43

I see.

Thank you so much for your help!

This thread is closed