- 5.3K All Categories
- 15 Introduce Yourself!
- 441 Community Feedback - NEW! (No Product Questions)
- 103 General Community Platform Concerns/Kudos/Feedback
- 83 Community Platform Bug Reports
- 85 How Do I Use the Community?
- 59 Where is the...? (Community Platform Locations)
- 15 Ideas and Suggestions for the Community Platform
- 71 Personal Document & Blog Archive
- 5 Community Programs
- 5 Get-Togethers
- 4.8K Certification Community
- 4.6K Certification Community Discussions
- 22 Oracle Certified Master Profiles
- 31 Oracle Database 12c Administrator Certified Master Profiles
- 79 Visual Builder Cloud Service
Create database programatically c#
I am doing a c# program that can use different data sources, I need to create the database programmatically and then, also programatically, create the tables, stored procedures and functions.
I already did all this with a sql server.
Could you help me to do it with a remote oracle server?
When I create the database directly in oracle the conection run ok.
this.txt_CnStr.Text = "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = " + this.txt_SD_Servidor.Text + ")(PORT = " +
this.txt_SD_Puerto.Text + "))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + this.txt_SD_BD.Text + ")));User ID=" + this.txt_SD_UserId.Text + ";Password=" + this.txt_SD_Pwd.Text;
dpf = DbProviderFactories.GetFactory("System.Data.OracleClient");
conexion = dpf.CreateConnection();
conexion.ConnectionString = this.txt_CnStr.Text;
This run fine.
To create the database I found the following code, but it is for a local server where the program is on the same server as the database: (txt_oradata is the Oracle data path)
dbcmd = conexion.CreateCommand();
dbcmd.CommandText = "CREATE TABLESPACE \"" + this.txtDatabase.Text + "\" DATAFILE '" + this.txt_oradata.Text + this.txtDatabase.Text + ".DBF' SIZE 10M AUTOEXTEND ON NEXT 1M";
Thanks in advance