Solved

ASP Jscript MySQL Connection String

Posted on 2010-11-21
3
361 Views
Last Modified: 2012-05-10
I have MySQL installed as well as MyODBC installed, configured and testing OK.

I have been unable to locate a working connection string.  I have converted those I found for asp VBscript but they just lock up the page for minutes and minutes until they timeout.

Obviously I am overlooking something (likely incredibly simple) but am stumped.

Any help would be greatly appreciated.
0
Comment
Question by:darahood
  • 2
3 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 34184775
Here's the connection strings I've found: http://www.connectionstrings.com/mysql  None are specific to Jscript.

But it might be an 'escape' problem: http://support.microsoft.com/kb/189206   '\' is used to 'escape' characters in Jscript but since it is used in paths, it must be escaped there also.
0
 

Author Comment

by:darahood
ID: 34184861
Sorry.  Neither of these was helpful.  It is definitely not an 'escape' problem although I do understand where that could be an issue for some users.

The connection strings are already what I have tried.  I am really wondering if it is something outside of the asp/jscript.

Here is the error message I am getting:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I am in the process of researching that but am open to any info you might have.

Thanks again.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 34185020
I have one that works.  I hacked up a VBScript version from another question and got it to work.  Put in your own DB info and check it out.
<%@ LANGUAGE = JScript %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Old Website List</title>
</head>
<body>
<h1>Old Website List</h1>
<p>
<%
//select database source
var db_server = "yourserver"
var db_name = "your_db"
var db_username = "username"
var db_userpassword = "password"

var connectstr, objConn , objRS, strSQL
var tsConnection, tobjConn , tobjRS

var connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER="+db_server+";DATABASE="+db_name+";UID="+db_username+";PWD="+db_userpassword;


// Execute a SQL query and store the results
// within recordset
	SQLstr = "SELECT * FROM websitelist"
	SQLstr = SQLstr+" ORDER BY DisplayName LIMIT 10"

objConn = new ActiveXObject("ADODB.Connection");
objConn.ConnectionString = connectstr;
objConn.Open();
objRS = objConn.Execute(SQLstr)


%>
</p>
  <div align="left">
    <center>
    <table width="700" height="115" border="2" cellspacing="0" cellpadding="2">
    <tr bgcolor="#CCFFCC">
		<th width="119">Dname</th>
    <th width="175">Name</th>
    <th width="122">WebSite</th>
    <th width="122">Descript</th>
    <th width="117">entry num</th>
    </tr>
<% 		
while(!objRS.EOF) {
 %>
<tr>
<tr bgcolor='#CCFFCC'>
<td><% =objRS.Fields("DisplayName") %></td>
<td><% =objRS.Fields("SortName") %></td>
<td><% =objRS.Fields("WebSite") %></td>
<td><% =objRS.Fields("Descript") %></td>
<td><% =objRS.Fields("ent_num") %></td>
</tr>
<%
objRS.MoveNext;
}
objRS.Close; //Close the database connection

%>

</body>
</html>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
add custom headers to my mail 2 48
How to update a dummy recordset with classic ASP 4 66
Update field in order 21 124
wordpress display sub menu only when click 12 23
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now