HSQLDB Database multiple connections - hsqldb

Is it possible to connect to a HSQL database over multiple connections?
I have 2 connections using the same JDBC URL and the same hsqllib.jar and it appears I get a "new" database.
I imagine each connection is initializing the database in its memory?

You will need to run HSQLDB in standalone mode, and then connect both instances of your application to the standalone instance. The documentation describes how that start in server mode. For example, the following would start an in-memory database named database1:
java -cp ../lib/hsqldb.jar org.hsqldb.Server -database.0 mem:database1 -dbname.0 database1
You can then connect to that instance from your application using the following URL (assuming that everything is running on the same server):
jdbc:hsqldb:hsql://localhost/database1

Related

Fail to add ODBC Data Source to a SQL Server

I use an online database which I am able to connect through altium or dbVisulizer. I want to add an instance to that database using ODBC Data source in windows, but it fails. The steps I followed are pictured below:
Any idea why is this happening?
Additional information:
Altium use the following information: ConnectionString = Provider=SQLNCLI11.1; User ID=alib_WFC5AKIMTQCL; Password="*********"; Initial Catalog=altium_library; Data Source=db.altiumlibrary.com,1433; Initial File Name=""; Server SPN=""
After connecting through dbVisulizer I have the following information: The server version is: Microsoft SQL Server 14.00.2027 Microsoft JDBC Driver 9.2 for SQL Server 9.2.1.0
I don't believe this is possible. However, in most cases, if you can connect to sql server via jdbc drivers, then you can connect to the same sql server with odbc.
Access does not support jdbc, and in most cases that driver is Java, and thus you would be talking about a java enabled client side software.
For example, I have a instance of SQL server. I direct connect from Access over the network to SQL server - using ODBC drivers.
However, my android phone? Well, I use jdbc type 4 drivers, and thus my android phone can also direct connect to that same instance of sql server on the network.
However, there is no support for Access to connect to SQL server using jdbc drivers, but then again, if that is SQL server in question, then both jdbc, and odbc should be able to connect to that running instance of SQL server.
Now, you might be able to setup and run what is called a jdbc "bridge" connection. This would require that you install + setup a bridge on your computer. (and that bridge runs like a mini web server - it is NOT just a driver, but a web like "service"/"server" that you have to have running. In fact, it quite much the reverse that such a bridge is for. So, for example, if you running that bridge, then it would be possible for jdbc drivers to in fact connect to the access database (this would be a type 2 (or 3???) jdbc driver/connection.
So, to be clear, a jdbc type 4 connection is NOT possible to Access, since they require a so called "socket" (tc/ip) connection. Access is file based, so you don't ever connect to a access database, but you OPEN IT as a file. However, as noted, you are talking about Access connecting to the server anyway.
However, Access does not support, nor use nor have any means to use and consume a jdbc driver. But then again, it stands to reason that any database from MySQL, Oracle, PostgrSQL, SQL server, and more ALL HAVE ODBC drivers.
So it begs the question, why a ODBC driver would not be used here?
But, as noted, since Access supports ODBC drivers, and not jdbc drivers, then the answer is no - Access cannot use such drivers.

How do I create postgre SQL database locally with DataGrip

I'm getting started with Data Grip and I'm stuck before I started doing anything. First thing I've done was creating postgre Data Source with default parameters.
Now I opened a console, and tried to run a script:
drop table table1;
The console then prints:
Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
What can I do about that, so that I could create my project in e.g.: D:\Database\ instead of connecting to other hosts?
Sounds like you're not actually running PostgreSQL locally. Is it installed and running? PostgreSQL is a client/server-based database system, so it requires the server process to be running. This is not like SQLite or HSQLDB that run self-contained within your application (or DataGrip in this case). Please see here for a tutorial on how to get started with Postgres on a Mac. There are similar tutorials for other operating systems.

Apache Ignite Application to load database table?

How can I create a maven project in java to load an Oracle database table on the Apache Ignite server?
Also, I'm supposed to create the project on my local machine while Apache Ignite runs on a remote machine to which I have SSH connection.
You can use Ignite Web Console to do that. There is a public Ignite Web Console hosted by GridGain.
It will ask you to download Ignite Web Console Agent, connect to your Oracle database, analyze your data structure and output a zipped Maven project with data load functionality out of box (via loadCache).
Deployment of the project to remote machine is out of scope of this excercise.

IBM Mobilefirst 8 with Websphere application server using oob derby database

Installed IBM Mobilefirst 8 server with WAS 8.5.5.12 using Apache derby database.
Facing below error while checking connection of datasource which are created for mobilefirst server :
java.lang.Exception: DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: org.apache.derby.jdbc.AutoloadedDriver40 incompatible with org.apache.derby.jdbc.InternalDriver
Working fine with mysql database.
While this message would normally indicate that a data source implementation class was specified that does not implement javax.sql.ConnectionPoolDataSource, I don't believe that is the case here based on the classes identified in the exception message. Another possible cause is that multiple copies of the Derby JDBC driver are on the classpath at the same time. It should be noted that WebSphere Application Server traditional ships a copy of the Derby JDBC driver. If you do have two copies, is it possible to switch to only using the one that is shipped with the application server? If that is not possible, you might be able to work around this by selecting the option to isolate your JDBC provider.
For use with MFP 8.0 standalone server with Websphere Application Server 8.5.5.5, use DB2,MySQL or Oracle

spring boot switching from in-memory database to persistent database

I have developed my web-application using spring-boot and spring-data-jpa and and in-memory database, and I have a couple questions:
how can i now switch to a persistent, let's say, MySQL database? What do I have to change in my configuration?
Can spring-boot set a database up for me with a specific port and where does it get stored in my file system?
Does IntelliJ provide a datasource browser for the created database?
I am sure this must be covered somewhere in the endless jungle of spring-boot documentation.
You can change the application properties for the datasource according to the link Gabor Bakos already provided.
That depends on the type of the database you want to use. HSQLDB and H2 allow you to specify a file path for the database file, however the database instance itself is still running within your application process. With full RMDBS like MySQL you have to install and configure the MySQL server yourself and provide the connection data to your Spring Boot application.
Yes, IntelliJ has a datasource browser for all major databases (maybe you have to download the database driver).