I am learning about JDBC. When I am learning about it, I have come to known we can use 4 drivers. In each of these architecture I find the vendor database libraries in jdbc-odbc bridge driver and also native API calls in other type 3, 4.
I am unable to know about those concepts in the architecture.
So I request anyone to say about those two concepts which deals with the JDBC drivers.
I have referred the below link :
http://www.javatpoint.com/jdbc-driver
Vendor based database libraries means you need to use libraries provided by vendors to connect to database.
For example
You need to use ojdbc6.jar for Oracle , postgresql-9.4.1207.jar for postgresql etc.
Short answer: database is called a vendor database if you interact with it through JDBC using special drivers.
JDBC is an API, which allows you to work with different databases (such as MySQL, PostgreSQL etc.) using the same methods to query and update data in a database. This happens by using special drivers, which are unique for every database. In this case the database you are working with is called a vendor database.
Related
TL;DR:
Is there a way to connect to an Oracle DB via JDBC without the Oracle JDBC driver? Or any other way (e.g. hibernate)?
Full story:
We have an existing Spring Boot app, which connects to an Oracle 11c database instance using OJDBC driver. Spring Boot internally uses JdbcTemplate to execute a few inserts and selects, basically 5 or 6 type of statements. Technically it is working fine.
However we are in an interesting situation, the code we built has to pass through a series of checks (we are working as subcontractors under a larger international company), and part of these checks is a license inspection. BlackDuck (https://www.blackducksoftware.com) is used to report every single library which is linked in the solution (around 280 in our case), and we had to manually add the copyright statement to each (for example: "Copyright © 2005-2019 The Apache Software Foundation. All Rights Reserved."). We added the Oracle Technology Network license to the Oracle Driver, and it was rejected by the legal team of the international company:
"Unless we are actually licensed to use an Oracle database (which you are not), we cannot allow the use and distribution of the Oracle JDBC drivers. Those drivers are licensed under the Oracle Technology network license and it obligates XXX [company name] to designate Oracle as a 3rd party beneficiary, which is not something our legal department allows. You must therefore find a compatible replacement that is licensed under open source."
Now, we are obviously trying to get around this thing (seeing as the end client who is receiving the solution has a licensed Oracle DB installed, and we can see earlier versions of the OJDBC driver in the company's Nexus repository), but I wanted to ask, is there a way to connect to an Oracle DB via JDBC without the Oracle JDBC driver? Or any other way (e.g. hibernate)? To my knowledge, Oracle DB communication protocol is not fully standard, that's why you need the Oracle drivers. Is there an open source alternative that I don't know of?
Oracle DB communication protocol is not only "not fully standard", there is simply no SQL or JDBC standard for any on-the-wire communication protocol for SQL databases, they are all proprietary.
There is no open-source alternative that I'm aware of, and there couldn't be without Oracle's help as the protocol is not publicly specified as far as I know. We solved a similar problem by having our customers with an Oracle license add the driver to their deployment of our app, that way we didn't redistribute it, and they were the ones who used it.
Yes, use someone else's driver. Progress makes one for example.
I'm not speaking on behalf of Oracle in terms of the quality of THIS driver or the legal terms concerning your decision to not use our driver. However, there are alternatives to our driver for Java applications, and this is one of them.
I am new to Java and i´m writing an assesy for school about database connections via JDBC.
Am i getting this right about the driver type 3:
The JDBC Type 3 driver is an all java driver witch calls JDBC Functions and sends them to a middle tier server, where they are transformed in vendor specific native database calls or to ODBC calls, which are then handled by an ODBC driver and sent to the database.
I also read that its possible to transform them to ODBC calls. I assume that this means a JDBC-ODBC-Bridge is used. If that is so, how is it possible to do that, because i read that ODBC drivers need to be installed on the Client and cant be loaded over the network(according to descriptions of driver type 1).
And furthermore, why on earth would anybody use a type 1 driver on Clientside, where you need to install native code and the ODBC driver on the Client machine?
Am I getting something wrong here or is the type 1 driver just an ancient technology which can be found in descriptions of JDBC but noone uses anymore.
Please help me getting the right idea.
http://www.jdbc-tutorial.com/jdbc-driver-types.htm has a good overview of the various JDBC driver types. As you suspected, the type 1 drivers are generally considered a legacy option nowadays.
You can find a good stack overflow reference on the same topic at What is type 1,2,3 or 4 of a JDBC Driver?
I have listened that type 2 driver needs some database library's apis. I cant understand above statement can you explain?
Just a paragraph snippet from this link. Also, visit the helpful link : JDBC Driver and Its Types
Type 2: Requires the DB2 Client is
also installed on the same server as
the JDBC driver because the driver is
simply a front-end to the DB2 Client.
It points to the alias you configured
on the Client for your database,
similar to an ODBC driver.
Type 4:
Connects to the database on server
directly via the hostname/port.
This link describe the difference between the 4 types of driver clearly. You may want to take a look at it.
Type 2 driver is database specific, as said in the article in the above link:
The distinctive characteristic of type 2 jdbc drivers are that Type 2 drivers convert JDBC calls into database-specific calls i.e. this driver is specific to a particular database. Some distinctive characteristic of type 2 jdbc drivers are shown below. Example: Oracle will have oracle native api.
I have listened that type 2 driver
needs some database library's apis.
Yes. Type 2 drivers convert JDBC calls into database-specific calls means this is specific to a particular database. For example- Oracle will have its own oracle native driver API. While the Type 4 uses java networking libraries to communicate directly with the database server.
I have 2 databases, Oracle and SQlite. And I want to create exact copies of some of the Oracle tables in SQLite in one of my applications. Most of these tables contains more than 10,000 rows so copying each table by going through each row programmatically is not efficient. Also the table structure may change in the future so I want to achieve this using a generic way without hard-coding the SQL statements. Is there a any way to do this?
p.s. - This application is being developed using Qt framework. All the queries and databases are represented by QtSql module objects.
Can't help with Qt framework, but for large amounts of data is is usually better to use bulk-copy operations.
Export data from Oracle
http://download.oracle.com/docs/cd/B25329_01/doc/admin.102/b25107/impexp.htm#BCEGAFAB
Import data into SQLite
http://www.sqlite.org/cvstrac/wiki?p=ImportingFiles
IHTH
What you probably really want to use is the Oracle Database Mobile Server, which can automatically synchronize a SQLite and an Oracle Database.
The recent release of the Oracle Database Mobile Server (formally called Oracle Database Lite Mobile Server) supports synchronization between an Oracle Database and a SQLite or a Berkeley DB database running on the client. It supports both synchronous and asynchronous data exchange, as well as secure communications between client and server. You can configure the Mobile Server to synchronize based on several options without the need to modify the application that is accessing the database.
You can also find an excellent discussion forum for questions from developers and implementers using the Mobile Server.
I'm from MySQL background and am new to Oracle. I want to know
What is meant by Oracle Client?
What is its use?
What is its equivalent in MySQL ?
Thanks
What is meant by Oracle Client?
and
What is its use?
In this context, a client is a class library (DLL) that allows you to connect remotely to the underlying database of an application. A client, always within the same context, can also be called a .NET Data Provider.
You may have multiple data providers based on the underlying database engine with which you're working.
There was System.Data.OracleClient (deprecated), provided by Microsoft.
There is Oracle.Data.Client, which is actually the best ever built Oracle Client, or Oracle .NET Data Provider. You may also download the latest Oracle 11g Data Provider for .NET.
So, when accessing the Oracle underlying database, make sure your work with this provider, proper for your version of Oracle, and start doing ADO.NET with your favorite database! =P
There are also some other tools that you can work with that will ease your data access code pain, such as Enterprise Library or NHibernate, both are frameworks to basically accessing databases.
Enterprise Library can do even more then that!
And NHibernate is an ORM (Object/Relation Mapping) tool that can work just very fine with Oracle.
Remember though, always use Oracle.Data.Client namespace in the Oracle.DataAccess.dll assembly.
What is its equivalent in MySQL ?
As the equivalence for MySQL, I guess it would be MySQL Connector/NET.
It is the Oracle binaries installed that allow communication with the Oracle database. It can be using SQL*Plus, JDBC (type II or IV) or OCI (Oracle Call Interface).
Its a piece of software that allows a remote computer to talk to Oracle. If you were to write a piece of software that communicated with the database, you would use the Oracle Client to facilitate that communication