?
Solved

ASP Jscript MySQL Connection String

Posted on 2010-11-21
3
Medium Priority
?
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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/…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

771 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