Subject: can anyone see why this isnt working?
Posted By: ldavis Post Date: 1/5/2006 9:59:45 PM
k heres a piece of the code on the page but it should work for my purpose
 
quote:
If Site="host" And xSite="databases setup" Then
 If Action="add database" Then
  N=Request.Form("new_db")
  N=Replace(N,Session("Username") & "_","",1,999)
  N=Session("Username") & "_" & N
  On Error Resume Next
  strSQL = "SELECT databasename FROM mysqldb WHERE Databasename = '" & N & "' AND dbtype='my';"
  objRS.Open strSQL,ConnectionString
  If objRS.EOF or objRS.BOF Then
   objRS.Close
   Err.Clear
   objRS.ActiveConnection = MySQLAdminConnectionString
   If Err <> 0 then
    Call ShowError("Could not open admin MySQL connection.")
   Else
    strSQL = "CREATE DATABASE " & N
    objRS.Open strSQL
    strSQL = "GRANT select,insert,update,delete,create,drop,index,alter ON " & N & ".* TO " & Session("Username") & "@localhost IDENTIFIED BY '" & ConvertSQLText(Session("Password"))  & "'"
    objRS.Open strSQL
    If Err<>0 Then
     Call ShowError("Could not create the database. Error:" & Err.Description)
    Else
     strSQL = "INSERT INTO mysqldb (databasename ,AccountID) VALUES ('" & N & "'," & Session("AccountID") & ");"
     objRS.Open strSQL, connectionString
     objRS.Close
     Session("MySQL")=Session("MySQL")+1
     Call ShowSuccess("The database " & N & " has been created")
    End If
   End If
  Else
   objRS.Close
   Call ShowError("The database already exists.")
  End If
 End If



k now that should make a mysql database but it wont get passed the    objRS.ActiveConnection = MySQLAdminConnectionString i get the error message i put in place. not here is the code that defines    MySQLAdminConnectionString

 
quote:
'===========================
' Database Information
'===========================
 Dim DBType,MaxQuestions,MaxUpdates,MaxConnections,DatabaseIP,DatabaseName,DatabaseUsername,DatabasePassword,MySQLAdminUsername,MySQLAdminPassword,ConnectionString,MySQLAdminConnectionString,objRS,objRS2,objConn,AdminConn,MSSQLPermissionsArray,MySQLPermissionsArray
 MaxQuestions               = 80000
 MaxUpdates                 = 80000
 MaxConnections             = 80000
 DatabaseIP                 = "localhost"
 DatabaseName               = "db1"
 DatabaseUsername           = "root1"
 DatabasePassword           = "fake"
 MySQLAdminUsername         = "root"
 MySQLAdminPassword         = "fake"
 MSSQLServer                = "<$MSSQLServer$>"
 MSSQLSA                    = "<$MSSQLSA$>"
 MSSQLPW                    = "<$MSSQLPW$>"
 DBType                     = "DRIVER={MySQL ODBC 3.51 Driver};"
 ConnectionString           = "DRIVER={MySQL ODBC 3.51 Driver};Server=" & MySQLServer & ";UID=" & DatabaseUsername & ";pwd=" & DatabasePassword & ";Database=" & DatabaseName & ";"
 MySQLAdminConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};Server=" & MySQLServer & ";UID=" & MySQLAdminUsername & ";pwd=" & MySQLAdminPassword & ";"
 MSSQLPermissionsArray      = Array("db_owner","db_accessadmin","db_securityadmin","db_ddladmin","db_backupoperator","db_datareader","db_datawriter","db_denydatareader","db_denydatawriter")
 MySQLPermissionsArray      = Array("ALTER","CREATE","CREATE TEMPORARY TABLES","DELETE","DROP","INDEX","INSERT","LOCK TABLES","SELECT","UPDATE")

 Set objRS                  = Server.CreateObject("ADODB.Recordset")
 Set AdminConn              = Server.CreateObject("ADODB.Connection")
 Set objConn                = Server.CreateObject("ADODB.Connection")
 objConn.ConnectionString   = ConnectionString
 AdminConn.ConnectionString = MySQLAdminConnectionString
 objConn.Open
 AdminConn.Open



any ideas why it says cannot open admin connection, all the connection info is correct ( i have changed it for posting on this forum)

if you have any answers message me thru msn messenger heeroyuyaz2003@yahoo.com


Go to topic 38308

Return to index page 402
Return to index page 401
Return to index page 400
Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393