Wildfly/JBoss and LDAP datasource - jboss

Is it possible to define (in AS context but not in deploy context) an LDAP datasource in Wildfly/JBoss to access at LDAP like a database performing simple searches? How to do that with connection pool like a SQL database query?
Thanks a lot.

Related

Connect to Azure Database for PostgreSQL server with Prisma

I am looking for a way to connect my Next.js application with Azure Database for PostgreSQL server. Prisma seems to work well with Next.js but I can't figure connection string or if it is even supported database.
Example:
DATABASE_URL = 'postgresql://johndoe:randompassword#localhost:5432/mydb?schema=public'
The host I am trying to connect to:
posgreservertest.postgres.database.azure.com:5432
So it should be something like "...#posgreservertest.postgres.database.azure.com:5432/mydb?".
I am trying to npx prisma introspect and this is how my cmd looks like:
PS C:\Web stuff\nextjs\test> npx prisma introspect
Environment variables loaded from prisma\.env
Prisma schema loaded from prisma\schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "posgreservertest.postgres.database.azure.com:5432"
Introspecting based on datasource defined in prisma\schema.prisma …
Error: P1001
Can't reach database server at posgreservertest.postgres.database.azure.com:`5432`
Please make sure your database server is running at posgreservertest.postgres.database.azure.com:`5432`.
Is it even possible to connect to Connect to Azure Database for PostgreSQL server with Prisma as it doesn't feature this option in their supported databases?
Make sure you've set your database as publicly available.
Add a firewall rule to allow connections from your IP. If you aren't concerned much about security you can allow connections from any IP. Just set 0.0.0.0-255.255.255.255 rule.
Ensure that you are using the full username id. For Azure PostgreSQL server id consists of two parts <username>#<servername>. In your following example full connection string will look like this
postgresql://username#servername:password#servername.postgres.database.azure.com:5432/dbname?your=options
If you've set SSL enforcing on your server make sure to add sslmode=require option

Creating a Postgres database with JDBC Driver when starting a SpringBoot app?

When I want to use a Mysql database in a Springboot app, I am able to create it on start via a string in properties similar to this:
spring.datasource.jdbc-url=jdbc:mysql://localhost:3306/testDb?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
Nevertheless PostgreSQL seems to ignore this:
spring.datasource.jdbc-url=jdbc:postgresql://localhost:5432/testdb?createDatabaseIfNotExist=true&autoReconnect=true&useSSL=false&allowPublicKeyRetrieval=true
Is there a way to create a PostgreSQL db on start of a SpringBoot app before Flyway attempts to initiate tables?
Postgres doesn't support creating a database on demand via the JDBC URL. You can learn about what configuration is possible in the documentation.

JPA standard property: how will a JPA provider create schema without knowing database system password?

JPA has a standard property
javax.persistence.schema-generation.create-database-schemas
that asks JPA provider to create a database(schema for oracle db) for schema-generation.
Creating database requires system password, but there is no such JPA property for db system password. How it works?
JPA uses some database connection, and that one has username/password.
If you want JPA to create the schema it is assumed that the user for the connection has sufficient privileges.
If you do not like this for a production environment you can generate the SQL statements upfront (you'd have to tell the system which DB/dialect to use at generation time) and then have a DB admin execute that script prior to application deployment.

SQL Developer 18.3: set alternative schema for individual connections automatically

I'm using several connections in SQL developer to connect to different Oracle databases. For some connections I have to change the schema to that of another user. This can be done is several ways
By using: alter session set current_schema = <otheruser>;
The drawback is that I have to enter this for every connection I want to open and with a different <otheruser> for each connection.
Using the global connection startup script in Preferences > Database > Filename for connection startup script. The drawback of this method is that SQL Developer uses the same global startup script and runs it for every connection I open. Probably trying to set a non existing schema in most -but one- connections.
Is there a way to automatically set the default schema on connecting to a database for individual connections?
Connection Schema
conn_1 Leave current schema unchanged for this connection
conn_2 Change current schema to <schema_A> for this connection
conn_3 Leave current schema unchanged for this connection
conn_4 Change current schema to <schema_B> for this connection
conn_5 Change current schema to <schema_C> for this connection
A solution will be very helpful.
No, that is not a feature. We assume when you define the connection, you are using the schema that you want to work with.
The tool is VERY connection driven - using alter session set current schema will work with queries you run in a SQL Worksheet, but won't have any effect for the rest of the tool, say browsing your tables in the Connection navigation tree.
Now, if you have PROXY connect privs, you could set up your connection to actually connect to your 'default' schema via proxy.
I show how here

Adding IBM Db2 as a datasource

Has anyone had any luck or found documentation on how to add IBM Db2 as a datasource for their dashboard on Apache Superset? I don't see any information in the Db2 service credentials about the driver or dialect.
Based on the docs for Apache Superset the connections and hence the connection URI are based on SQLAlchemy. According to the Db2 driver for SQLAlchemy, the Db2 database URI would be like this:
db2+ibm_db://user:pass#host[:port]/database
db2+ibm_db is the dialect and driver, database is the database name on that host with the specified port (typically 50000). If you want to connect to a local database, just leave out the host/port combination:
db2+ibm_db://user:pass#/database