Im trying to connect to an IBM DB2 in AS400 using jdbc and ibm DB2 jcc driver.
credentials are valid. the problem is, when i try to connect to the client db2, it tells me that my db2 connect licence is invalid. even though i tied to connect with the same driver to another IBM DB2 in a free ibm cloud service, and it works without the licence.
is there another way to connect to IBM DB2 without DB2 connect ? or there is no other way than buying the licence ?
The error :
My application.properties
With IBM supplied drivers, access to i-series (AS/400) is non free.
You can use the jt400 driver if you want "free" access.
Otherwise you must either provide a Db2-connect licence on the workstation running the jdbc connection and thus connect directly to AS/400 (i-series), or if your company has already deployed a Db2-connect gateway then you can connect indirectly via that gateway and in this case no workstation-side license is required (because the costs are included in the separate Db2-connect gateway license).
Related
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.
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.
I'm writing a Java program that retrieves data from an MS Access database. My code is as follows:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + databaseLocation + databaseName +";selectMethod=cursor; READONLY=true; TYPE=FASTLOAD";
con = DriverManager.getConnection(url);
I am using a basic JDBC:ODBC bridge. It seems a Type 4 driver would be better. However I'm writing the program to be used on a different PC and I would rather they do not have to install any drivers for it to work. I don't remember installing anything on my PC.
Can anyone tell me will this work with any copy of Windows? That is are the JDBC drivers I'm using installed with Windows or Java or Access by default?
No, there are no type IV JDBC drivers installed on Windows.
I'm not aware of a free type IV JDBC driver for Access.
The JDBC-ODBC bridge is available for 32-bit JVMs, but not for 64-bit. (A DLL is required that isn't part of the 64-bit JDK.)
duffymo is correct as far as I know when he / she says "there are no type IV JDBC drivers installed on Windows"
hxtt.com/access.html is not a JDBC type 4 driver it uses Samba and not a Native Protocol which is what is required for a JDBC type 4 driver.
What you need is a JDBC type 3 driver which uses its own Network protocol to communicate between the client which in your case would be the remote PC and a server component. Commercially available is the Easysoft JDBC-ODBC Bridge offers such a solution. You install the software on the machine containing the MS Access database or a machine that can use a UNC path to the access database and then you distribute the EJOB.jar file to the machines that require access to that database along with your Java application. You can use Easysoft from both 32-bit and 64-bit Java applcations.
Many powerful SQL syntax (for instance, select ... into outfile) at http://www.hxtt.com/access/sqlsyntax.html or SQL functions (for instance, GROUP_CONCAT) at http://www.hxtt.com/access/function.html are NOT supported by MS ACCESS engine at all. With HXTT Access' help, you can access local mdb/accdb file of UNIX/LINUX/MAC OS easily without any third-party component.
HXTT is AFAIK incorrect in their statement about there JDBC is type 4.
All drivers of HXTT drivers are type 4.
it uses SMB and not a Native Protocol
Wrong. It can run for embeded mode, client/server mode, in-memory mode, mapped driver, SMB protocol, http protocol, https protocol, and mobile OS.
If you choose to download and evaluate it, you will find the following information at http://www.hxtt.com/access.html ISN'T a lie:
HXTT Access contains the only type 4 JDBC(1.2, 2.0, 3.0, 4.0, 4.1) driver packages for Microsoft Access version from 95, 97, 2000, XP, 2002, 2003, 2007, to 2010, which supports transaction, embedded access, remote access, client/server mode, memory-only database, compressed database(.ZIP, .JAR, .GZ, .TAR, .BZ2, .TGZ, .TAR.GZ, .TAR.BZ2), SMB database(smb), url database(http, https, ftp), and java.io.InputStream database. Through the embedded Pure Java database engine, MS Access database can be deployed and acessed on any platform with JVM. With JDBC1.2, JDBC2.0, JDBC3.0, JDBC4.0, JDBC4.1, and SQL92 support, programmers needn't special coding, and DBA can use any Java database tool to access easily local data or remote data.
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.
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