DatabaseClient not working

I created my notebook which plot the bar-chart with extracting data from database on my local when I am going to embed this notebook into my website then It is showing RuntimeError: DatabaseClient is not defined, how can I fix this.

The most common issue is a COR error due to the local database not being on an https connecting.

These pages might help you out:

2 Likes

I would love to understand this a bit better. Would you mind answering a few question?

  • I assume this is a private notebook (not published) since you have a database connection? Otherwise, it would be useful to see a link to your notebook… How are you connecting to your database from the notebook?

  • How are you embedding the notebook into your website? Are you actually using the embed iframe from Observable? (this would require it to be public notebook, though…)

2 Likes

Answering to your first question I can connect to my database only in private but I want this notebook work same fashion for where I embed this as in private


Answering to the next question Yes I am using embed iframe from observable to imbedding notebook into my website.

Hmmm… Interesting. How are you able to embed the iframe for a private notebook? For private notebooks, the Embed link should not be enabled…

1 Like

After publishing my notebook I am going to embed but when I am publishing this then It shows me RuntimeError: Databases are only available in private notebooks . I want to know that How can I connect to my database so that It works .

Thanks for explaining that. Now I understand. Unfortunately, you cannot publish (and hence cannot embed) a notebook with a database connection. See DB Connections + Public Notebooks? where one option is to use Splitgraph…

Another recommendation is to create your own proxy server for the database as described above by @hellonearthis .

1 Like