473,698 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection string for a MySQL database needed-this is driving me nuts!

I'm trying to get asp to conect to a MySQL database, I've tried copying a
few examples online that I found [there doesn't seem to be many!!] and I
always get a 500 error with the code below. what am i doing wrong?
any examples of a working connection string anyone could show me would be
fantastic. thanks i advance.

Wayne...

<%@ LANGUAGE="VBSCR IPT" %>
<%
Set MyConn = Server.CreateOb ject("ADODB.Con nection")
MyConn.Open = "DSN=main;Uid=w ayne;Pwd=****** ;"

SQL_query = "SELECT * FROM content;"
Set RS = MyConn.Execute( SQL_query)
%>
<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BASEFONT FACE="arial">
<BODY>

<p><b><% Response.Write SQL_query %></b></p>

<%while not RS.eof%>
<%=RS("")%>&nbs p;<%=RS("title" )%>&nbsp;<%=RS( "date")%>&nbsp; <%=RS("content" )
%><br>
<%RS.MoveNext %>
<%wend%>

<%
RS.Close
MyConn.Close
%>
===========
the other version I tried:
===========
<%@ LANGUAGE="VBSCR IPT" %>
<%
strConnection =
"driver={MySQL} ;server=IP_NUMB ER_GOES_HERE;ui d=wayne;pwd=*** ***;database=ma i
n;option=NUM"
Set adoDataConn = Server.CreateOb ject("ADODB.Con nection")
adoDataConn.Ope n strConnection

strQuery = "SELECT * FROM content;"
Set RS = adoDataConn.Exe cute(strQuery)
%>

=============== ===
HEEELLLPPPP!!!! !!!!!!!!!!!!!!! !!!!!!!

Jul 19 '05 #1
1 2500
you need to make sure you have the latest mysql odbc drivers installed.
available from www.mysql.org then this string should be good.

"driver={My SQL ODBC 3.51
Driver};server= YOUR_SERVER;dat abase=YOUR_DB;u id=YOUR_USERNAM E;pwd=YOUR_PASS W
ORD"

"Wayne..." <wa***@secretwe bdesign.com> wrote in message
news:40******@2 12.67.96.135...
I'm trying to get asp to conect to a MySQL database, I've tried copying a
few examples online that I found [there doesn't seem to be many!!] and I
always get a 500 error with the code below. what am i doing wrong?
any examples of a working connection string anyone could show me would be
fantastic. thanks i advance.

Wayne...

<%@ LANGUAGE="VBSCR IPT" %>
<%
Set MyConn = Server.CreateOb ject("ADODB.Con nection")
MyConn.Open = "DSN=main;Uid=w ayne;Pwd=****** ;"

SQL_query = "SELECT * FROM content;"
Set RS = MyConn.Execute( SQL_query)
%>
<HTML>
<HEAD>
<TITLE>test</TITLE>
</HEAD>
<BASEFONT FACE="arial">
<BODY>

<p><b><% Response.Write SQL_query %></b></p>

<%while not RS.eof%>
<%=RS("")%>&nbs p;<%=RS("title" )%>&nbsp;<%=RS( "date")%>&nbsp; <%=RS("content" ) %><br>
<%RS.MoveNext %>
<%wend%>

<%
RS.Close
MyConn.Close
%>
===========
the other version I tried:
===========
<%@ LANGUAGE="VBSCR IPT" %>
<%
strConnection =
"driver={MySQL} ;server=IP_NUMB ER_GOES_HERE;ui d=wayne;pwd=*** ***;database=ma i n;option=NUM"
Set adoDataConn = Server.CreateOb ject("ADODB.Con nection")
adoDataConn.Ope n strConnection

strQuery = "SELECT * FROM content;"
Set RS = adoDataConn.Exe cute(strQuery)
%>

=============== ===
HEEELLLPPPP!!!! !!!!!!!!!!!!!!! !!!!!!!

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2081
by: Sims | last post by:
Hi, I am trying to tidy up my code and now i am looking at my database work. Now correct me if i am wrong, (I am using mysql_connect). Lets assume a few functions... ////////////////////////////////// // code /////////////////////////////////
3
1920
by: Ken | last post by:
Yesterday I was able to connect and work with the database. Today, I cannot connect. I do not remember changing anything. I repaired Apache2. Do no know if it needed a repair. Reinstalled mysql. Seemed to be my problem. When trying to open mysql@localhost, I receive an error Access denied for the user name@localhost Using password
14
9045
by: jj | last post by:
Is it possible to call a remote php script from within Access? I'm thinking something like: DoCMD... http://www.domain.com/scripts/dataquery.php DoCmd.OpenQuery "update_data", acNormal, acEdit ..... So the PHP script does something on the server database, then when a linked table is viewed within access, the data changes have been made?
3
1388
by: KaHuNa | last post by:
I want make a connection with MySQL (don't know why, i need, that's all ; ) ) in C# but i don't know a lots the OleDbConnection, i have do that: using System; using System.Data.OleDb; class database { // OleDbConnection oConn;
2
1514
by: bylum | last post by:
help find error that connection database and jsp.. <% String connectionURL = "jdbc:mysql://localhost:3306/webaudio?user=root"; Connection connection = null; Statement statement = null; ResultSet rs = null; %> <html>
1
1430
by: bylum | last post by:
help find error that connection database and jsp.. <% String connectionURL = "jdbc:mysql://localhost:3306/webaudio?user=root"; Connection connection = null; Statement statement = null; ResultSet rs = null; %> <html>
0
1260
by: rhepsi | last post by:
Dear All, Im vb.net 1.1, When im trying to update the records from mysql to postgresql, the connection error: the following code is Update data button click: Dim myPgrConnect As New NpgsqlConnection Dim myPgrCommand As New NpgsqlCommand
2
6652
by: Hetal | last post by:
Hi... I am a newbie VB.NET developer and i am looking at working with ADO.NET rather than ADO. In one of our native VB application with ADO, we used to create 1 connection object and that would help us to connect to MS-SQL and MySQL alternatively based on the database type and connection string i provide. So, one connection object was good enough to connect to any of these 2 type of databases. The sample connection string we use to...
5
3097
by: john | last post by:
All: I have a MS background and am having fun in the open source world of PHP and MySQL --- and I have a question. With PHP and MySQL, is it considered better practice to open a single database connection and re-use it throughout the life of the application (simple Web application - low traffic), or is it better to open a connection, use it and close it as needed?
4
3098
by: jmohan | last post by:
Hi everybody, How to write the connection string and sql queries in the XML. I use the mysql database. I use the following connection string and query using asp.net with C#. Connection String:
0
8680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.