• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Connection problem with database from javascript file using mongoose

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not being able to connect to any database from any javascript file. I don't understand the problem as I had built some small projects earlier and at that time everything was working perfectly but since few days none of them are working.
 
Marshal
Posts: 4389
567
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think anyone is going to be able to help you unless you share some details like:
  - where are you trying to connect from? - browser, Node.js, etc.
  - how are you trying to connect? - source code would be helpful
  - what error messages or unexpected behaviour are you seeing?
  - what are the versions of the various software components (mongodb, mongoose library, node.js, etc.)
 
Saloon Keeper
Posts: 27478
195
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are trying to connect directly to a database from a web client. you're effectively re-creating the sort of webapps that cause the SQL Slammer worm to trash major Internet applications years ago. Don't connect directly to a database from an Internet client

If you are trying to connect to a database from a webserver such as NodeJS, then the best bet is to use an API library. To the best of my (limited) knowledge, there's no universal database interface like JDBC for JavaScript on any JavaScript framework.

So we'd need to know what you are trying before we can give any advice.
 
Your mother was a hamster and your father was a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic