Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Claude Moore

Ranch Foreman
+ Follow
since Jun 24, 2005
Claude likes ...
IBM DB2 Java Netbeans IDE Spring
Italy
Cows and Likes
Cows
Total received
24
In last 30 days
0
Total given
0
Likes
Total received
81
Received in last 30 days
5
Total given
211
Given in last 30 days
6
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Claude Moore

Which version of the driver are you using ? Maybe, it's an outdated one, so that autoregistering of the driver doesn't take place. Are you sure you are loading the correct driver class ?
I tried with:



it worked, bu I also got a warning:

"Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary."
Sorry, but your question is really unclear. An IP address is unique within private network, so what are you asking about ?
11 hours ago

Mike London wrote:
In any case, I can't get the JDBC logic to work without the Class.forName to explicitly load the driver.
Even with code like below, if I run it, I'll get a "no suitable driver found"



It may be a symptom that required *.jar are not in your application classpath. From JDBC 4.0, if I'm not wrong, JDBC drivers are automatically registered when present in classpath; I don't understant what you mean sayng that you need to explicitly load MySql JDBC driver with Class.forName. I would guess you need also to call Driver.registerDriver to make it available to your application.
I tried this:



And it worked without problems. MySql  Server release is 5.6
It may silly to ask you this: have you tried using



It should do treat special characters for you.


Which format are the data stored in ? A practical approach may be to dump data in (some) textual file(s), transfer such file(s) via FTP from a server to another, then import them back to second application.
17 hours ago
ActiveMQ is a pure Java product, so that provides platform independence. This said,  for a tipical usage I think that they're roughly equivalent.
2 days ago
Well, I would argue that if is RabbitMq is already used in your architecture - successfully, I presume - what would be a valid reason to replace it with ActiveMq ? Don't misunderstand me: I currently run ActiveMQ successfully in an old architecture I designed years ago, and it is a very good MTOM to work with. But I won't replace a piece of middleware without a very good reason. And honestly, RabbitMq it's an excellent product,  exceptionally well integrated with spring and often used in .NET core examples and tutorials published by Microsoft: something that makes me feel it's here to stay...
2 days ago
I don't think there's a one size fits all solution. A proper sizing would require, at a minimum, an analysis of the actual worload your application needs to process - and 500 concurrent users are an important worload to deal with. For example, if your appserver allows 50 concurrent we request, each of which would access the database for a 50% of the whole request time, at a first glance you may try with an initial value of 25 connections in your pool. Assuming, of course, that there's a single connection used for agiven request, an assumption that may be irrealistic. I would start setting the connection pool size with a number between 2 an 3 times Max concurrent web threads, and then I would analyze usage statistics.
With respect to your question about the best connection pool implementation, a very good one is HikariCP, despite the fact that AFAIK it doesn't support at the moment XA connection pool.
2 days ago
What is RabbitMq required by? Is it a product requirement?
2 days ago

Knute Snortum wrote:
If by "send me" you mean to send a private email, don't do that.  Post your answer to the forum so that everyone can benefit.



Don't worry, I understand and fully agree to Coderanch's spirit: post questions and answers that could help every ranch member.
If I had a ready-to-post solution, I'd have been happy to help the OP, but unluckily I haven't any.

Knute Snortum wrote:
You commit transactions using your connection object:
The execute() method will return true if there is a resultSet or false if there is a number of updated rows or no result.  I set the variable isResultSet for clarity.  



What about this approach ? I would prefer to use explicitely transactions instead of issuing commit() / rollback() directly on connection.. but that's my humble opinion.


If you're using Hibernate, I think it's better to use Session object to commit your transaction, instead of setting autocommit manually.
First, welcome to the ranch !
If the stored procedure runs without error as you stated, please check if autocommit is turned on for the connection you use to call the SP.
What is "sessionImpl" ? Looks like you're getting your connection via Hibernate session. Is that true ?
I've developed a conceptual proof of a Spring Boot application with support for multitenancy. In a nutshell, my project consists of some API services (defined with interfaces), each with different implementations, and more than a single JPA entity manager to work with.
Both actual service implementation and JPA Entity manager are selected based upon a tenant-id that it's sent via API request.

I have to confess that realizing a multitenant-aware spring boot project, in which non only EMs , but also services injection are dependent on a request token was a really tricky work, mainly because Spring boot doesn't support multitenancy easily out of the box.
Now, despite my self-satisfaction for being able to solve an architectural puzzle, I wonder if nowadays is still important to develop a multitenant architecture, or such approach isn't anything more than a vestigia of  pre-container times. I mean, with spring it would be a lot easier to use profiles to separate tenant and deploy different instances with docker (for example). An hint that multitenancy should be avoid if not strictly necessary may be the very same fact that Spring doesn't support it 'natively'.

What do you think about ?

6 days ago
An excellent discussion guys. Much more cleaner that a lot of lessons I had to learn at University's times.
Thanks, all of you.
1 week ago