JavaMelody on Railo: no SQL statistics? - java

I just added JavaMelody to my Railo Application server but I can't get SQL statistics.
I followed this excellent post: http://aarongreenlee.com/share/monitor-tomcat-performance-with-open-source-software
Maybe problem can be exported to other AS than Railo.

Did you try the instructions here on configuring JDBC monitoring here: http://code.google.com/p/javamelody/wiki/UserGuide#7._JDBC
It looks like it uses a JDBC proxy if you're not using datasources in JNDI. I've recently had cause to look at how Railo does datasources and it doesn't do JNDI, so you'll probably have to set up a new datasource and follow the instructions. Do let me know whether it works.
[UPDATE] Just tried it myself. Whilst I can get the datasource working, I still get no stats. Looks like we may be running into this error:
http://code.google.com/p/javamelody/issues/detail?id=142

Related

No suitable driver found for jdbc:postgresql://localhost:5432/postgres

I tried several tutorials that I could get my hands on, but all of them lead to the same error:
18:28:24,583 INFO [stdout] (default task-1) Database error :No suitable driver found for JDBC:postgresql://localhost:5432/postgres
I have configured the connection following this tutorial: HOW TO SETUP POSTGRESQL DATASOURCE WITH WILDFLY
and tried several ways to fix the problem. I have tried both the management console and the configuration file. The most common solution was trying to add the postgresql-42.2.24.jar to the project structures in modules, but that doesn't solve it. I have created a new simple Java project where I am just trying to connect to the database and it works (I used the same credentials in both places), but when I'm trying to link the server with the DB it's like it doesn't see the driver... When adding a Datasource from Intellij it works perfectly fine (it sees the tables, I can run queries and everything), but I can't get the connection with the server to work.
I'm using Wildfly 24.0.1 Final and Java 8.
Change JDBC to jdbc, it's case-sensitive.

How to get Camel PgEvent component to use DataSource properly in Java Spring

I am using Apache Camel on Spring Boot and want a route to listen to PostgreSQL notify calls.
Camel version: 3.4.4
Spring Boot version: 2.3.3
I have tried using the PgEvent component from Camel, but have found the documentation quite lacking when you want to use a DataSource object to fill in the database specifics (i.e. url, username, password). I have neither found any examples of working solutions in stackoverflow, nor around the web.
Below are some sources I found helpful:
How to receive PostgreSQL LISTEN/NOTIFY with Apache Camel?
https://impossibl.github.io/pgjdbc-ng/docs/current/user-guide/
In the end, the "normal" jdbc:postgresql:/... url I was using did not work. So I followed the linked SO-answer, suggesting using the pgjdbc-ng driver (my colleague suggested the same). Following the documentation of the second link I found that my Camel route started working. All I needed to do was change the previous DataSource url to jdbc:pgsql:/....
Hope this helps other people with similar problems. Wasted all too many hours on this little problem.
I'm copying my own solution from the question into the answer section, as it may help others find the solution when the question is marked solved. Below is the copy of the final solution:
In the end, the "normal" jdbc:postgresql:/... url I was using did not
work. So I followed the linked SO-answer, suggesting using the
pgjdbc-ng driver (my colleague suggested the same). Following the
documentation of the second link I found that my Camel route started
working. All I needed to do was change the previous DataSource url to
jdbc:pgsql:/....

Datasource configuration in java

I have one query regarding datasource configuration.
I had configured one data source in server. Where my JNDI name is "MyDS".
To acquire the data-source in JBoss environment i had used like "java:/MyDS" in persistence, spring even in Birt reports.
But when i am running same thing in Tomcat environment, then it is showing error that unable to get the data-source.
I had googled about tomcat datasource communication, where i had seen like "jdbc/MyDS"
So, my query is what is the difference between above two types of configurations? (java:/MyDS and jdbc/MyDS) and how can i use the common configuration for both the servers (tomcat6 and jboss 5.1.0.GA).
Please help me.

Setting data source for reports in Crystal Reports 2008 Java (performance)

we have Crystal Reports 2008 on the Tomcat 5.5 server, and use the Java SDK to display reports and convert them to PDF.
Since the server has its own database, we have to set the data source on the DatabaseController to make CR connect to this database. We do it like specified in the docs, and tried the functions in CRJavaHelper, but for a reason unknown to me setting the connection string takes 300ms to 1500ms.
What is the fastest way to tell Crystal which datasource to use in its reports? I already saw a JNDI name somewhere, but i don't believe CR actually does a JNDI lookup to find an existing datasource, doesn't it? I haven't worked with JNDI datasources before, should I use them instead?
I found this out for myself. By Adding a DataSource to the context.xml of the web app and by referencing it in web.xml, Crystal then happily uses it. This is the fastest way to do it.

Datasource creation failed using PCF User Provided Service

I have a SpringBoot application and deploying it in PCF where app is trying to connect Oracle 12c Database using PCF User Provided Services but it failing with this error Failed to determine a suitable driver class
build.gradle code:
and here are the configuration that I used in CUP service:
Service binding is happening properly. I can see the same details under VCAP_SERVICES in Environment Variables.
Error:
Short Answer: I think you want the uri to be oracle://... Strip off the jdbc: part. The Spring Autoreconfiguration code that gets injected by the Java buildpack will look at the prefix on the URI, so it needs oracle:// to know it's an Oracle link.
Long Answer: You probably don't want to depend on the injected Spring Autoreconfiguration. When it just works, it's great, but it can be difficult to understand what it's doing when it doesn't work.
It is better to use Spring Cloud Connector or even better, as all signs point to this replacing Spring Cloud Connector, use java-cfenv. For details on java-cfenv, see this blog post.
Spring Cloud Connector has the same issue I mentioned above as the Spring Autoreconfiguration, except that it will pretty clearly tell you when it doesn't recognize a bound service. Anyway, if you decide to use SCC, make sure you prefix the URI with oracle://.
If you use java-cfenv, it's more flexible so it's really up to you what properties and values you inject through the service.
Hope that helps!

Categories