From: Kevin Butler on 2 Jan 2007 21:32 I am trying to extract data from an Access database used by a commercial application. I need Read access only. The demo application uses default passwords for read and read/write. I am using "USER=ADMIN", "PW=admin" which should allow me to do what I need. But the SQLSelect below gives me an error - SQLSTATEMENT:[Microsoft][ODBC Microsoft Access Driver] Record(s) cannot be read; No read permission on 'TABLENAME' This happens with every table I specify. The same code works fine on other MDB files. And I can open the MDB file in Access 2003. It appears to be in Access 2000 format. The user and login combination is valid - I can run the program (FinPower) using that combination (in Demo mode) I need to query their data from my VO app. Can someone shed light on what is happening or suggest a way around? // Test Code // cFile is fully qualified *.MDB filename cConnString:= "Driver=Microsoft ACCESS Driver (*.mdb);DBQ="+cfile+"; Uid=ADMIN;Pwd=admin" oConn:=sqlconnection{} lConnected := oConn:driverconnect(,SQL_DRIVER_NOPROMPT, cConnString) // Connects fine IF ! lConnected warningbox{,"CONNECTION FAILED","Unable to open "+cFile}:Show() ENDI sSql:=[ SELECT * FROM CLIENT ] // or any other valid Table in the database oSQL := SQLSelect{ sSql, oConn } IF !oSQL:Execute() IF !Empty( oSQL:Status ) cError := oSQL:Status:Description ELSE cError := "SQL General Error: '" + sSQL + "'" ENDIF ENDIF IF ! Empty(cError) warningbox{,"SQL Select Error",cError}:Show() // error as above ENDI Thanks Kevin Butler kbutler(a)baksoft.co.nz
From: Peter Fallon on 3 Jan 2007 01:35 Kevin, If an access database has NOT been secured, then the defaults are actually User=Admin and a *blank* password. Are you using the correct MDW file for the relevant database. This is the file that actually holds all the securuty information - so while you might have a valid password, if the correct MDW file isn't being used by JET, then you won't be allowed to see anything. In the MSDN library notes, the additional connection properties required to use this are: cnn.Provider = "Microsoft.Jet.OLEDB.4.0;" cnn.Properties("Jet OLEDB:System database") = _ "C:\Program Files\Microsoft Office\Office\SYSTEM.MDW" Obviously you will substitute the relevant file/path of the MDW file file for the databae concerned. Note that in a commercial product, this file may be given a disengenuous name and be hard to spot. (the above is a VB code example - so the syntax and funtions used will be different in VO - check the notes for library you are using) > I am trying to extract data from an Access database used by a > commercial application. I need Read access only. The demo application > uses default passwords for read and read/write. I am using > "USER=ADMIN", "PW=admin" which should allow me to do what I need. But > the SQLSelect below gives me an error - SQLSTATEMENT:[Microsoft][ODBC > Microsoft Access Driver] Record(s) cannot be read; No read permission > on 'TABLENAME' > This happens with every table I specify. The same code works fine on > other MDB files. And I can open the MDB file in Access 2003. It appears > to be in Access 2000 format. The user and login combination is valid - > I can run the program (FinPower) using that combination (in Demo mode) > > I need to query their data from my VO app. > Can someone shed light on what is happening or suggest a way around? > > // Test Code > // cFile is fully qualified *.MDB filename > cConnString:= "Driver=Microsoft ACCESS Driver (*.mdb);DBQ="+cfile+"; > Uid=ADMIN;Pwd=admin" > > oConn:=sqlconnection{} > lConnected := oConn:driverconnect(,SQL_DRIVER_NOPROMPT, cConnString) > // Connects fine > > IF ! lConnected > warningbox{,"CONNECTION FAILED","Unable to open "+cFile}:Show() > ENDI > > sSql:=[ SELECT * FROM CLIENT ] // or any other valid Table in the > database > oSQL := SQLSelect{ sSql, oConn } > > IF !oSQL:Execute() > IF !Empty( oSQL:Status ) > cError := oSQL:Status:Description > ELSE > cError := "SQL General Error: '" + sSQL + "'" > ENDIF > ENDIF > > IF ! Empty(cError) > warningbox{,"SQL Select Error",cError}:Show() // error as above > ENDI > > Thanks > Kevin Butler > kbutler(a)baksoft.co.nz > >
From: Johan Nel on 3 Jan 2007 04:10 Kevin, > cConnString:= "Driver=Microsoft ACCESS Driver (*.mdb);DBQ="+cfile+"; > Uid=ADMIN;Pwd=admin" I checked the samples in the AdoClasses and there it uses "User ID=Admin" and. "Password=admin" syntax and not UID, Pwd. Maybe the problem? Have you tried directly passing the string into SqlConnection? oConn := ; SqlConnection{"Driver=Microsoft ACCESS Driver (*.mdb);DBQ="+cfile,; "Admin", ; // User ID "admin" ; // Password } The other option would be to create an ODBC resource, maybe just as a start to test if you can connect that way? HTH, Johan Nel Pretoria, South Africa.
From: Kevin Butler on 3 Jan 2007 22:57 Thanks Peter, I think you are on to it. It is a secured database and your suggestion re the MDW file fits the behaviour. However, I can't find an MDW file anywhere so your theory on it being 'hidden' also fits with what is happening. I have tried all the combinations of user/passwords and the other suggsted syntaxes but always the same result. No read access! Strange that Access opens it without any passwords being requested, though. Perhaps I need to use the OLEDB driver instead of the ODBC one. I'll keep digging <sigh> Kevin
From: Kevin Butler on 3 Jan 2007 23:01
Thanks Johan. Good suggestions and I have tried them but without success. I'll keep on ...... Kevn. |