Question:
Just like you connect java with oracle using jdbc,what else is there to connect java and other applications?
anonymous
1970-01-01 00:00:00 UTC
Just like you connect java with oracle using jdbc,what else is there to connect java and other applications?
Three answers:
anonymous
2016-04-14 08:31:41 UTC
The best way to do is as follows, String driverName = "oracle.jdbc.Oracle"; String url = "jdbc:oracle:thin:[/]@//... Class.forName(driverName); Connection conn = DriverManager. getConnection(url) ; By this you actually need not import the driver class and you can still manipulate such that you can get the driverName and the url from a properties file. By doing this you need not restrict yourself to any particular oracle db you can connect to any db, provided you know the driver class name and the url and have the driver's jar file in class path.
deonejuan
2010-02-25 00:34:47 UTC
In the Linux world there are vast libraries of code written in C/C++ for just about anything you can imagine, i.e. isolating a galaxy from a telescope photograph. JNI -- Java Native Interface -- is the bridge that connects java to those sorts of external languages. JNA -- Java Native Access -- is comparable to JNI, but not so 'hard-wired'. JNA will search the linkages for you, for a price in performance. Either bridge is not so user-friendly and requires you write code in C/C++ and that you understand the libraries you want to use.



It is much easier to invoke System commands on the Linux platform using Java than it is with Windows or Mac. Java can run the Linux terminal, thus calling a Python script.



And then, Java has RMI -- Remote Method Invocation, whereby a local Java program is firing events on a remote machine.



There are others, but those are the major frameworks.
vincentgl
2010-02-27 17:26:04 UTC
As you mentioned JDBC, this API connects to (typically) database engines such as Oracle, IBM's DB2, MS's SQL Server, HSQLDB, etc. But because the API can be implemented by anyone, I have heard of it being used as a way to access non-relational data stores through SQL queries.



CORBA - Java SE includes CORBA API to connect and execute methods of objects written in other languages and running in other processes (other computers). This has often been used to call C++ and Ada applications/services.



Web Services - Java can connect and invoke services provided by other server applications via HTTP. Libraries that implement SOAP and REST APIs include fundamental packages in Java SE and EE core librairies, Apache Axis2, etc.



Native libraries - Java Native Interface (JNI) is a way to wrap calls to C and C++ native libraries (compiled for a specific operating system/host architecture). Java Native Access (JNA) is a newer approach to doing the same, not involving a lot of boilerplate and glue code like JNI does.



Scripting Language Code - the javax.script package supports calling external script code (conceptually very similar to JDBC), so you can call Ruby, Python, Javascript code, etc. You can also use Jython, JRuby, rjb (Ruby Java Bridge), and other langauge-specific connectors.



JNDI (Java Naming and Directory Interface) - partly included in Java SE, fully included in JEE, provides support for connecting to LDAP and DNS services, for example MS Active Directory services.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...