How can I connect oracle database without oracle client? - java

I want to connect oracle database without oracle client.After searching that how can i do this, figure out I must be use oracle instance client . But how can I use this? Icant find something about that.

The recommended (and most frequently used) JDBC driver for Oracle is the "thin driver". It doesn't need anything installed on the client (and is free).
This FAQ might be useful : http://www.orafaq.com/wiki/JDBC

Oracle client is a software that can easily be found and downloaded from oracle.com website. It has different versions for Windows, Linux, etc. After installing appropriate client, you will be able to communicate with the database by specifying its parameters such as host address, username, password etc. Without it, I think it's not possible to communicate with the database server.
http://www.orafaq.com/wiki/JDBC
On this page it says: "You must use a JDBC OCI driver appropriate to your Oracle client installation." What I understand from here is that you should use JDBC driver in your application, but without client installed, it will be nonsense.

Related

Connecting android client with oracle server

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.

Connecting to old Pervasive DB with JDBC

I'm trying to write a small program for CRUD operations against an old Pervasive 9 database, but as soon as I try to get a connection with Drivermanager.getConnection it throws
"java.io.IOException: LNA session closed"
I've read THAT post but copy/paste on that code didn't help me. Could be it configuration on that Pervasive 9 machine? Is it JDBC10 driver that won't play nice with older versions?
Or.. is it me being stupid? (everything is always possible)
Regards
According to Pervasive, using a newer client to an older engine is not recommended. This is documented at http://docs.pervasive.com/products/database/psqlv11/wwhelp/wwhimpl/js/html/wwhelp.htm#href=getstart/installprep.02.6.html#149125.
That doesn't mean it won't work but there's no guarantee. There are reports of the Btrieve interface working properly but the relational (SQL, ODBC, JDBC) side fails more often mainly because it changes between major versions where the Btrieve side stays the same.
I would suggest using the v9 client (and JDBC driver) or upgrading the server to v10.
#elwis your trouble it's the conecction with the database. I recommend you, make a connection using a reverse ssh tunnel against the machine where you have the database first with port by default of pervasive.
Something like: ssh user#yourmachine -L 15831:192.1X.X0.X80:1583
Then, using the tool can generate the connection DBeaver to see and do what you need.
That works for me.
Good luck.

Can we connect to SQL Server 2005 database from code with out having the installation of client and server

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.

Accessing Access over JDBC (using ODBC?)

I'm looking for a way to open an Access MDB file inside a Java App (using JDBC).
A quick Google Search suggests that I need the JDBC-ODBC Bridge for this...
Does this mean that I need to configure every system I want to run my app on to provide a ODBC DSN for the MDB I want to open?
And one more question (since I've never used ODBC before): will the communication happen over some sort of a socket (in a client/server-style), or through method/function calls (like with an embeded Derby db)?
1) You won't need to configure every system with a SYSTEM or USER ODBC DSN to access the MDB you want. You can still provide all the information you need in your JDBC URL:
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/yourdb.mdb
But keep in mind that the system will need to have the driver you are using installed.
2) The communication will happen the way your ODBC driver communicates. If it opens a socket to the server (the way an Oracle ODBC connection takes place) it will open a socket. If it uses library function calls, it will communicate through library function calls.
JDBC to ODBC communication uses JNI to communicate.

Connection to Oracle without a username or password

Oracle has this concept of allowing database users to be identified by the operating system user who is running the program that is connecting to Oracle. See here.
This allows you to do, as that user on a unix machine for example, a command such as:
sqlplus /
I am attempting to write a Java program for Oracle 10.2 which connects without a username or password. The obvious choice of url:
jdbc:oracle:thin:/#localhost:1521:MYDBSID
doesn't work, giving an error (Sorry I don't have the error available right now).
I have attempted many other forms of doing this as well, but with no luck.
Does anyone have any suggestions on how I can connect a Java program to Oracle using the OS identification method?
The JDBC Thin driver is a 100% pure Java implementation that cannot collect the needed information from the operating system.
The JDBC OCI driver can do this! Use jdbc:oracle:oci8:/#MYDBSID, it will require that the Oracle driver be installed on that machine, not a problem if this is a server (and is faster to boot and supports many more features than the thin driver)
The jdbc driver that oracle ships does NOT have the capability of gathering the OS username and password from the URL that you provide it. Suppose, there are 3rd party JDBC driver providers for ORACLE, one of them might provide the functionality that you're asking for. you should google around.
Thanks to those that answered. We've gone with the OCI driver.
I did find documentation to suggest that Oracle 11g does support OS user authentication via the thin driver though:
http://www.orindasoft.com/public/Oracle_JDBC_JavaDoc/javadoc1110/oracle/jdbc/OracleConnection.html#CONNECTION_PROPERTY_THIN_VSESSION_OSUSER
I don't have an 11g setup to test this on, so I can't be certain this works.
OS authentication support in the JDBC thin driver was added in 11g (you can download the JDBC thin driver from 11.2.0.4 on OTN).
Note that you have to allow remote OS authentication on the server (over TCP) otherwise it will only work with sqlplus using IPC or BEQ locally. In your init.ora file, add this:
REMOTE_OS_AUTHENT = TRUE
Then if you user is "osuserdemo" on the client machine, create a database user like this and restart the DB:
CREATE USER OSUSERDEMO IDENTIFIED EXTERNALLY;
GRANT CONNECT,CREATE SESSION,RESOURCE TO OSUSERDEMO;
And the JDBC thin driver should be able to connect without any username or password.
It's worth noting that this feature - considered as highly unsecured - has been de-supported in 12c.
If you're accessing Oracle from a J2EE appserver, you could achieve a similar end by using JNDI to acquire a datasource.
The 11g thin driver can connect using Kerberos authentication.
See Connect to an Oracle database using Kerberos
try following
jdbc:oracle:thin:username/password#localhost:1521:MYDBSID
you need to specify the account information
sqlplus / as sysdba on a unix machine which go through the operation system autentication
jdbc:oracle:oci:# works with ojdbc6.jar and Oracle 11g2

Categories