Wrong user name when accessing play project database with h2-browser - h2

Unable to access play project embedded H2 database, i followed recommendations, and
run h2-browser within the same play console as explained here:
Accessing play project database with h2-browser
My Play framework settings ( 2.3.10)
db.default.url="jdbc:h2:mem:play"
db.default.driver=org.h2.Driver
db.default.username=sa
db.default.password=""
But i keep getting this error: Wrong user name or password [28000-180] 28000/28000 (Help)

The Play 2.3.x JDBC datasource is managed by BoneCP
Correctly define User name
db.default.user=sa
So I used settings from more recent version
Play framework 2.5.x is using HikaryCP where this would be correct
db.default.username=sa

Check this link, I tried to describe.
Reason:
When connecting to the H2 database for the first time, the H2 database initializes the user name and password, but properties the database user name and password are defined in the configuration file , causing a conflict.
Solution:
Close the program and close the database connection (if the program is not closed, an error will be reported and cannot be changed)
Delete the database and delete the xml file in dataSources under .idea
Recreate the database and start the project

Related

Unable to connect to SQL Server using the quarkus-hibernate-reactive due to incorrect reactive.url

I had worked on Quarkus connecting to Postgres. But this is the first time I am trying to connect to SQL Server, which is the default server in my current project. I am following this guide to create a database component.
The properties file contains the following:
quarkus.datasource.db-kind=mssql
quarkus.datasource.username=<user-id>
quarkus.datasource.password=<pwd>
quarkus.datasource.reactive.url=sqlserver://localhost:1433/<db-name>?currentSchema=<schema-name>
quarkus.datasource.reactive.max-size=20
hibernate.default_schema=<schema-name>
The application starts fine, but when I make a request to the Resource that internally uses the repository, I get the following error:
Internal Server Error
Error id f0a959d2-3201-4015-bfd7-6628ae9914d1-1, io.vertx.mssqlclient.MSSQLException: {number=208, state=1, severity=16, message='Invalid object name ''.', serverName='<sql-instance>', lineNumber=1, additional=[io.vertx.mssqlclient.MSSQLException: {number=8180, state=1, severity=16, message='Statement(s) could not be prepared.', serverName='<sql-instance>', lineNumber=1}]}
This means, my application is able to connect to the database, but it is not able to find the table. The table exists in a schema, and I am unable to pass the schema which may be the cause of the issue. If you check the properties file, I have tried with two options:
Adding 'currentSchema' as a query param
Adding the property 'hibernate.default_schema'
But none of the two options are working. There is no documentation on SQL Server that can help me provide the right configuration to the Quarkus application. Please help.
The correct property is quarkus.hibernate-orm.database.default-schema It is possible to check all the available configuration properties in this url https://quarkus.io/guides/hibernate-orm#hibernate-configuration-properties

SQL Azure Database Build Fail - Master Key Must Be Created Before DB Scoped Credential

I've imported an Azure SQL DB into VS so i can work in Azure Devops with it.
I'm getting this error when i try to build the DB:
SQL71589: Master Key must be created before a database scoped credential
The DB has a master key, which was created before the user, credential, and external data source which uses it.
I've tried importing into VS with just the master key and no DB Scoped cred, and get no error, then when i create the cred and load it the error comes back. So it seems to be with the creation of the cred.
Also when i click into the error it says there are syntax errors on my cred script, but I've checked against MS docs and it seems fine.
I've tried dropping and recreating in this order the master key, user, credential and external data source.
Seems to be a couple of threads here about this but they haven't helped so far.
I'm using VS 2019 v16.5.4
Any help would be much appreciated.
Open the file that caused the error. Add the creation of Master Key to the top of the file before the Scoped Credential and save it. After the change the content of the file will look like below:
CREATE MASTER KEY ENCRYPTION
BY PASSWORD = '{Your Password}'
GO
CREATE DATABASE SCOPED CREDENTIAL [Your Credential]
WITH IDENTITY = N'SHARED ACCESS SIGNATURE';
Build the project, the build should now be successful.

No Database Instance in nopcommerce 3.90

I am facing error in nopcommerce 3.90 when run the project at that also at sometimes it is working good but after sometimes it shows the error of "no database instance". I am surprised it shows this type of error. Because the normal thing I have done to run the nopcommerce project.
I have done these things:
set the setting file by installation of nopcommerce.
delete the bin folder of nopcommerce.
clean the solution and rebuild it.
But still facing the same issues.
"no database instance" this type of error occures when the Nopcommerce is not able to connect with the database. If you have created database locally then try to find SQL service and restart the service. But if you are having database being hosted on any other server then check you network connection.
There are some of summery solution that i have mention as below
=> Since i had moved a live cart to a test server, the settings in the database for that cart had force ssl and also force www before any url. Also under Store settings i still had the domain info for that site which was now difrent in the test server. Once i noticed this and updated the database it all started working.
=>
You try change settings.txt file:
DataConnectionString: Data Source=localhost/IP;Initial Catalog=DBName;Integrated Security=False;Persist Security Info=False;User ID=DBUser;Password=DBPass;MultipleActiveResultSets=True
=>
In my case I need config application pool for nopcomerce
my connection string
DataProvider: sqlserver
DataConnectionString: Data Source=.;Initial Catalog=nopcommerce370;Integrated Security=True;Persist Security Info=False
I need set Application Pool Identity to user has access right to db
Check the image to details.
=> Check also db permission.
=> try with
Data Source=9X.2XX.7X.XX\"yoursqlservenameinstance"
or
Data Source="yournamemachine"
or
Data Source="yournamemachine"\"yoursqlservenameinstance"
You can do some thing like
Check setting file on App_data existing or not
Check connectionstring is correct or not
Check your SQL server working or stop by try connect
Clear cache your browser
Try This ``
Right click on the downloaded file (nopCommerce_3.40_Source.rar) ->select properties -> press "Unblock".
and
and change connection string in Settings.txt file.

How to use DATABSE_URL in Play 2.0 (Scala) for local connection to PostgreSQL 9.1 & Heroku?

I have developed a first web application using a local PostgreSQL 9.1 on OSX (Lion 10.7.4) using Play! Framework 2.0.3. I started with my database connection defined in conf/application.conf (relative to application's directory) with
db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost/fotoplay"
db.default.user=foo
db.default.password=bar
(username and password have been changed before posting) This works for writing and testing. I now want to deploy to Heroku. I have set up the Procfile (in application's directory) with a single line:
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS}
-DapplyEvolutions.default=false
-Ddb.default.driver=org.postgresql.Driver
-Ddb.default.url=$DATABASE_URL
I have exported DATABASE_URL in .bash_profile so that I can echo $DATABASE_URL at the system command line and get
postgres://foo:bar#localhost/photoplay
At Heroku, I have set up an instance of postgresql. I'm not sure on how to write a database evolution to populate heroku, so I turned that off evolutions and populated my database manually. My current evolutions build tables and populate them with some initial data from some csv files, so I would need to place the csv files somewhere accessible to heroku. At least for a first pass, I don't want to tackle this issue just yet. But as a result of the manual steps, I have a populated database on Heroku.
With this configuration, my application runs correctly locally. However, I am not using DATABASE_URL, which seems wrong. I pushed this to HEROKU and is is not able to connect to the database. The error is:
Caused by: org.postgresql.util.PSQLException:
FATAL: password authentication failed for user "foo"
If I remove the username & password, I break my local configuration. I should be able to use DATABASE_URL 'instead of' the older syntax, but I don't quite know how to do that. I don't think that I can figure this out experimentally (wandering high dimensional spaces is hopeless, and there are several possible configuration settings that might be involved & are subject to typos). Any guidance on how I should set up application.conf would be appreciated.
Worth a try: in your application.conf file, change your db.default.url parameter in order to include the username & password in the URL, and remove the db.default.user and db.default.password parameters:
db.default.url="postgres://foo:bar#localhost/fotoplay"

Adding a jdbc driver to pentaho design studio and configuring the datasource

I've just integrated pentaho's design studio into the BI server. Does anyone know how to add mysql jdbc drivers. I need to connect in order to define the relational action process.
In my research I found:
http://wiki.bizcubed.com.au/xwiki/bin/view/Pentaho%20Tutorial/Install%20Pentaho%20Design%20Studio#Comments
which specifies selecting
JDBC Driver, Edit, Extra Class Path from Preferences but no such preference exists,
http://forums.pentaho.com/showthread.php?85148-Design-Studio-xaction-database-connection-dropdown-list-empty&highlight=add+jdbc+driver+to+design+studio
which resulted in me creating a jdbc folder in which I placed the drivers in plugins\org.pentaho.designstudio.editors.actionsequence_4.0.0.stable\lib\
but just as the author of the thread I'm stuck
http://forums.pentaho.com/showthread.php?53303-Create-a-new-datasource&highlight=add+jdbc+driver+to+design+studio
suggests that:
3. If you are using the Pentaho DesignStudio you have to copy your jdbc (JAR files) to the plugins directory (in pentaho plugin) so you can develop, deploy and run your applications. This apply also to eclipse plugin (If you have now an Eclipse).
Which resulted in me placing the jar files in the plugin directory to no avail.
http://forums.pentaho.com/showthread.php?53715-Can-t-add-new-datasource-GA-version&highlight=add+jdbc+driver+to+design+studio
talks of a directory, rdw which does not exist
Any form of assistance will be greatly appreciated.
You have to configure the datasource by adding a Relational Process Action to your .xaction in the Pentaho Design Studio wherein you can specify the JDBC Driver, Username, Password and the Database URL. But first you have to put your MySQL JAR file in your lib folder /path/to/biserver-ce/tomcat/lib
You will also have to save your *.xaction file/s in the pentaho-solutions folder /path/to/biserver-ce/pentaho-solutions in order for your *.xaction files to connect to the database which you have assigned in your Relational Process Action.
I encountered the same problem and solved as follow
place mysql-connector-java-5.1.17.jar under (bi server path)\tomcat\lib\ folder
start Pentaho Admin Console (PAC) http://127.0.0.1:8099 with
user: admin
password: password
and add a connection there
use the name of the connection just created for action sequence as JNDI
The problem solved for me.

Resources