# Failed to open ./data/temp.db

**URL:** https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301
**Category:** Dashboard
**Created:** [28 May 2025 06:58 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301 "2025-05-28T06:58:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ColaJin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colajin/32/101066_2.png) [@ColaJin](https://discourse.nodered.org/u/ColaJin)
#### Post date: [28 May 2025 06:58 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/1 "2025-05-28T06:58:45Z")

</div>

in my environment，i import project ,nodejs directory has node.exe，data directory has two db documents(temp.db、test.db) , i config node find "./data/temp.db" can execute，but test.db appears error failed to open "./data/test.db"，so i change config "../data/test.db" is working；  
in others environment ../data/test.db、./testdb both not working  
absolute directory is working，how to debug

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/05f65192b87ecba937a2b7c50b9014fe99db6af0.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/a/fa3ba99ab2baeb1c38df44654337f262e33063a6.png)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 May 2025 07:15 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/2 "2025-05-28T07:15:10Z")

</div>

You may need to post part of your `settings.js` file which shows what paths are shared.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 May 2025 07:47 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/4 "2025-05-28T07:47:45Z")

</div>

Oh, sorry, some other details:  
O/S being used  
NR version

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [28 May 2025 07:59 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/6 "2025-05-28T07:59:04Z")

</div>

Ah, windoze.......

Not my area. I'd better step back and let others help you.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 08:06 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/7 "2025-05-28T08:06:42Z")

</div>

> [@ColaJin](#):
>
> ```auto
> console.log('Loading settings from:', __dirname);
> process.env.PATH = `${process.env.PATH};`+__dirname+'\\lib';
> process.env.PATH = `${process.env.PATH};`+__dirname+'\\lib\\ias';
> 
> console.log('process env PATH:',process.env.PATH);
> 
> const newPath = __dirname;
> try {
> process.chdir(newPath);
> 
> } catch (err) {
> console.error('修改工作路径失败:', err.message);
> }
> 
> ```

None of this is really necessary.

Since `data` is relative to the settings.js, you should be able to specify a relative path `data/test.db` in the SQL node.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 08:36 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/9 "2025-05-28T08:36:30Z")

</div>

> [@ColaJin](#):
>
> data/tes.db

if that is what you entered, then there is no surprise.

if you really entered `data/test.db` then something else is amiss.

did you remove your extra code in settings.js `process.chdir(newPath);` and restart node-red?.

If you add a simple flow `inject -> exec -> debug` and put `cd` in the command, what do you get when inject is operated?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 09:03 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/11 "2025-05-28T09:03:02Z")

</div>

You say:

> [@ColaJin](#):
>
> failed to open data/test.db

Then you say:

> [@ColaJin](#):
>
> test.db can use tool access

so I cannot really understand what you are saying.

  

Maybe you have a lock on the database. try closing any database management applications. try restarting the computer.

also, check you have not got more than one db config node configured for the same database (you have 2 database files, there should only be 2 configs in the dropdown)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 09:21 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/14 "2025-05-28T09:21:38Z")

</div>

I'm sorry but you are changing things and only reporting small parts of info making it very difficult to help.

1. show me the files in `data` dir
2. show me the output of `cd` using the flow I suggested above
3. show me the settings in the 2 configs.
  - 1 should have `data/test.db`
  - 2 should have `data/temp.db`

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 09:30 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/18 "2025-05-28T09:30:02Z")

</div>

> [@Steve-Mcl](#):
>
> - show me the output of `cd` using the flow I suggested above

> [@ColaJin](#):
>
> not understand

Do this ↓

> [@Steve-Mcl](#):
>
> add a simple flow `inject -> exec -> debug` and put `cd` in the command, what do you get when inject is operated?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [28 May 2025 09:32 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/19 "2025-05-28T09:32:05Z")

</div>

> [@Steve-Mcl](#):
>
> show me the settings in the 2 configs.
> 
> - 1 should have `data/test.db`
> - 2 should have `data/temp.db`

## THERE SHOULD BE 2 CONFIGS for 2 DATABASE CONNECTIONS

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e0fb53cca20ea95ab3bb25a2dfeae91eea760349.png)

Select 1st one then click edit

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/3/a391e8302a6a6e9200a90eb2fdb16e4d779ed8fc.png)

Select 2nd one then click edit

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/c/bc23d6ee024366eaafbec8a6037209c72298f3ce.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [28 June 2025 11:45 UTC](https://discourse.nodered.org/t/failed-to-open-data-temp-db/97301/24 "2025-06-28T11:45:40Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
