node-adodb icon indicating copy to clipboard operation
node-adodb copied to clipboard

Operation is not allowed

Open susnick opened this issue 11 years ago • 19 comments

I keep getting an Error message stating "Operation is not allowed when the object is closed". Any info on this error would be helpful.

var conn = ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=SampleDB.accdb;Persist Security Info=False;');
conn.query('SELECT Control_Number FROM [orders]')
  .on('done', function(data) {
    console.log('done');
    console.log(JSON.stringify(data));
  })
  .on('fail', function(data) {

  });

susnick avatar May 26 '15 18:05 susnick

The new version 2.0.2 was available, please try it again!

nuintun avatar May 29 '15 08:05 nuintun

I am facing same issue since few hours. I am already having version 2.0.2. Is anyone who accessed database MS ACCESS successfully !

palakbhansali avatar Jul 06 '15 11:07 palakbhansali

Sorry for the delay, got pulled to another project. The new version still provides the same error message image

susnick avatar Jul 08 '15 11:07 susnick

@susnick @palakbhansali Can you upload an example? Thanks!

nuintun avatar Jul 17 '15 01:07 nuintun

It should be related to Provider issue, but the error message cannot be displayed due to connection closed in /lib/adodb.js#L489-490 , comment this two lines to view the error message.

inDream avatar Dec 06 '15 05:12 inDream

I ended up using a web api to provide the data from access, but was curious about this issue. I have since been using Windows 10, and everything works fine now. Possible issue with Windows 8.1???

susnick avatar Dec 06 '15 13:12 susnick

I'm experiencing this same issue on Windows 2012 R2. I'm using the 64bit driver for Access.

var ADODB = require('node-adodb'), connection = ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Folder\\NameOfFile.accdb;');
ADODB.debug = true;```

goldbergjeffrey avatar Feb 18 '16 14:02 goldbergjeffrey

I am facing the same issue, but thanks for inDream, after commenting /lib/adodb.js#L489-490, I finally found this issue.Here is how.

In my project, the folders and files is:

package.json
X.js
-server
    att2000.mdb
    demo.js

so in my demo.js ,here's the code: connection = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=./att2000.mdb;'); and I run node like this: node server/demo Then this error occured. After commenting /lib/adodb.js#L489-490, the message becomes "找不到文件 'G:....\att2000.mdb"(which means file not found). So the solution for me is to change the code like this: connection = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=server/att2000.mdb;');

coolguy001tv avatar Feb 24 '16 15:02 coolguy001tv

My issue is 32 bit vs 64 bit. It appears the module supports 32bit oledb and not 64 bit. When I removed the 64 bit driver and installed the 32 bit driver the module worked fine.

goldbergjeffrey avatar Feb 24 '16 16:02 goldbergjeffrey

IIS7+iisnode 运行报错 { "valid": false, "message": "Unexpected token '" }

不管运行什么sql都是一样的错误 连接代码,windows7 64位系统 ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;');

getpro avatar Apr 03 '16 16:04 getpro

@getpro 源码中的示例能跑起来吗?

nuintun avatar Apr 14 '16 01:04 nuintun

I had the same issue, Thanks to @inDream ! In the last version, you have to comments these lines to display the real error message : /lib/adodb.js:496 -> //recordset.Close(); /lib/adodb.js/497 -> //connection.Close();

Spaarw avatar Jun 24 '16 09:06 Spaarw

The fix for me was to change var conn = ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=SampleDB.accdb;'); to var conn = ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=SampleDB.accdb;');

KillChaos avatar Aug 11 '16 14:08 KillChaos

I'm running Win server 2016, [email protected]. Installed the 64 bit version of "Microsoft Access Database Engine 2010 Redistributable". After commenting the lines indicated by @inDream and @Spaarw I get the error "The specified provider could not be found. It may not be installed correctly. ".

The bug seems related to the bit version selection of cscript.exe.

The fix for me was to comment the lines 18, 19 in file "proxy.js"

 // x64 = fs.existsSync(path.join(sysroot, 'SysWOW64')),
 // cscript = path.join(sysroot, x64 ? 'SysWOW64' : 'System32', 'cscript.exe');

and let the system select the cscript version adding the line

cscript = 'cscript'

Thanks @nuintun. Your library is helpful for me.

onaxon avatar Dec 03 '16 13:12 onaxon

Hi, I'm having this same issue After following @inDream advice, the messages I get are as follows:

When running: ADODB.open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=myDB.accdb;'); I get the error: Unrecognized database format

When running: ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=myDB.accdb;'); I get the error: Provider cannot be found. It may not be properly installed

I also tried @onaxon suggestion, but that threw a marge larger error...

Can anyone advise me how to fix this? Thanks, David

My environment is as follows:

DaveyD avatar Jan 13 '17 17:01 DaveyD

@DaveyD You could try use Provider=Microsoft.ACE.OLEDB.16.0 Ref: http://stackoverflow.com/a/32247214

inDream avatar Jan 14 '17 15:01 inDream

@inDream - Thanks a lot for your response I tried what you provided but I'm still getting the same results. Here is the output: Params: { "connection": "Provider=Microsoft.ACE.OLEDB.16.0;Data Source=D:\\Documents\\myData.accdb;", "sql": "SELECT * FROM Table1" } Error: { "valid": false, "message": "Provider cannot be found. It may not be properly installed." }

I later ran the powershell command provided in the SO link that you presented and it returned: Microsoft.ACE.OLEDB.12.0 Microsoft Office 12.0 Access Database Engine OLE DB Provider So it seems like I have the 12.0 version.

Any other ideas? Thanks, David

DaveyD avatar Jan 14 '17 23:01 DaveyD

I got it to work! The problem was that I had installed the 64bit Access Database Engine, but since my Access was 32bit I had to install the 32bit version. Seems simple and silly... but took me quite a lot of time!! Hope this helps others

@nuintun - Thanks for this library!

DaveyD avatar Jan 16 '17 01:01 DaveyD

since I had the same issue and try to install 32-bit version on Office 64-bit throws an error, I want to share how I installed 32-bit version of the engine: in cmd run the AccessDatabaseEngine.exe /quiet and all start to work. thanks for the help.

leanpilar avatar Jun 03 '18 20:06 leanpilar