|
|
 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 14th, 2005, 06:19 PM
|
|
Registered User
|
|
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
how to config db connection in a DSN-less server
I used DW MX2004 to created couple of form collection info and info display ASP pages, with an Access db. DW auto generated connection file as always. It worked fine in my local. When I upload to 1and1 host server, I found out they can't add DSN to ODBC. Instead, they give following code as connection samples:
<%
Set OBJdbConnection = Server.CreateObject("ADODB.Connection")
OBJdbConnection.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("../db/products.mdb") & ";"
SQLQuery = "SELECT * FROM PRODUCTS"
Set RS = OBJdbConnection.Execute(SQLQuery)
%>
In DW, code for connection is
Set OBJdbConnection = Server.CreateObject("ADODB.Recordset")
OBJdbConnection.ActiveConnection = MM_dsnname_STRING
And that MM_dsnname_STRING is calling a dsn set in ODBC.
Since I've already have these pages done, I try to avoid to redo the codes. Is there anyway to define "MM_dsnname_STRING" with the connection sample 1and1 gives?
appreciate for any help!
|

January 15th, 2005, 05:31 AM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
Sure, you can. Right now, MM_dsnname_STRING is filled with a reference to the DSN. All you need to do is replace it with a proper connection string.
The one your ISP gave is very old and *not* recommended. Try this instead in your connection file:
MM_dsnname_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.Mappath("../db/products.mdb") & ";" & _
"User Id=admin;" & _
"Password="
Then your code can stay the same:
OBJdbConnection.ActiveConnection = MM_dsnname_STRING
Instead of accepting a DSN name, and doing a lookup for the database info, the connection now gets a proper OleDb connection directly.
Make sure you adjust the path in Server.MapPath tp match the path you're calling this code from.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: I Wanna be Adored by The Stone Roses (Track 1 from the album: The Stone Roses) What's This?
|

November 5th, 2006, 08:15 AM
|
|
Registered User
|
|
Join Date: Nov 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The power of a Google search.
Thanks for the connection string.
Using it I got my database on 1and1 working with my Dreamweaver .asp pages
Now the only issue is in Dreamweaver my local and remote connection pages differ. I guess in the future I could sim the 1and1 dir structure on my local IIS server so the connection string will be the same.
Thanks again:)
John aka KJ6TK
|

November 6th, 2006, 03:43 PM
|
 |
Wrox Author
Points: 33,554, Level: 80 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
|
|
Yeah, you could do that.
Alternatively, you can store the connection string in the global.asa file and never overwrite that file when you update the site.
Or you can Server.MapPath as I suggested in an earlier post. Server.MapPath takes a virtual path and maps it to a physical path. So, Server.MapPath("Databases") could be c:\yoursite\Databases on your local system and something like D:\webs\customers\YourCompany\YourSite\Databases on the production server.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
|

June 27th, 2008, 07:45 PM
|
|
Registered User
|
|
Join Date: Jun 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey Guys,
I am having a similar problem and attempted to follow this post but I was unsuccessful.
I have a local site developed in ASP with an access database which is working fine however when I uploaded it to 1and1 I realized that I should of left development to the pro's =(
I have the following script in my connection file generated in Dreamweaver MX:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_user_logins_STRING = "dsn=user_logins;"
%>
1and1 provides the following example script.
<html>
<title>Database query using ASP</title>
<body bgcolor="FFFFFF">
<h2>Query table <b>Products</b> with ASP</h2>
<%
Set dbaseConn = Server.CreateObject("ADODB.Connection")
dbaseConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("\db\products.mdb") & ";"
SQLQuery = "SELECT * FROM PRODUCTS"
Set RS = dbaseConn.Execute(SQLQuery)
%>
<%
Do While Not RS.EOF
%>
<%=RS("name")%>, <%=RS("description")%>, <%=RS("price")%> DM
<p>
<%
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
dbaseConn.Close
Set dbaseConn = Nothing
%>
</body>
</html>
http://faq.1and1.com/scripting_langu...atabase/2.html
I am a little bit lost and attempted the following script:
<%
// FileName="Connection_odbc_conn_dsn.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_user_logins_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.Mappath("../db/mydb.mdb") & ";" & _
"User Id=admin;" & _
"Password="
%>
The script didn't work and I received the following Message:
Microsoft JScript runtime error '800a1391'
'_' is undefined
/Connections/user_logins.asp, line
Any direction you guys can provide would be greatly appreciated. (This script is for a login page)
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |