?
Solved

ASP Jscript MySQL Connection String

Posted on 2010-11-21
3
Medium Priority
?
374 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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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 informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

862 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