Connect to remote H2 Database in intellj idea - java

I have an application running on a server and I'm using H2 database for that,
This my database URL:
jdbc:h2:./cafeDB;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=7080
And I want to connect to this database using Intellj idea's database tools, this is my configuration:
But when I try to connect, It keeps asking me the DB's username and password, and even when I put the correct information and submit it says:
The specified database user/password combination is rejected: [28000][28000] Wrong user name or password [28000-200]
Am I doing something wrong?

Related

Can not connect to MS SQL Server using JDBC driver SQLState 08001

I am trying to connect to a MS SQL Server database using Java but I keep running into the same error.
I am using MS SQL Server for developers and am maniging it through SSMS. When I installed it I set is so it would use my windows credentials as password.
The JDBC driver is added to my project as a Maven dependency.
From what I understand reading the Microsoft doc's I should be able to use the following connection string:
String connectionUrl ="jdbc:sqlserver://localhost;integratedSecurity=true";
However this does not seem to work for me as it returns SQLState 08001. After reading up on this state I understand that it has something to do with failing to make the connection.
I also tried to form my connection string using my windows login name, which results in the same:
String connectionUrl = "jdbc:sqlserver:localhost:1433;databaseName=DBNAME;user=John Doe;password=0123456789";
I also tried to create a login using T-SQL to use as credentials using the same string as the previous (only changing the username and password):
CREATE ROLE [USER]
GRANT SELECT, INSERT ON SCHEMA :: [dbo] TO USERNAME
CREATE LOGIN USERNAME_LOGIN WITH PASSWORD = '1234567890'
CREATE USER USER_USERNAME FROM LOGIN USERNAME_LOGIN
ALTER ROLE [USER] ADD MEMBER USER_USERNAME
I could really use some help to understand what I am doing wrong and what I can do to make it work. If you require me to check anything please let me know how as I am still pretty new to this.
Edit
As requested here is the info coming from getMessage():
No suitable driver found for
jdbc:sqlserver:localhost:1433;databaseName=.....
I am guessing this would also be the moment to mention the Maven dependency I am importing:
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>7.3.0.jre8-preview</version>
</dependency>
I think the question now becomes, do I have the wrong driver as a dependency for MS SQL Server 2017?
I turned out I did not had TCP/IP connections enabled for MS SQL Server.
To enable this in MS SQL Server 2017:
Start SQLServerManager14.msc from the windows application menu.
Go to SQL Server Network Configuration.
Go to Protocols for YOURINSTANCE.
Set TCP/IP to enabled.

Heroku - FATAL: password authentication failed for user <>

First of all, I created PostgreSQL DB in Heroku. I manually created my DB/schema/tables through pgAdmin remote access. I know I succeeded since it updated my row limit.
Now, I am deploying a Spring Boot application.
No DB props/credentials are found in my application.properties file since I am supposed to do this in Heroku Config Vars. For example, my DB username is janxgspmlpjgbn
Project builds successfully, however, in the logs I see that it has this exception.
2016-09-28 16:12:31.184 [ERROR] org.apache.juli.logging.DirectJDKLog.log:181 - Unable to create initial connections of pool.
2016-09-28T16:12:31.185772+00:00 app[web.1]: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "u24453"
Question
Why does it fail for the user u24453 (by the way this user changes every time I redeploy) when in my Config Var, I typed the user janxgspmlpjgbn?
Edit
Here's how my Config Vars look right now:
u24453 is probably the OS user name (the one Heroku creates for your app as it runs on Ubuntu Linux).
I believe the Postgres Driver will use the OS username as your DB username by default (if a username is not provided). Thus, I suspect the DB username is not getting into the configuration properly.
In your application.yml you should have this:
spring:
datasource:
url: ${JDBC_DATABASE_URL}
username: ${JDBC_DATABASE_USERNAME}
password: ${JDBC_DATABASE_PASSWORD}
For more info see Connecting to Relational Databases on Heroku with Java

Cannot connect mysql workbench to remote database

I have a remote mysql database on mydomain.com power by goDaddy and have a database name "arsenal101" with several tables and I have assigned the user "arsenal101" with password "22216888" with full privilege to that database.
In my local MySQl workbench in Macbook, I try connecting my MySQL workbench to that remote database.
Here is the screenshot
The hostname I enter mydomain.com
The username is arsenal101
The password is 22216888
The default schema is blank.
After I pressed test connection, an error message showed up " Failed to Connect to MySQL at mydomain.com: 3306 with user arsenal101
access denied for user arsenal101#xxxxxxx (using password Yes)
You should check if GoDaddy allows you to do a remote connection to the database because a lot of hosting companies don't allow that. Their MySQL has to be configured to receive external connections.
According to here: https://in.godaddy.com/help/connect-remotely-to-databases-4978
If you want to connect remotely to a database, you must enable Direct Database Access when setting it up1 — you cannot enable it later.

Connecting to a MSSQL server using LDAP on Ubuntu Linux

I'm trying to connect to a MS SQL Server, using a linux client. I've tried both SQuirreL and DBeaver, but having no luck in either case. I've tried a few different drivers.
The connection string I am given looks something like this:
jdbc:oracle:thin:#ldap://<server>:<port>/<database>,cn=OracleContext,dc=<specific_dc>,dc=<specifc_dc>,dc=<specific_dc>
This seems to be an invalid URL, and I've tried various combinations of things (like using jdbc:sqlserver:// ... protocol, etc. It doesn't seem to like the #ldap in the connection string, and I've replaced the commas with semicolons. But, I'm new to connecting to SQL Server, much less using LDAP.
Any thoughts/help?
Thanks!
For those who are using DBeaver the way to connect to the SQL Server Database with an AD user is using the jTDS driver.
I am using DBeaver 6.0 in Debian 9. The user is an AD user.
In order to connect to the SQL Server from Linux Debian using DBeaver
1.- Select SQL Server jTDS driver
2.- Enter the connection information
3.- Go to Driver Properties tab and add the domain, user, password
Just as a note, in some post I found that they needed to change the property USENTLMV2 to TRUE but it worked for me either by putting the USERTLNMV2 in true or false.
A problem that I found was that when I was trying to connect to the database using my user and password the next error was thrown:
This error was thrown because of my user was about to expire. I tried with another AD user and it could connect.
cts:
datasource:
url: jdbc:jtds:sqlserver://dbserver:1433;database=DB;domain=yourdomain.com;useNTLMv2=true
driver-class-name: net.sourceforge.jtds.jdbc.Driver
username: username
password: password
hikari:
connection-test-query: SELECT 1
maximumPoolSize: 2
minimumIdle: 1

java.sql.SQLException: Single-Sign-On is only supported on Windows. Please specify a user name

I am using the jTDS driver in order to connect to an SQL Server database from my Android application, which uses the Windows Authentication. As advised in the FAQs, I read the READMESSO file and as told, I placed the native SPPI library (ntlmauth.dll) in the system path (defined by the PATH system variable)
However, when I try to connect to the database using the following code:
String driver = "net.sourceforge.jtds.jdbc.Driver";
Class.forName(driver).newInstance();
String connString = "jdbc:jtds:sqlserver://192.168.56.1/MyMovies;";
Conncection conn = DriverManager.getConnection(connString);
I get the following exception:
java.sql.SQLException: Single-Sign-On is only supported on Windows. Please specify a user name.
Since you are connecting from an android device, you would not be able to get the SSO credentials required by the driver to connect to SQL server. The setting you referred to works only if the java program trying to connect to the DB is on a windows machine, which is clearly mentioned by the error message.
Unless your application has authorization based on the SSO user connecting to the DB, you should have an SQL Server user-based authentication mechanism to connect to the server and all authorization procedures should be tied to this user.
You might have to give the username also.
"jdbc:jtds:sqlserver://192.168.56.1/MyMovies;instance=SQLEXPRESS;user=foo"

Categories