p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read

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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 14th, 2005, 06:19 PM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 15th, 2005, 05:31 AM
Imar's Avatar
Wrox Author
Points: 33,554, Level: 80
Points: 33,554, Level: 80 Points: 33,554, Level: 80 Points: 33,554, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
Default

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old November 5th, 2006, 08:15 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old November 6th, 2006, 03:43 PM
Imar's Avatar
Wrox Author
Points: 33,554, Level: 80
Points: 33,554, Level: 80 Points: 33,554, Level: 80 Points: 33,554, Level: 80
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,228
Thanks: 7
Thanked 203 Times in 201 Posts
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 27th, 2008, 07:45 PM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2008
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using DB Connection from Config file Snuffles ASP.NET 2.0 Basics 1 March 28th, 2007 07:18 AM
DSN Connection mred2nice Visual Studio 2005 0 October 31st, 2006 11:58 AM
Need DSN Connection Code to Access DB markw707 ASP.NET 1.0 and 1.1 Basics 0 May 13th, 2005 10:10 AM
dsn-less connection problem Justine SQL Server ASP 3 March 8th, 2004 01:45 PM
config.php file (define "DSN" ) confusion paddy PHP Databases 3 July 8th, 2003 08:29 PM



All times are GMT -4. The time now is 03:57 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc