How to enable implicitCachingEnabled (statement caching) from Tomcat for oracle? - oracle

I've been reading about implicitCachingEnabled and MaxStatements with the oracle jdbc driver.
I've tried adding implicitCachingEnabled="true" into the server.xml for the datasource definition but it makes no difference.
I've also noted other posts admittedly from a long time ago, where people have failed to get this setting to work simply by setting it in the tomcat config files.
So just on the offchance someone has it working, is there a trick to it?
In the mean time i'll investigate whether it's possible or not to do this via code, but we're using JPA so i'm not sure how that'll work!
Thanks,
Dan

Try to set the value OracleConnection.setStatementCacheSize () instead of MaxStatements
http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b10979/stmtcach.htm

Related

What is the difference between ddl-auto and hbm2ddl.auto?

Every time I try to start "Spring Boot Dashboard" from VSCode I get an error while using the following command.
spring.jpa.hibernate.ddl-auto=update (Doesn't Work)
However, I managed to find this line here on stack overflow that made it work. The problem is I don't know the difference and how will it impact my production.
spring.jpa.hibernate.hbm2ddl.auto=update (Works)
Any sort of help would be more than appreciated.
From this Link
spring.jpa.hibernate.ddl-auto This is actually a shortcut for the "hibernate.hbm2ddl.auto" property.
Defaults to "create-drop" when using an embedded database and no schema manager was detected. Otherwise, defaults to "none".
From this Stackoverflow Link
In production, it's often highly recommended you use none or simply don't specify this property. That is because it's common practice for DBAs to review migration scripts for database changes, particularly if your database is shared across multiple services and applications.

Where to set Hibernate FlushMode?

I have an IntelliJ project using Spring MVC and with Hibernate FlushMode set to auto as default.
The problem is: when I try to delete an object from the db, using the web interface, it works fine, but after the third time I do that, the interface becomes not responsive (even though Hibernate receives the command to delete that certain object with that certain ID) and I have to reboot my WildFly server.
Any idea where I can change that? Is there a way to set it in a configuration file or I have to invoke a method to set it? And even if the problem is the FlushMode itself.
Regards
UPDATE: After testing several things, I think I finally found the root of the problem. If I access the db for more than three times consecutively, the server becomes unresponsive. How can I overcome this?
UPDATE#2: I found that the problem was that in the Dao the connection was opened but never closed (there wasn't a line "session.close()" just to be clear). And that was the reason After three pooling from the db, was it either to add items, delete them or just get infos, the server became unresponsive. Now everything works perfectly!
I actually didn't get your question properly.
The third time you try to delete something from your frontend, the web page gets stuck? The third time you make a delete request is the request stuck with hibernate? Could be a little clear about what actually is happening/or what issue you are facing.
To answer your question - how to setFlushMode in hibernate:
In case you using EntityManager -> entityManager.setFlushMode(FlushModeType.) -> JPA supports AUTO and COMMIT
In case you using SessionFactory:
sessionFactory.setHibernateFlushMode(FlushMode.) -> From hibernate 5
OR
sessionFactory.setFlushMode(FlushMode.) -> Before Hibernate 5
(NOTE: Please check the docs for accurate version of hibernate from which setFlushMode is deprecated.
Hibernate supports 4 modes of flush -> AUTO/COMMIT/ALWAYS/MANUAL

Edit JDBC connection string in Saiku

I am using Microsoft SQL Server as database for my web application. I'd like to use Saiku as part of the application. I found the solution to set up the JDBC connection string as below:
type=OLAP
name=foodmart
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:sqlserver://localhost:1433;databaseName=foodmart;Catalog=res:warehouses/FoodMart.xml;JdbcDrivers=com.microsoft.sqlserver.jdbc.SQLServerDriver; username=sa
password=XXXX
Anyway, I don't know which file in the package I downloaded (Saiku Server 2.4 (Including Foodmart DB)) is for changing the connection string as I mentioned.
Please help. Thank you in advance.
In case someone else has this same problem I thought I would share my solution, because I couldn't find any Saiku specific answer anywhere else.
After struggling for a few hours, getting the error "com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'TableName'.", I found that the correct way, or at least the one that worked for me, to specify the database name, was to add the jdbc prefix to the databaseName parameter.
This is my working example:
type=OLAP
name=foodmart
driver=mondrian.olap4j.MondrianOlap4jDriver
location=jdbc:mondrian:Jdbc=jdbc:sqlserver://localhost:1433;jdbc.databaseName=foodmart;Catalog=res:foodmart/FoodMart.xml;JdbcDrivers=com.microsoft.sqlserver.jdbc.SQLServerDriver;
username=sa
password=sa
Just use google:
http://docs.analytical-labs.com/DataSources.html
FYI You'll probably get quicker responses on Saiku questions if you use the IRC channel ##saiku on Freenode, or ask.analytical-labs.com
The solution is to migueletes spent hours trying to find the solution.
My problem was to try to include the instanceName parameter to connect the hub to a cluster mssql and actually had to add the parameter jdbc.instanceName to it was taken into account, otherwise omit the parameter.
https://groups.google.com/a/saiku.meteorite.bi/forum/#!topic/user/q9_5OG6_wrw

Netbeans trys to connect to deleted jdbc

Here is how setup looks like:
ApplicationServer - GlassFish
Database Server - Oracle 10g2
Persistance Library - EclipseLink
Faces Framework - IceFaces
My Problem is that everytime I change the database connection the application/eclipselink stops working, failing to find the Persistance Unit.
After loosing a whole day trying to figure it out. I decided to delete all the information about connections and persistance units and use only one new created.
Building the project was not a problem, but running it I get an error, pointing that the there is a validationexception and a persistance unit with a given name was not found. That name is deleted and is't descriped in the persistance.xml nor in the sun-resources.xml. There is no such entry in the Services in Netbeans.
Have you seen such an error, and how can I make sure, that netbeans doesn't store information on places I can't reach from the IDE? How is it so that my application is looking for something that isn't listed anywhere...
Okay next time I have to think more, instead of asking the question here. So my problem was the cache directory of Netbeans 6.9.1.
Deleted the cache directory and everything started working again.
I hope that this problem is fixed in the next releases. it can be real pain in ... :)

JDBC URL for Oracle XA client

Using the JDBC driver oracle.jdbc.xa.client.OracleXADataSource, what is the correct format of the JDBC URL? The thin format of
jdbc:oracle:thin:#host:port:sid
does not work. WebSphere is reporting that the given url (which is otherwise correct) is invalid.
The test connection operation failed for data source Oracle MyDB (XA) on
server nodeagent at node MY_node with the following exception:
java.sql.SQLException: Invalid Oracle URL specifiedDSRA0010E: SQL State = 99999,
Error Code = 17,067. View JVM logs for further details.
There is nothing in the JVM logs.
Whether you use a XA Driver or not, the JDBC connection string is the same (and the format of your question is correct).
For me the issue resolved by adding alias name, username and password in JAAS - J2C authentication data. And also selecting this entry as Component-managed authentication alias.
In case this happens to anyone else. The problem went away after restarting websphere.
In my case, the problem went away when I change the authentication property of the jdbc resource reference from Authentication=Application to Authentication=Container
Had the same issue. Dont know about simple deployments, but on a two nodes cluster, I restarted the first node, and the connection started working on it (not on the second). Restarted the second node, and the connection started working there too.
So just restart the nodes (I also restarted the nodeAgents, but i don't know if it's necessary).
if you are doing using wsadmin command then you need to stop manager,stop node,start manager, sync node and then start node (I mean full sync). Hopefully this will resolve the issue. I dont know why but this resolves my issue.

Resources