-
Creating Connection
Hello,
I have set up a MySQL database, guitarhangarcom, with a table, pollandsurvey, and am using the following ASP code to make the connection. For some reason the connection is not being made. Does anyone have any suggestions? Any help would be greatly appreciated.
<%
dim odbcConn
dim odbcRS
dim counter
dim error
set odbcConn = Server.CreateObject("ODBC.Connection")
set odbcRS = Server.CreateObject("ODBC.Recordset")
odbcConn.Open "Driver={mySQL};" & _
"Server=64.224.17.178;" & _
"Port=3306;" & _
"Option=16834;" & _
"Database=guitarhangarcom;" &_
"Uid=usr2136;" & _
"Pwd=AS567;"
odbcRS.ActiveConnection = odbcConn
if odbcConn.errors.count = 0 then
response.write "<h2>Fields In The 'pollandsurvey' Table:</h2>"
odbcRS.Open "describe pollandsurvey"
while not odbcRS.EOF
response.write odbcRS.fields(0).value & "<br>"
odbcRS.MoveNext
wend
else
response.write "ERROR: Couldn't connect to database"
end if
%>
Rob Batesole
Web Master
Collect Guitars / The Guitar Hangar
Phone 203-740-8889
Fax 203-740-2730
Check out our Websites!
www.guitarhangar.com
www.collectguitars.com
-
There're lots of possible reasons - the IP is wrong, MySQL running on a non-default port, but most likely you don't have permission to connect. MySQL permissions are quite easy to understand, but a bit long to cover all the possibilities here. You may want to start reading from<a href='http://www.mysql.com/doc/en/Connecting.html> here</a> on the MySQL site, and the next few pages too. Basically permissions are stored in the mysql database, and the various tables there allow or disallow all kinds of access, based on ip, username, databasename all the way down to field level if you want. The most likely for someone just starting out is that you don't have permission in the user table.
But there are lots of other possibilties, so if you don't have any luck you'll need to give more info.
-
Creating Connection
greenman,
I appreciate the help, it gives me a place to start. All the best.
Rob
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|