I am trying to do some automation in mysql and redshift usin Java (JDBC) preferred. I usually use a remote desktop connection to connect, from there I use mysql workbench and aginity workbench to access mysql and redshift repectively. I have authentication for both as well as the aws urls.Also the aginity license. My goal is to connect Java running outside the remote desktop, to query some data fro mthe databases and compare them. I would like to know how to connect to both databases, as well as the documentation where I can learn more. I familiar with all three technologies , I just now sure how to connect them together. I am lost ,kidnle help. Thanks in advance.
Related
I have an MSAccess database in my local windows. and I need to connect it with java code using Kubernetes.
I tried to use the below:
jdbc:ucanaccess:///run/desktop/mnt/host/c/Users/Public/fdb/F_B_1_2.mdb;jackcessOpener=com.sms-manager.mobile_app.mobileapp.manage.CryptCodecOpener
But it's not working with me.
it's giving java error database not existing.
Is your java application running in container and trying to connect to ms access db which is in another machine? if yes then you can create Kubernetes service and endpoint of your db server or external name of db server. Choose suitable JDBC and ODBC driver to connect to MS Access Database
I plan on making a distributed application where 10-15 computers are connected in a LAN and there is one server where the database will be stored, also inside the LAN.
For the purpose of the question lets say the application will be made using Java and the database will be MySQL, but that is not yet decided.
So the question is, what do I need to realize this?
I have ofcourse worked with MySQL databases, but on a single computer so I am not quite sure how to connect the computers to the database server. Is it enough to setup the server local IP on all client computers and connect to it using the JDBC MySQL driver, and after that I can work with it like the DB is on my machine?
Also, do I need a server application to manage connections to the database, so that there are no conflicting entries? And if I do, then the connection part changes, because it needs to be established over the server application, so how do I do that?
I know it is a large question, but a lot of things seem unclear, because I have never attempted a project this big.
Thank you all!
Don't worry just made your application, you can connect to your database via an #IP, so just make a part of configuration in your application to change some information in future:
String db_url = "jdbc:mysql://192.168.0.1/db_test";
Is it enough to setup the server local IP on all client computers and
connect to it using the JDBC MySQL driver, and after that I can work
with it like the DB is on my machine
You don't need a server local of every computer, you can connect to the server directly.
Also, do I need a server application to manage connections to the
database, so that there are no conflicting entries? And if I do, then
the connection part changes, because it needs to be established over
the server application, so how do I do that?
If you are using a desktop application, the you don't need a server application, else if you are using a web application, yes you need one.
You need to shouse a server application, this dippend of your project or your company, there are free servers like GlassFish, Payara, Apache Tomcat, Wildfly and more.
Now the connection to your database, there are many ways to connect to your database, if you are using JPA to connect to your database, then you will hear
something about Entities, Facades, JNDI so this generally be configure in your server
application.
Hope you get an idea.
I need to connect over the internet with the Android client to Oracle PL/SQL database. (With static ip or with the host name).
But already using java client over the year with oracle. And I don't want to go for another database for implementing (Because I already written most complex procedures.,)
And that java client server connection happening via LAN connections only (But the system has the static ip and not used for this. Because LAN communication works perfectly).
Please tell me the process what I have to take.
Note: I am using Oracle 10g (10.2.0.5.0) and Latest Version of java (1.8).
If Possible: Please Provide a link for ojdbc drivers(Don't know which driver version used for Android).
Thanks in advance.
I am fairly new to H2 Database. As a part of a PoC, I am using H2 database(version : 1.4.187) for mocking the MS SQL Server DB. I have one application, say app1 which generates the data and save into H2. Another application, app2, needs to read from the H2 database and process the data it reads. I am trying to use Auto Server mode so that even if one of the application is down, other one is able to read/write to/from the database.
After reading multiple examples, i found how to build the h2 url and shown as below:
jdbc:h2:~/datafactory;MODE=MSSQLServer;AUTO_SERVER=TRUE;
Enabled the tcp and remote access as Below:
org.h2.tools.Server.createTcpServer("-tcpAllowOthers","-webAllowOthers").start()
With this, I am able to write to the database. Now, I want to read the data using the h2-web-console application. I am able to do that from my local machine. However, I am not able to understand how I can connect to this database remotely from another machine.
My plant is to run these two apps in an ubuntu machine and I can monitor the data using the web console from my machine. Is it not possible with this approach?
How can I solve this ?
Or do I need to use server mode and explicitly start the h2 server? Any help would be appreciated.
By default, remote connections are disabled for H2 database for protection. To enable remote access to the TCP server, you need to start the TCP server using the option -tcpAllowOthers or the other flags -webAllowOthers, -pgAllowOthers
.
To start both the Web Console server (the H2 Console tool) and the TCP server with remote connections enabled, you will have to use something like below
java -jar /path/to/h2.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser
More information can be found in the docs here and console settings can be configured from here
Not entirely sure but looking at the documentation and other questions answered previously regarding the same topic the url should be something like this:
jdbc:h2:tcp://<host>:<port>/~/datafactory;MODE=MSSQLServer;AUTO_SERVER=TRUE;
It seems that the host may not be localhost and the database may not be in memory
Is there a need for the H2 web console?
You can use a different SQL tool using the TCP server you have already started. I use SQuirreL SQL Client (http://squirrel-sql.sourceforge.net/) to connect to different databases.
If you need a web interface you could use Adminer (https://www.adminer.org/) which can connect to different database vendors, including MS SQL, which happens to be mode you're running H2. There is an Adminer Debian package that should work for Ubuntu.
I need to retrieve data from the database. I have the database name, username, password, servername, but I don't have the software installed in my machine. Can I connect to the db and retrieve the data from the db from database from Java code?
you need to have database drivers atleast like ODBC or JDBC drivers on your system where application runs to access the DB from other machine.
Yes. The jdbc driver .jar can be used stand alone. It logs a warning about a missing .dll, but that can be ignored unless you need to use windows auth.
From Java, it's easy as long as there is some kind of driver installed (for example, ODBC.) Try Googling connecting to db using odbc.