LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
AKRRKA
Posts: 194
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by AKRRKA » Tue 27 Aug 2013 08:29

My Code:

Code: Select all

var contextForCreateDatabase = new ceDataContext(ConnectionString, mappingSource);
if (contextForCreateDatabase.DatabaseExists())
 {
  MessageBox.Show("Database already exist!");
 }
else
 {
  contextForCreateDatabase.CreateDatabase(false, true);
 }
Connection String is (ConnectionString):
"user id=sys;password=*;server=XE;connect mode=SysDba;direct=True;sid=XE;persist security info=True"

Database:
- Oracle 11 XE;
- User "sys", pass "1";
- Need create schema with name "CEDATABASE";

Question:
-What should be the connection string (ConnectionString) for this? Please give me the right example.

Thanks!

PS: I think this issue is related to the others: Link to topic.

Shalex
Devart Team
Posts: 8088
Joined: Thu 14 Aug 2008 12:44

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by Shalex » Thu 29 Aug 2013 16:32

We have answered about context.DatabaseExists() at http://forums.devart.com/viewtopic.php?f=31&t=27794.
AKRRKA wrote:Question:
-What should be the connection string (ConnectionString) for this? Please give me the right example.
Could you please describe the problem with your current connection string? Is there any error (specify the exact text) or incorrect behaviour?

AKRRKA
Posts: 194
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by AKRRKA » Fri 30 Aug 2013 13:27

What is there to understand?
In this connection string is not indicated the name of the schema that I need to create!
How to do it?

Shalex
Devart Team
Posts: 8088
Joined: Thu 14 Aug 2008 12:44

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by Shalex » Fri 06 Sep 2013 16:27

AKRRKA wrote:In this connection string is not indicated the name of the schema that I need to create!
The contextForCreateDatabase.CreateDatabase method doesn't create a new schema (database user) at the moment. We are investigating the possibility of implementing this functionality.

AKRRKA
Posts: 194
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by AKRRKA » Sat 07 Sep 2013 08:18

Just add a new parameter "Database" (...;database = newdb;...).
And thus was created "schema/user" with that name "newdb" and with the same password "newdb", that's all.
That is enough.

It is waiting.
Thank you.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by MariiaI » Mon 09 Sep 2013 09:51

Thank you for your involvement. We will let you know about the results as soon as any are available.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by MariiaI » Mon 23 Sep 2013 13:44

The possibility of creating and deleting Oracle schemas (users) for mapped model classes via the CreateDatabase/DeleteDatabase methods of the DataContext class is implemented.

New build of LinqConnect 4.2.338 is available for download now!
It can be downloaded from http://www.devart.com/linqconnect/download.html (trial version) or from Registered Users' Area (for users with active subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?f=31&t=27983.

AKRRKA
Posts: 194
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by AKRRKA » Tue 05 Nov 2013 09:01

And what parameter has been added to the connection string to support the connection to the other scheme.
Please give an example of the connection string.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by MariiaI » Tue 05 Nov 2013 13:37

The possibility of creating and deleting Oracle schemas (users) for mapped model classes via the CreateDatabase/DeleteDatabase methods of the DataContext class was implemented.
Features of the implementation:
- the names of the objects, which should be created, are get from the names of the tables, on which entity classes are mapped;
- the DatabaseAttribute value is ignored;
- if all entity classes are mapped to simple table names (without any schema name) - no schema (user) will be created/deleted;
- the user, under which you are connecting to Oracle, and with which a schema(user) is created, must have the necessary privileges to create users and grant them privileges CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE;
- if the entity classes are mapped to tables from different schemas and have foreign keys between each other, such a situation is not currently supported.

AKRRKA
Posts: 194
Joined: Thu 26 Jan 2012 15:07
Location: Russia
Contact:

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by AKRRKA » Mon 14 Sep 2015 11:22

Hello.I decided to try the new features. I can not understand how to create a connection string.

Please help me understand. Initial data:
1) There is established "Orakle 11 XE";
2) There is a user "SYS" and the password is known;

To test the connection string I use just such a:
"user id = SYS; password = *********; server = 10.5.5.199; connect mode = SysDba; unicode = True; direct = True; sid = XE ; persist security info = True "

1) How to build a connection string, and call the function "CreateDatabase ()", to create a scheme such as "CEDATABASE"?
2) How to set a password for the user CEDATABASE?
3) What are his access rights and roles?

Please give an example.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: LinqConnect Professional Version 4.2.306 (08-Aug-2013)- Oracle create Database.

Post by MariiaI » Wed 16 Sep 2015 05:26

1) How to build a connection string, and call the function "CreateDatabase ()", to create a scheme such as "CEDATABASE"?
The names of the schemas/users, which should be created, are get from the names of the tables, on which entity classes are mapped:

Code: Select all

  [Table(Name = @"CEDATABASE.""Class1s""")]
   public partial class Class1 : INotifyPropertyChanging, INotifyPropertyChanged
   {...}
JIC: you can set the Target Schema for the whole model via the Model Settings -> Synchronization -> Mapping
Please see the sample project, which we have sent you.
2) How to set a password for the user CEDATABASE?
When this user is created, the CREATE SESSION privilege is not set for it. Thus, by default, the password is not needed.
You can set the necessary password and privileges/roles after the user is created.
3) What are his access rights and roles?
As we have written above, the user, under which you are connecting to Oracle, and with which a schema(user) is created, must have the necessary privileges to create users and grant them privileges CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE.
Thus, the user is created with privileges : "GRANT CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE..."
You can set the necessary password and privileges/roles after the user is created.

We've sent you a sample project to the e-mail address you provided in your forum profile. Please check that is not blocked by your mail filter.

Post Reply