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

connection.query does not return

Open icarus31 opened this issue 8 years ago • 6 comments

Hi,

I developed an Angular 4+Electron application with node-adodb. It works perfectly in development mode, but when packaging everything (create the .exe and other electron files), the connection.query does not go to the 'then()' or the 'catch()'!

Using node-adodb version 4.0.6 Angular 4.3.6 electron 1.7.9 electron-packager: 10.1.1

main.js code

const ADODB = require('node-adodb');
const dbProvider = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=';
const databasePath = path.normalize('C:\\temp\\mydb.mdb');

ipcMain.on('select', (event, type, sql) => {

    const reply = 'reply-select-' + type;

    connection = ADODB.open(dbProvider + databasePath + ";");

    connection
      .query(sql)
      .then((data) => {
        event.sender.send(reply, { status: 0, message: '', data: data });
      })
      .catch((error) => {
        console.error('ERROR with select: ' + error);
        event.sender.send(reply, { status: 1, message: error.message, data: {} });
      });
  });

I know it enters in the ipcMain.on, execute the ADODB.open, but after, nothing.

Any clue why or some things that you could suggest me to try?

Thanks

icarus31 avatar Jan 07 '18 00:01 icarus31

@icarus31 See #36

nuintun avatar Jan 15 '18 02:01 nuintun

@nuintun, the solution is to use the 'hazardous' library instead, right? Have you tried it too? Would you mind to help me out how to do that? No too sure to understand. Thanks

icarus31 avatar Jan 15 '18 21:01 icarus31

Same problem here. I tried installing hazrdous library and adding the require('hazardous') line in proxy.js file just as they say in #36 issue. It doesn't work.

I think our problem is a different issue because we don't get an error message. It's just the connection who doesn't return any values.

I'm using "node-adodb": "^4.0.7" "vue": "^2.3.3", "electron": "^1.7.5", "electron-packager": "^8.5.0",

@icarus31 Did you find a way to fix it? Thanks in advance.

keidsito avatar Feb 02 '18 11:02 keidsito

Hi @AdrianCuartas, nothing new from my side :-(

icarus31 avatar Feb 02 '18 23:02 icarus31

@AdrianCuartas @icarus31 Please upload a demo~

nuintun avatar Feb 24 '18 02:02 nuintun

I'm sorry, I changed it for another module. But I think the problem could be some dependency of a folder (if it exists).

When you pack an electron application, you are not longer able to read the content of a folder inside node_modules. That's because all is packed in a single file (.asar). You can read and import a file, of course, but not to read (fs.readdir) the content of a folder.

keidsito avatar Mar 02 '18 10:03 keidsito