Is there an Agroal configuration for the initial SQL? - quarkus

I'm setting up a connection pool using Quarkus. I want to know whether there is an Agroal configuration for the initial SQL.

There isn't directly on the Agroal extension but there is one on the Hibernate ORM one.
You can use, the following property (default to import.sql):
quarkus.hibernate-orm.sql-load-script=import.sql
The configuration reference can be found here: https://quarkus.io/guides/hibernate-orm-guide#properties-to-refine-your-hibernate-orm-configuration

Related

Old style outer join (+) cannot be used with ANSI joins, Oracle Database Error Code ORA-25156

Why I get this error even though i specified the hibernate.dialect as OracleDialect. If you recommend to use oracle10gDialect or Oracle9iDialect please explain, cause Hibernate can find the Dialect using JDBC meta data when it connect to the db in very first time. Correct me if i'm wrong.
I believe your problem is to find the correct dialect. But I believe this is part of the configuration. This is not a programming problem, This is a configuration strategy that you used to manipulate or use of configuration.
you can externalize the configuration with multiple profiles such as dev, UAT, PROD which is based on the environment. Then your CICD
the pipeline will pick the correct profile which has the correct dialect according to the deployed environment.
Or you can add default dialect and override the properties based on
the environment in which the application is deployed.
The reason is application is the component where looking for the database.
or check this post if you wanted to do programmatically ( I haven't try this) :
Is there a way to detect SQL Dialect without knowing the database type?
Also please read the driver specification and JPA dialect usage. some databases expect exact versions of dialect to support full functionality.

How to specify JDBC setting in a struts project?

I am trying to setup a struts project locally. One way I know to set up JDBC settings as to go to administrative console of websphere and create JDBC provider and JNDI and all. But is there any other way to do in the code itself?
There is some resource reference in web.xml. I am totally new to struts.Please help.
DataSourceAlias
javaxsql.Data...... etc etc
If you configured for WAS 6.1and configuration is good you need to stop and start nodeAgents for the changes to get propagated and test the jdbc connection after restarting.....if it was WAS 8 they will be propagated automatically that means you configured improperly

Spring Roo #RooJpaActiveRecord parameterized the JPA table catalog

I need a why to change the JPA catalog element in my java class? We have many database environments which we need to be able to deploy our application too. Example: In your dev environment we have a database for new development, and production support. All database live on the same server so we have the following database names: am_web_dd and am_web_ps. So we need to be able to change the catalog at build time or start up time. We've thought of using Maven to do a search and replace during build but I was wondering if there is a way of doing this with a parameter?
Here is one of our #RooJpaActiceRecord statements:
#RooJpaActiveRecord(catalog = "am_web_t4", schema = "dbo", table = "user_t")
I would like to be able to make catalog a parameter. Is this possible? if not what would be the best approach?
Thank you for your time!
I know it is possible from a JPA standpoint, but I don't think you will be able to using straight Roo. This might help.
There may also be a way to use a Java Configuration object in Spring to build your JPA Entity Manager. I think that's were you want to set it.
The approach you suggest of making catalog dynamic would be suitable if you wanted to let the user choose/change the schema on demand, however, it looks like this is not your requirements, so I would steer away from this path as it more difficult than you need.
You can use spring profiles to define different database connections and use an environment variable to define which one is active. Spring profiles can be set in XML or java configuration classes.

Creating a PropertyOverrideConfigurer that takes values from the Database

Currently we have a PropertyOverrideConfigurer from Spring that is used to override some values of our configuration, the configuration is then used in Spring and Seam. Now I'd like to create an OverrideConfigurer that uses a DB connection managed by Seam to inject the overridden values into the configuration.
Is there already such a class or am I on my own?
I see that there is no support from Spring. Probably you need to do it yourself. This link may help you to confirm that you need do it yourself.

Configure JDBC oracle specific property v$session.program using Jboss and JPA (hibernate)

I'd like to set the v$session.program Oracle property in order to have information available in the session table. I'm using JPA with a jndi XA datasource created with an oracle-xa-ds.xml deployed in the deploy folder of Jboss, and therefore I haven't access to the constructor of the Connection.
I have access to the Connection object, in JPA 2 using unwrap, in JPA 1 by casting JPA to Hibernate classes, but there are no properties setter (only Client Info properties that are the way to proceed starting JDBC 4.0).
So my question is, using JPA (with Hibernate) using Jboss 4.2 :
Is it possible to configure the v$session.program in the persistence.xml ?
Is it possible to configure the v$session.program in the oracle-ds.xml ?
Is their any other approach to the solution ?
Thank you for any valuable comments and answers !
I had the same Problem today, after much fiddeling and reading documentation finally I had the Eureka moment:
Add following parameter:
<xa-datasource-property name="connectionProperties">v$session.program=YourUniqueName</xa-datasource-property>
Thats all.
I'm pretty sure this must be documented somewhere but here is what we can find in the JBoss wiki:
How To Specify "PROGRAM" Oracle Connection Property
JBoss Version: JBoss 4.0.3 SP1, Oracle DB Version: 10g
To be able to distinguish the JDBC
connections on the Oracle server side,
which are created by different JBoss
instances, Oracle's PROGRAM connection
property might be set within the
Oracle specific JDBC datasource config
file by using the following tags:
<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>
i.e.
...
<connection-url>AConnectionURL</connection-url>
<connection-property name="v$session.program">ADistinguishedNameForPROGRAMProperty</connection-property>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
...
That way the DBAs can have proper
granularity in:
AWRs
v$session view
Other tools which are checking/evaluating PROGRAM connection
property

Resources