Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC wont connect to netowrked .mdb

Status
Not open for further replies.

godzilla13

Technical User
Jul 18, 2004
6
AU
Hi everyone,

I am currently developing an intranet site and have a couple of micorosft access databases stored on a file server that i need to extract data from and display on some pages.

My problem is that i have been using dummy databases during the desgin stage with the ODBC pointing to a copy of the database on the web server(local machine). But now when i changed to ODBC to point to the real databases (file server) i get the following error

"Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] '(unknown)' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

/etas/nsw.asp, line 8 "

I have been using Dreamweaver MX 2004 to create the pages and i had all the ASP's working perfectly before i started to move the ODBC location.

Any ideas?? i had made sure that the permissions are set to full contorl for everyone on the file server.

Help is appreciated



 
How did you specify the full path of the db? Are you using a data source?

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Ok well i am using Dreamweaver and i have the page working fine with the following code, but as i mentioned above when i point the OBDC to look on another server rather than the servers local disk (where ive been using test databases) it comes up with the error mentioned above

Can u suggest changes to the following script to get this working properly, and as you have probebly realised i am not that good with script language, thus why im using dreamweaver.

Heres the asp file "vic.asp"
Code:
"<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/etas.asp" -->
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_etas_STRING
Recordset1.Source = "SELECT master.shipment, master.suppiler, master.Boat, master.destination, master.contanier, master.[eta wharf], master.[docs to carrier], master.status  FROM master  WHERE (((master.destination)='melbourne') AND ((master.status)='p' Or (master.status)='u'))  ORDER BY [docs to carrier] DESC, [eta wharf] DESC;"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
	If ((nLCID < 0) Or (Session.LCID = nLCID)) Then				
		strRet = FormatDateTime(str, nNamedFormat)			
	End If									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

<html>
<head>
<title>T</title>
</Head>
<Body>
    
<p align="center"><img name="Banner" src="../Images/Banner.gif" width="700" height="90" border="0" alt=""></p>

<div id="main" style="position:center; width:100%; z-index:1; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; top: 120px; overflow: visible; height: 75%;">
  <table width="485" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="467" height="46"><div align="center" class="Heading">VIC Estimated Time of Arrivals </div></td>
    </tr>
  </table>
  <table width="98%"  border="1" align="center" cellpadding="1" cellspacing="1">
    <tr>
      <td width="11%" height="34"><div align="center"><strong>Shipment</strong></div></td>
      <td width="15%"><div align="center"><strong>Supplier</strong></div></td>
      <td width="11%"><div align="center"><strong>ETA Wharf </strong></div></td>
      <td width="8%"><div align="center"><strong>Docs To Carrier </strong></div></td>
      <td width="21%"><div align="center"><strong>Ship</strong></div></td>
      <td width="18%"><div align="center"><strong>Container</strong></div></td>
      <td width="11%"><div align="center"><strong>Destination</strong></div></td>
      <td width="5%"><div align="center"><strong>Status</strong></div></td>
    </tr>
    <% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
    <tr class="norm">
      <td><%=(Recordset1.Fields.Item("shipment").Value)%></td>
      <td><%=(Recordset1.Fields.Item("suppiler").Value)%></td>
      <td><%= DoDateTime((Recordset1.Fields.Item("eta wharf").Value), 2, 2057) %></td>
      <td><%= DoDateTime((Recordset1.Fields.Item("docs to carrier").Value), 2, 2057) %></td>
      <td><%=(Recordset1.Fields.Item("Boat").Value)%></td>
      <td><%=(Recordset1.Fields.Item("contanier").Value)%></td>
      <td><%=(Recordset1.Fields.Item("destination").Value)%></td>
      <td><div align="center"><%=(Recordset1.Fields.Item("status").Value)%></div></td>
    </tr>
    <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
  </table>
</body>
<%
eta_nsw.Close()
Set eta_nsw = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>"

And here is the include file 'Connections/etas.asp'
Code:
<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO" 
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
Dim MM_eta_STRING
MM_eta_STRING = "dsn=etas;"
%>"

please help me this is driving me crazzy!!
 
It's sounding like the db name is not specified properly in the dsn. Either the db must exist in a shared directory on the server or the IIS server needs to have domain admin capabilities. How did you specify the db name in the dsn?

Also, check this site for ways to create a dsn-less connection directly in the script:



"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
well in the OBDC i mapped the server share to Z: and then selected it by browsing to Z:\database.mdb. Thats how i specified the db name

ok so the server needs domain admin rights,why is this? i made the IUSER on the server to have full access to the database, shouldnt this be enough?

Also would a dsn-less connection be a better option for what i want to do??

Thanks for helping by the way ArtieChoke.
 
Are you are mapping the Z: drive under your account on the IIS server? You can't use mapped drives for services, which the IIS server runs under - it's not a normal account.

You'll need to use an UNC format: \\server\share\... in the dsn for the server to access it. The reason I said have domain admin privs is if there wasn't a share, they you can use this format: \\server\c$\... (assuming the file is on the c: drive).

I like dsn-less connections since you won't have to create one on every server you might run this script on and if the file server changes, it's easier to maintain. Just a personal choice.

Thanks for helping by the way ArtieChoke.

You're welcome :)

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
ok ive gotten off my bum and started to read up on the dsn-less connection but i cant find one that supports a UNC format that i can use to connect to a networked server.

How would i go about doing this??

AT the momonet it looks like the following:

Code:
Dim MM_etas1_STRING
MM_etas1_STRING = "Driver={Microsoft Access Driver (*.mdb)};" & _
           "Dbq=\\nt_server\stockmon\dc&arrive_be.mdb;" & _
           "Uid=Admistrator;" & _
           "Pwd=password"
%>

am i going about this the right way??
 
I'm starting to suspect this won't work either. I just tried to connect to a server-based mdb file in a DSN, but it wouldn't let me use an UNC - only a mapped share - argh!

I've never tried it dsn-less, since we use sql server for all our databases and access as only a front-end occassionally.

I think the only way you can get it to work is to have your SA sign in under the IIS account and map a drive to that share...

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
I never thought somthing so simple would end up so difficult.

Thanks again for the help
 
Thank Billy boy for that! ;-)

Programmers have a phrase that kind of sums it up (usually about user requests): If the user think's it's an easy change, it will require a huge rewrite. If the user think's it's difficult, it's usually a no-brainer.

I've found this to be true more than not - doh!

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top