sql

m3tti 2024-10-11T06:39:56.579329Z

is there a way in next.jdbc to create a database?

igrishaev 2024-10-11T07:26:19.244399Z

Sure, just connect to some existing database and then execute these queries

create user john_smith with password 'secret';
create database some_db with owner john_smith;
Of course, the current user must be able to create other users and databases.

p-himik 2024-10-11T07:27:26.124079Z

And if there's no existing database, whether you can connect to a server depends on the RDBMS itself. E.g. it seems that in MySQL you can to it just fine, but in PostgreSQL you have to be at least some database first.

igrishaev 2024-10-11T07:27:26.805449Z

But usually, databases are created not via Clojure/Python/any other language, but command line tools.

igrishaev 2024-10-11T07:28:48.798919Z

yeah in Postgres, database is mandatory. You cannot connect without specifying a database.

m3tti 2024-10-11T07:29:59.113699Z

aaaaah @p-himik and @igrishaev that was the missing part for me i just used a lot mysql lesser postgres and now with the app i create i was like why do i have to have a db in postgress 😄 now it makes it clear its an constraint of the environment basically

p-himik 2024-10-11T07:32:57.907839Z

Can always shell out to createdb if you really need to create a DB from within the Clojure process.

m3tti 2024-10-11T07:40:32.175559Z

just curious what would be the better approach for something like #borkweb and for newcommers. But i guess just letting them fiddle arround with a db would be great right. Anyway you still have the option with hsql