I'm trying to create a database and data source dynamically from the user input.
I'm not sure is that possible or not to create a database using cfquery tag without using data source.
For Data source creation
<cfscript>
adminObj = createObject("component","cfide.adminapi.administrator");
adminObj.login("admin password");
myObj = createObject("component","cfide.adminapi.datasource");
myObj.setMSSQL(driver="MSSQLServer",
name="datasourceName", host = "127.0.0.1", port = "1433",
database = "database", username = "userName", password="password", login_timeout = "30",
timeout = "20", interval = 7, buffer = "64000", blob_buffer = "64000", setStringParameterAsUnicode = "false",
description = "", pooling = true, maxpooledstatements = 1000, enableMaxConnections = "true",
maxConnections = "300", enable_clob = true, enable_blob = true, disable = false, storedProc = true,
alter = false, grant = true, select = true, update = true, create = true, delete = true, drop = false,
revoke = false
);
</cfscript>
I've tried to create a data source using above code statically it creating Datasource successfully
For database creation
<cfquery name="createDB" result="res">
create database #form.dbname#
</cfquery>
but not able to create a database using the above code. I got the error, my objective needs to create database then data source by using the user input string.
Any advice or help is appreciable
Thanks in Advance.