I am using the web console of H2 Version 1.4.198 (2019-02-22)
to create a embedded database. But I am getting the following error saying "unable to find the database". I want to create the database not open an existing one. I using ubuntu 18.04 and have given execute permisison to h2.jar and h2.sh.
I get the same error with the latest (1.4.198) version. It works for me with the stable version - 1.4.197. #sagar-bahadur-tamang can you check your version and try suitably?
In application.properties or yaml file check spring.datasource.url remove the flag IFEXISTS=TRUE;.
If the flag is set to true, the connection is only established if the database exists. For reference of the flag see http://www.h2database.com/html/features.html#database_only_if_exists
The application properties file should look like as below
application.properties
h2.datasource.driver-class-name=org.h2.Driver
h2.datasource.url=jdbc:h2:file:~/test;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=NO
h2.datasource.username=sa
h2.datasource.password=
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console/
It looks like as below (Test Connection is successful)
Related
There are several .txt files in my Java gradle project, which I use to populate a database using the MySQL statement LOAD DATA LOCAL INFILE in sql scripts.
There is a MySQL server running on my PC, whose hostname is 127.0.0.1, port is 3306 and DB name is test, so in the gradle project's build.gradle file I configure flyway in the following way:
flyway {
url = 'jdbc:mysql://127.0.0.1:3306/test'
user = 'root'
password = '111111'
}
An example .sql file is
LOAD DATA LOCAL INFILE 'data/categories.txt' INTO TABLE category
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n';
but when running migration using gradle flywayMigrate -i, I got the following error:
Loading local data is disabled; this must be enabled on both the client and server sides
I think I have enabled it in the server side as shown below, which is a MySQL Command Line Client screenshot.
Hope I did it correctly.
After this step, the error still show up, so I think I also need to enable it in the client side, which is in the Java gradle project, is that correct?
Based on https://dev.mysql.com/doc/refman/8.0/en/load-data-local-security.html, I should set ENABLE_LOCAL_INFILE = 1.
But how to do that? In where should I add this ENABLE_LOCAL_INFILE = 1 connection string?
Hope someone can help me.
Thanks in advance!
Use the JDBC connection string property allowLoadLocalInfile=true
See https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-connp-props-security.html#cj-conn-prop_allowLoadLocalInfile
I am trying to configure activiti to communicate ms-sql 2014 with windows authentication instead of with username/password in connection url.
What i have done ?
downloaded JDBC Driver, put sqljdbc4-3-0.jar in JAVA_HOME and in the web-info\lib
put sqljdbc_auth.dll (64bit) in C:\Windows\System32
set integrated security in db.properties as following:
db.properties (C:\Workflow\apache-tomcat-7.0.62\webapps\activiti-explorer\WEB-INF\classes):
db=mssql
jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.url=jdbc:sqlserver://127.0.0.1:1433;databaseName=activiti;integratedSecurity=true;
When using regular authentication (I remove the integratedSecurity=true and add user=XXX and password=XXX it works!)
When I open log the last line is:
DEBUG org.springframework.jdbc.datasource.SimpleDriverDataSource: Creating new JDBC Driver Connection to [jdbc:sqlserver://localhost;databaseName=activiti;integratedSecurity=true;]
Then the java application shutsdown and i see hs_err_pid4232.log as attached with exception:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000061a3cf13, pid=4232, tid=8080
What can cause this not to work ?
I want thinking maybe it did not load the DLL/JARS it should be in order to use JDBC driver ? the sql server config looks like this:
The log of process crush is at: http://pastebin.com/xpW5yvEP
This error screams "trouble with the authentication dll". Try these steps:
Download latest sqljdbc, unzip it locally from here: https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
put the .jar in your classpath and the .dll in your library path. Try using a "real" path by adding -Djava.library.path=PATH/TO/DLL into your startup.
run java -fullversion to make sure you have the right .dll (32 bit vs 64 bit) installed there.
run program again.
I have created database with my own program and it appeared as mydatabase.mv.db file.
But when I tried to access the same database with DbVisualizer, with apparently same parameters, it created two files mydatabase.lock.db and celebrity.h2.db and didn't see tables, created in the program.
What was the incompatibility?
UPDATE
both setups are follows:
In H2 version 1.3.x, the database file <databaseName>.h2.db is the default. (The storage engine "PageStore" is used).
In H2 version 1.4.x, the database file <databaseName>.mv.dbis the default. (The storage engine "MVStore" is used). The MVStore is still beta right now (November 2014). But you can disable the MVStore by appending ;mv_store=false to the database URL.
The accepted answer is now several years old and since others may be looking for a more "current" solution...
To get it to work just update the H2 JDBC driver that DBVizualizer uses. Basically download the "Platform-Independent Zip" from http://www.h2database.com/html/download.html and copy the h2/bin/h2-X.X.X.jar file to ~/.dbvis/jdbc/ and then restart DBVizualizer so it can pick up the updated driver.
Also, make sure you remove .mv.db from the file name when setting the Database file name in DBVizualizer.
For Windows Users:
The excellent way to read a *.db.mv file would be locally installing the h2 database and then running that database locally with the java command.
Then your path to the file will definitely show the data from your table until and unless any errors occur.
You can download the h2 database form:
http://www.h2database.com/html/download-archive.html
Note: choose the database version for H2 which supports your file.
You can install the H2 database by installing the downloaded .exe file would be around 7 MB.
then in the bin directory of H2 open a command prompt and run the command
java -jar in my case it is
command: java -jar h2-1.4.200.jar
It will show the console of the H2 database on the browser
Provide the database details:
Driver Class: org.h2.Driver JDBC
URL: jdbc:h2:~/h2 "file path"
User Name: "blank by default"
Password: "blank by default"
Refer SS below
enter image description here
I have installed Hadoop & connected with Hadoop locally successful. I can connect the Sqoop via REST api and via cli interface.
But once I want to start creating a job for important data from MySQL. It shows
Connection configuration Warning message: Can't connect to the
database with given credentials: No suitable driver found for
jdbc:mysql://127.0.0.1:3306/for
Error message: Can't load specified driver
after google its solution, I has already
put the mysql-connector.jar to sqoop web lib folder
create a lib folder under the sqoop folder and put the mysql-connector.jar in it
I also have restarted or even reboot my VM. It still says cannot load specified driver.
Is there any config files I have missed to set? Thank you!
My ENV:
VirtualBox + Vagrant + Ubuntu 12.04
JDK (Sun Distrubution 1.7_update 51)
Hadoop 2.2.0 (complied version)
Sqoop 1.99.3 (complied version)
Thank again!
check your 'JDBC Driver Class' of the connection you just created in sqoop,it should be setted
as com.mysql.jdbc.Driver.
If still not work,put mysql-connector-java-3.1.12-bin.jar into $SQOOP_HOME/server/lib
I've inherited a project (and I have absolutly no experience of Java) and I'm rather stuck.
We have a server running redhat, which I needed to update one of the jar files. So I simply copied up the updated file and restarted the service for that file. However this process has worked on our other server I did that too but on this one it comes up with the below in the log file.
Exception: com.mysql.jdbc.Driver
SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbanme
The jar files are uploaded to a folder in the root of the website and within that jar folder is a lib folder where mysql-connector-java-5.1.6-bin.jar is located.
Does anyone know what I could be missing as I'm a newbie to linux aswell.
Thanks in advance
java.sql.SQLException: No suitable driver found
This exception can have 2 causes:
The JDBC driver is not loaded at all.
URL does not match any of the loaded JDBC drivers.
Since the driver seems to be loaded , it look like that the URL is not valid on that machine:
jdbc:mysql://localhost:3306/dbname
Do you have mysql running and listening on port 3306 on that machine. Also make sure you hte schema dbname there.
You need only set that:
[jdbc:mysql://localhost/dbanme]
instead of
[jdbc:mysql://localhost:3306/dbanme]
Because java compiler default understand a port 3306, so no need to fill "3306" after "localhost:"