Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Old 12-01-2005, 11:38 AM path to dsn help
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
Hi, I am having problem getting path to work. Hosted site is on GoDaddy if this helps. I am a CF Guy so DSn is new to me as you know ColdFusion Administrator takes care of DSN for CF scripts.

GoDaddy uses DSN *File* I need to set the path. I understand what i am supossed to do, just can't get it to work.

<--Here is the error msg -->
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
General error: Invalid file dsn ''
/menu.asp, line 15
<--end of error message-->

The scripts that I have been using to connect to databases didn't work on the GoDaddy Server. I tried to get the path to work, just counldn't figure it out. So I used ths script that they provide. and made the correct chages to it- still can't get it to work.

The DSN file is in a directory named: access_db/ that is located at the root. The DSN File name is: mainbar.mdb

Here is the page that I am using.. Can anyone see what I am doing that needs to be changed/fixed..?

<--begining of page-->

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim oConn, oRs, fieldname, tablename
Dim qry, connectstr, sDSNDir
Dim db_server, dsn_name
dsn_name = "access_mainbar.dsn"
fieldname = "MItem"
tablename = "Menu"
sDSNDir = Server.MapPath("access_db/mainbar.mdb")
connectstr = "filedsn="
connectstr = connectstr & sDSNDir
connectstr = connectstr & "\"
connectstr = connectstr & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM Menu"
Set oRS = oConn.Execute(qry)
%>
<html><body>
<%
while not oRS.EOF
response.write oRs.Fields(fieldname)
oRS.movenext
wend
oRS.close
Set oRs = nothing
Set oConn = nothing
%>
</body></html>

<--end of page-->

Any help would be appriciated

Thanks,
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
 
Register now for full access!
Old 12-01-2005, 01:33 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
the whole concatenation of the connection string looks wrong. It appears you are building both a DNS connection and a DSNless string in one.

use response.write connectstr just after building it to check.

or just us a DSNLess connection

connectstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("/access_db/mainbar.mdb") & ";"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-01-2005, 03:29 PM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0

Thanks
chrishirst, I'l try it and see if I can get it to work
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 12-03-2005, 01:33 AM
WebcyteDesign's Avatar
Registered User

Posts: 159
Location: Hamilton
Trades: 0
You can also use a udl file. Simply open notepad and save without any text in it with the file extension .udl then double click the file and use the tool to connect to your DB. Once you get a connection you click ok. Then open the udl file in notepad and BOOM you've got your connection string. Let me know if you have any questions.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 12-06-2005, 11:38 AM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
Quote:
Originally Posted by chrishirst
connectstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("/access_db/mainbar.mdb") & ";"
chrishirst, I tried this everyway I could think of and I just can't seem to get it to work..

here is the way I used this snippet..when with the rest of my code:


<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_server, dsn_name

dsn_name = "access_mainbar.dsn"
fieldname = "MItem"
tablename = "Menu"


connectstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("/access_db/mainbar.mdb") & ";"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)


%>



The database is in a diredtory off of the root called /access_db/ My actual database is in this directory (mainbar.mdb.)

The dsn is a file sitting in a directory off of the root as well called /_dsn/
This is a directory that is not visible. The dsn file is named access_mainbar.dsn

/~/~/~/~/~/~/~/~/~/~/~

Here is the error message I get when I run this:


Microsoft JET Database Engine error '80004005'
Unrecognized database format 'd:\hosting\chipjohns\access_db\mainbar.mdb'.
/menu.asp, line 15

/~/~/~/~/~/~/~/~/~/~/~


Any Ideas what might be causing this? Being a ColdFusion perosn, I have never had to deal with File dsn's and don't understand them at all.
Thanks..
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 12-06-2005, 11:42 AM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
WebcyteDesign,

Thanks, I'm not sure quite how to use this. This is set up on a remoteserver. I am testing on line (live.) Do I ftp this file to the server and run it from a browser? I tried running it from my desktop and it seems like it needs to be run using a computer actually hooked up to the server!?!

Thanks for your help,

Chip


ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 12-06-2005, 05:43 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
this usually signifies a corrupt file
has the mdb been uploaded by FTP in binary mode because uploading with Dreamweaver can cause this sometimes.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-06-2005, 11:35 PM
WebcyteDesign's Avatar
Registered User

Posts: 159
Location: Hamilton
Trades: 0
I've never tested the udl file on anything except on XP pro which I have IIS installed. If you don't have a machine with IIS this may be why you can't run it. You do not upload it, you should just be able to run it right on your computer. Sorry this is all the help I can provide.

Also shouldn't the path name be 'd:\hosting\chipjohns\public\access_db\mainbar.mdb '. evey host I've seen has the public folder and that is where you put all the files. So this could also be the issue.
WebcyteDesign is offline
Reply With Quote
View Public Profile Visit WebcyteDesign's homepage!
 
Old 12-07-2005, 03:30 AM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
The path should be correct as it is being generated by the server. That is the function of server.mappath(), To take a relative path to a file from the root of the website and translate it into a physical path on the server HD.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-07-2005, 11:14 AM
ChipJohns's Avatar
I don't know! Do you?

Posts: 488
Name: Chip Johns
Location: Savannah Georgia
Trades: 0
Quote:
Originally Posted by chrishirst
this usually signifies a corrupt file
has the mdb been uploaded by FTP in binary mode because uploading with Dreamweaver can cause this sometimes.
Got it! That was it Chris. I uploaded the mdb file again and it works.

Thanks.. as they say ... "YOU 'DA MAN ..!!"
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Reply     « Reply to path to dsn help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.00488 seconds with 12 queries