conecting to mysql (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


crosscreek -> conecting to mysql (2/27/2008 12:38:40)

I am having problems connecting to mysql database properly & wanted some input if I'm doing this correctly. I am using frontpage 2003.

OK in global.asa file I have the following.

'--Project Data Connection
Application("labdatas_ConnectionString") = "DRIVER={MYSQL};SERVER=labdatas@mysql106.mysite4now.com; DATABASE=labdatas; UID=labdatas; PWD=XXXX; Extended Properties='OPTION=16387'"
Application("labdatas_ConnectionTimeout") = 0
Application("labdatas_CommandTimeout") = 0
Application("labdatas_CursorLocation") = 0
Application("labdatas_RuntimeUserName") = ""
Application("labdatas_RuntimePassword") = ""
'--
(Note: origonal password is correct, just took it out for the forum)

I have an openconn.inc file with the following code
<%
Set myConn = server.createObject("ADODB.Connection")
myConn.open(Application("labdatas_ConnectionString"))
%>

I also have a closeconn.inc file with the following code
<%
Set myConn.Close
Set myConn = Nothing
%>

I have a "trial page" set up as to test the connection. open.asp with the following code
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<!-- #include file="openconn.inc" -->
<body>

<%
Set MyResultSet = MyConn.Execute("Select * FROM tblClient")
%>
</body>
<!-- #include file="closeconn.inc" -->
</html>

The error I get when I view it is the following

Microsoft VBScript compilation error '800a03f3'

Expected '='

/closeconn.inc, line 2

Set myConn.Close
----------------^

Now if I take out the <!-- #include file="closeconn.inc" --> line then I get the following message

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[TCX][MyODBC]Access denied for user: 'labdatas@cp252.mysite4now.com' (Using password: YES)

/openconn.inc



I know it's a connection issue, but do I have it set up properly in all aspects (except maybe the server connections is wrong, etc)

I am unable to verify the connection in frontpage database site settings. I also don't have anything in the table yet. Just trying to get a connection first.

Thanks for any help or input







Spooky -> RE: conecting to mysql (2/27/2008 20:49:13)

Remove the set :

<%
myConn.Close
Set myConn = Nothing
%> 


<edit>
Didnt we get MySQL working with the login? or am I thinking of someone else?




crosscreek -> RE: conecting to mysql (2/27/2008 21:25:51)

Could be me...I was having problems with the sessions & know it was the server side problem. I am using a different host for this project. Thanks for the help....It worked & my open.asp page is blank...no errors...[:D]

Now I am trying to figure out how to write the code. I understand the concepts, just finding out there are many different ways to write code.

Another Quick question...Trying to add a field to mysql (have tables done, but there are empty)

I have a form with a text box & pointing to the asp page adddog.asp

The adddog.asp page has the following code

<%@ Language=VBScript %>
<% Option Explicit %>
<!-- #include virtual="adovbs.inc" -->
<!-- #include file="openconn.inc" -->
<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tbldog", myConn, , adLockOptimistic, adCmdTable
objRS.AddNew
objRS("name") = Request.Form("name")
objRS.Update
objRS.Close
Set objRS = Nothing
%>
<!-- #include file="closeconn.inc" -->

I am getting an
Microsoft VBScript compilation error '800a0400'
Expected statement
/adddog.asp, line 5
Option Explicit

But my test page (open.asp) doesn't give me an error.

Am I thinking on the right page. Is the code to update an access database different then a mysql database? I am reading & going by a book that uses access examples, but not sure if it matters.

Thanks




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625