How to implement jdbc driver for presto - java

I am setting up a presto server. I have modified the open source jdbc of presto and developed my presto jdbc jar which is used for authentication. I am using db visualizer tool wherein I can copy the jdbc jar file in the path and use it to authenticate my presto db server. I wanted to switch to a web UI and I see many people recommending apache-superset. I see that the apache-superset is written in python. Is there a way to plugin my jdbc driver for presto in apache-superset so I can connect to my database and start querying the data.
I see that under Sources Tab we an add our database but this won't help me in connecting to my environment.

Apache Superset use PyHive package to communicate with Presto and also supports authentication. So, If this connector is not enough for your case you can use these approaches:
Modify Pyhive package for your usage.
Use JayDeBeApi to use your own JDBC Driver and create your own database connector on superset.

Related

Can I use Neo4j BI Connector with my Java app?

Neo4j have recently added a BI connector tool (neo4j.com/bi-connector) which can return relational data from your graph database to your business intelligence tool such as Tableau. The question is can i send SQL queries to this connector assuming i have added the jar file to my java application class path? If yes, which APIs should i use to send this SQL query to the driver?
I'm using Neo4j4.0.
For neo4j.com/bi-connector, if you look at the document PDF that you get when you download it, on page 10 where they show how to establish a connection you'll see that you get a connection object. After you have that, you have a standard JDBC connection which is a Java interface that tells libraries how to talk to a SQL database. There are a lot of different tools that use this interface, it's kind of user preference. A common one is JOOQ.

Can I bundle the Oracle JDBC driver JAR in a Docker image?

I'm building Docker images based on the official Docker Tomcat images, where in addition to Tomcat, I add one of our web applications as a WAR file so it gets deployed when the container starts.
Since the application requires access to a database, and the supported databases use different JDBC drivers and some additional configuration files, I'm building one image per supported database (all based on a common base image), where the image contains the respective database configuration and JDBC driver JAR.
So far, I have done this for MySQL and PostgreSQL, and I'm now looking at support for Oracle.
Since Oracle is a commercial product, and I read somewhere (sorry, no official source) that you're not allowed to bundle the JDBC drivers - what's the best solution for this?
Am I permitted/allowed to bundle the Oracle JDBC driver JAR in a Docker image that I make available to our internal users (not outside of the company)? Or do I have to ask users to download the driver themselves and map it into the image?
When you need an Oracle jdbc driver inside a war, you provide the service for your users without asking Oracle and without asking your users to accept the license, so it should not be different for a Docker image.
Now if you are distributing the driver packaged into your own software (not only the service), I guess Oracle requires you to contact them :
"Can third party vendors distribute Oracle's JDBC drivers along with their own software?
If you are a third party software company (and Oracle partner) then please check out Oracle's licensing terms spelled out at Oracle Licensing Agreement Please contact your local Oracle sales rep for more details."
source : http://www.oracle.com/technetwork/topics/jdbc-faq-090281.html

do I need to install sqlite software to connect in java?

To make connection to sqlite database and do some transaction, is it mandatory that a database software should be installed in the machine. I have seen that some libraries just handle connection and transactions without even database software. Or did I miss to notice that there were some database is already installed? How does the connection mechanism works?
A link to good article with detailed explanation would help me!
Thank you.
There are 2 options:
Use your DB locally:
For this you will need to install SQLLite on your machine, and in your project use JDBC jars for the connections from your java project to the DB. You may send queries to the DB as a string like "SELECT XXX FROM YYY WHERE a>b" or use Object Relational Mapping (ORM) tools like Hibernate.
If you have a remote DB installed on a VM on some cloud for example, then you don't need to install any DB on your local computer. But you will still need to use JDBC for connection.
You need Jdbc driver only or you can use ORM like hibernate.
Youtube has many tutorials about java and databases:
https://www.youtube.com/results?search_query=java+database+tutorial
If you are a begginer, start with jdbc with sql queries, later you should start using ORM's.
Probably you need to install mysql server or use this website https://www.elephantsql.com/ to get database instant.

How feasible is it to extend Microsoft's JDBC driver?

I'm currently working on a project where we have a Java web app bought from a 3rd party vendor that's connecting to SQL Server using Microsoft's JDBC driver. However, I've been given the requirement of having to encrypt the connection string using a proprietary encryption protocol.
So my question is how feasible would it be to extend the JDBC drivers distributed from Microsoft to incorporate this encryption. At this point I'm mainly thinking of creating a JDBC wrapper that will underneath use the Microsoft JDBC driver.
I'm open to other suggestions from more experienced people who might have done something similar in the past, or even if they could share pitfalls with this approach.
Use jtds. It's all java, works great for sql server, and supports encryption. It's a drop in replacement minus setting up encryption. You just need to know where they've configured their JDBC URL (hopefully in a configuration file under WEB-INF or some place like that), put in your jtds URL in there, and drop the Jar in the WEB-INF/lib directory. You may have to extract the WAR file and repackage it with jtds. It just depends on how this 3rd party vendor has deliver their app to you. And yes I've shipped production packaged enterprise software using it for years.
http://jtds.sourceforge.net/
So say they have a simple properties file like this:
db.url=jdbc:mssql:....
db.username=bibby
db.password=blahblahblah
Change it to:
db.url=jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
db.username=bibby
db.password=blahblahblah
Of course you'll have to fill in all of the <> and [] parts as needed. Then copy jtds.jar and any dependencies it needs into WEB-INF/lib and restart the server. It should work.
if the original driver does not have your desired function -> you could fetch the official release (or fork it) and patch/add your needs
https://github.com/Microsoft/mssql-jdbc/releases
At this point I'm mainly thinking of creating a JDBC wrapper that will underneath use the Microsoft JDBC driver.
I guess that you need a proxy on server side to decrypt the connection inforamtion, and forward database connection to SQLServer's port.

special driver to connect to sql server 2008 express

I'm a java newbie, want to test out some hibernate goodies!
I have netbeans installed, and I included the Hibernate libraries.
I then created a new package named Model.
I will drop my Class and xml config files in there.
Do I need a special library to connect to sql server? (windows machine)
Yes, you'll need a JDBC library that talks to Microsoft SQL Server. jTDS used to be my first choice but the Microsoft JDBC driver has come a long way and I'd recommend using that. You can download it from this site.
You'll also need to follow these instructions to get the two talking to each other as SQL Server express doesn't listen to TCP by default and uses Windows Authentication Mode.
Have a look at these two URLs for examples of your hibernate.cfg: An explanatory Blog Entry and a JavaRanch Question.

Categories

Resources