How can connect mysql to spring roo? - java

Spring-roo can't be connect to MySQL
when i execute command database reverse engineer --schema test --package then it give error:
Could not initialize class com.mysql.jdbc.Connection...
Image of error:

You need 2 things:
Configure connection info in project in src/main/resources/META-INF/spring/database.properties file. Spring Roo uses it to connect DB.
Make JDBC driver accessible by Spring Roo installing it in OSGi environ ( see manual section about it )
Good luck!

Related

Build Java Application when using environment vars in application.properties

I have developed a Spring Boot Starter API. The API connects to MySql Database.
My application.properties:
# MySQL Connection
spring.datasource.url=jdbc:mysql://${MYSQL_URL}/${MYSQL_DB_NAME}
spring.datasource.username=${MYSQL_USER}
spring.datasource.password=${MYSQL_PWD}
During testing I inject the vars with my IDE (IntelliJ) in the Run -Configuration.
When I try to build a docker image using mvnw spring-boot:build-image I get an error, that I get an error com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure during test
I assume that maven tries to connect to the db and has no vars to replace the placeholders.
How can I build the image without including the connection-details in the image ??

Can`t connect to PostgreSQL database in Pentaho Kettle

I`m trying to connect to my PostgreSQL database. What I create a connection and click the button "Test", I receive an error message. I can connect to this db via pgadmin without any problems, so it is not a connection or credentials issue
I`m using Pentaho kettle 8.3, Windows, java version "1.8.0_231"
Error connecting to database [Name] :org.pentaho.di.core.exception.KettleDatabaseException:
Error occurred while trying to connect to the database
Error connecting to database: (using class org.postgresql.Driver)
Ошибка при попытке подсоединения.
Full error stack: https://pastebin.com/cLiB288e
Try to add postgresql-42.1.1.jar in the /lib folder of PDI, restart the spoon and try again.
i faced 2 issues myself connecting to PostgreSQL few months back and following 2 things helped me
1.add postgres-42.1.1jar file in the 'lib' folder under PDI and restart the spoon.
if the normal JDBC connection convention does not work for you try below tip
while configuring the connection specify host name as follows
{HOST IP}:{HOST PORT}/{instance name}?

Permission error occured while executing yardstick-ignite framework

Why is this console statement printed multiple times while running yardStick-ignite framework example?
If i've made a mistake can you please show me how to run the yardStick-ignite framework example?
<16:56:46><yardstick> Starting driver config '...-cn query -sn IgniteNode -ds Ignite-sql-query-put-1-backup' on localhost
Permission denied (publickey,password).
Permission denied (publickey,password).
Permission denied (publickey,password).
Run steps:
1) Create clone of git-hub library (git clone https://github.com/yardstick-benchmarks/yardstick-ignite)
2) Use (mvn package) command to compile the project and also to unpack scripts
3) Change Ip of driver and server from benchmark.properties
4) Run this command ./benchmark-run-all.sh
You need to configure ssh access to localhost without password. Refer to instruction there : How to ssh to localhost without password?
BTW this repository contains benchmarks for old Apache Ignite and yardstick version. New version of yardstick doesn't have this limitation and new version of Apache Ignite provide the better performance. In the last versions Apache Ignite distributed with benchmarks. You can download there https://ignite.apache.org/download.cgi#binaries and found them and instruction in /benchmarks folder.

What is the correct procedure for adding SQL Server JDBC to GlassFish 3.1.2

I am setting up a test GlassFish Server to learn NetBeans, Java, GlassFish web application development. I was able to do a basic deployment successfully and am moving on to databases.
I am trying to set up a MS SQL Server connection pool in the GlassFish admin. After configuring the datasource as javax.sql.Datasource and setting the properties, it fails to successfully ping the connection.
When I try to ping the connection, I get this error
Ping Connection Pool failed for SQLDB. Class name is wrong or classpath is not set for :
com.microsoft.sqlserver.jdbc.SQLServerDataSource
It looks like the .jar file isn't being loaded. I have placed the sqljdbc4.jar in the glassfish\modules folder.
What is the correct process for setting up a JDBC connection pool for SQL Server?
In case you are using JRE 7 : use JDBC41
in case you are using JRE 8 : use JDBC42
Unzip the exe from the following link : https://www.microsoft.com/en-us/download/confirmation.aspx?id=54671
Paste the jar in the lib folder of glassfish .
Once done define property under connection pool as URL and pass full qualified connection name as : jdbc:sqlserver://localhost\MSSQLSERVER:1433;databasename=AdventureWorks2016;integratedSecurity=true

Getting mongodb authentication failed error

I'm using playframework -v 1.2.4, and using the morphia plugin. When I run play test, and connect with mongolab db, an exception is thrown with the following error:
Oops: RuntimeException
An unexpected error occured caused by exception RuntimeException:
MongoDB authentication failed: mydb
My application.conf as follows..,
application.mode=dev
%prod.application.mode=prod
morphia.db.host=ds033187.mongolab.com
morphia.db.port=33187
morphia.db.username=demo
morphia.db.password=demo
morphia.db.name=mydb
But the above credentials are able to connect with mongodb
D:\mongodb-win32-i386-2.0.1\bin>mongo ds033187.mongolab.com:33187/mydb -u demo -p demo
MongoDB shell version: 2.0.1
connecting to: ds033187.mongolab.com:33187/mydb
>
But i get connection with mongodb shell. Why i'am getting this error?
I am assuming that you are using the PlayMorphia module, and taking a quick look at the documentation, it uses "morphia.db.seeds" instead of "morphia.db.host".
It could be that, since "seeds" is not specified, the morphia module is connecting to the localhost.
had the exact same problem.
i suppose you added the user via
use admin
db.addUser( "user", "pw" )
however, play morphia does seem to authenticate against the very db you're using, not against the admin db. the following solved my problem:
/path/to/mongo
use admin
db.auth( "user", "pw" )
use myDatabase
db.addUser( "user", "pw" )
now it should work :)

Categories