 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 5th, 2006, 10:59 PM
|
|
Registered User
|
|
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
can anyone see why this isnt working?
k heres a piece of the code on the page but it should work for my purpose
Quote:
|
quote:If Site="host" And xSite="databases setup" Then
|
Quote:
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,alte r 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:
|
quote:'===========================
|
Quote:
' Database Information
'===========================
Dim DBType,MaxQuestions,MaxUpdates,MaxConnections,Data baseIP,DatabaseName,DatabaseUsername,DatabasePassw ord,MySQLAdminUsername,MySQLAdminPassword,Connecti onString,MySQLAdminConnectionString,objRS,objRS2,o bjConn,AdminConn,MSSQLPermissionsArray,MySQLPermis sionsArray
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_securityadmi n","db_ddladmin","db_backupoperator","db_datareade r","db_datawriter","db_denydatareader","db_denydat awriter")
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 [email protected]
|
|
 |