Connect to SQL 2008 from Java 1.4 - java

I have Java code that, for the time being, has to be run in Java 1.4 and is using the SQL Server 2000 Driver for JDBC. One of the MS SQL Servers we work with is being upgraded from SQL Server 2000 to SQL Server 2008. The SQL 2000 JDBC driver does not work with 2008, as I've found out in practice and from reading online.
All (?) newer versions of JDBC that support SQL 2008 (2, 3 & 4) require Java 5 or Java 6.
How can I connect to MS SQL Server 2008 from Java 1.4?
Edit It looks like SQL Server 2005 JDBC Driver 1.2 will allow me to connect to SQL 2008 from Java 1.4, but that the download isn't available anymore??

You could use a third party driver like jdts: http://jtds.sourceforge.net. The 1.2.x versions run on versions 1.3 to 6. Here's a good link which describes how to use it: Help me create a jTDS connection string.

Related

How to connect to Oracle9i with SQLDeveloper 21?

I want to connect to an old Oracle9i Release 9.2.0.4.0 database with SQLDeveloper 21.4.3 and I followed this answer How to change default JDBC driver of Oracle SQL Developer?.
The difference is just the versions of SQLDeveloper (21 instead of 20) and Oracle Instant Client (21.3 instead of 11.2.0.4.0). In my case both are the latest ones.
My OS is also Windows 10, 64bit.
Testing the client and connection as described are successful. But when actually connecting to the database SQLDeveloper hangs and can only be closed by TaskManager.
I tried both connection types: simple and with user defined URL jdbc:oracle:thin:#172.31.10.3:1521:LZH. This URL works in other applications like SQL Workbench/J using oracle driver ojdbc14_g.jar.
I also tried to set this jar file in SQLDeveloper preferences as external jdbc driver. But I guess here only non oracle drivers like postgreSQL make sense, but don't know. It doesn't make a difference anyway.
Thanks for any suggestion!
You cannot connect an Oracle Client version 21 to an (more than 20 years old) Oracle 9i database. See Client / Server Interoperability Support Matrix for Different Oracle Versions
Maybe ask Oracle support to get an older version of SQL Developer.
Oracle provided me a link for older
Instant Client Versions.
Version 11.2 works fine with SQLDeveloper 20.2.
SQLDeveloper 21 only supports client versions 19 and higher.

jdbc DB2 queryTimeout not working as expected

We are facing issue with the the query timeout property on Db2, it is working when we are running the app in WebSphere, then we moved to Tomcat, this issue was recently caught up by a very long query that hangs very long until timeout after 45 minutes, some pieces of the code we have as below, they haven't been changed since moving to Tomcat:
CallableStatement cs = statementFactory.createCallableStatement(getConnection(), source.getSQL(),
statementConfig);
cs.setQueryTimeout(10);
boolean resultSetAvailable = cs.execute();
if (resultSetAvailable) {
resultSet = cs.getResultSet();
} else {
resultSet = CallableStatementParamsUtils.checkForOutResultSet(cs, storedProc);
}
I set up the timeout to be 10 secs, but it didn't timeout at all, anybody knows why?
The difficulty is Db2 driver is not open source, not able to debug it, How can I solve this issue using Db2?
In this case, the use of a jdbc type 4 driver appeared to help to resolve the issue.
Note that the IBM db2 jdbc driver supports tracing for problem determination as described here.
When dealing with jdbc issues with Db2, it is always helpful to ensure you are using the most recent jdbc driver, available via this page.
From the comments, the previous jdbc driver was a type-2 driver (which supports query timeouts only in specific configurations as IBM documents in the Db2 knowledge center, the notes are copied below).
The various IBM notes on this page concerning queryTimeout support in jdbc are essential reading , viz:
For DB2 for i, this method (setQueryTimeout) is supported only for a seconds value of 0.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 for z/OS, Statement.setQueryTimeout is supported only if
Connection or DataSource property queryTimeoutInterruptProcessingMode
is set to INTERRUPT_PROCESSING_MODE_CLOSE_SOCKET.
For IBM Data Server Driver for JDBC and SQLJ type 2 connectivity on Db2 on Linux, UNIX, and Windows systems, Statement.setQueryTimeout is
supported only if Connection or DataSource property
queryTimeoutInterruptProcessingMode is set to
INTERRUPT_PROCESSING_MODE_STATEMENT_CANCEL.
For the IBM Data Server Driver for JDBC and SQLJ Version 4.0 and later, Statement.setQueryTimeout is supported for the following
methods:
Statement.execute
Statement.executeUpdate
Statement.executeQuery
Statement.setQueryTimeout is supported for the Statement.executeBatch
method only when property queryTimeoutInterruptProcessingMode is set
to INTERRUPT_PROCESSING_MODE_CLOSE_SOCKET (2).

Can Microsoft JDBC Driver 4.1 be used with Microsoft ODBC Driver 1.0?

I need to upgrade sqljdbc4.jar to sqljdbc41.jar.
Microsoft website has the following information:
sqljdbc41.jar class library provides support for JDBC 4.0 API. It includes all of the features of the JDBC 4.0 driver as well as the JDBC 4.0 API methods. JDBC 4.1 is not supported (will throw an exception “SQLFeatureNotSupportedException”).
Thus, the already running JDBC APIs in java will work properly.
But, the Microsoft ODBC Driver 1.0 must be compatible with Microsoft JDBC Driver 4.1
Can Microsoft ODBC Driver 1.0 be used with Microsoft JDBC Driver 4.1 ?
Also, if java applications will use JDBC only to connect to the Microsoft SQL Server and any other language application needs to use ODBC to connect to the database then when is JDBC-ODBC bridge used?
System specifications:
Linux: 64bit Red Hat Enterprise Linux Server release 6.4
ODBC on linux: unixODBC 2.3.0 Driver Manager
Application: Only Java Application
when is JDBC-ODBC bridge used?
The short answer is "Not very much any more" because the JDBC-ODBC Bridge was removed from Java 8.
The JDBC-ODBC Bridge was intended to be a transitional way for Java applications to work with databases that had an ODBC driver but did not (yet) have a JDBC driver. The JDBC-ODBC Bridge was never really intended for production use and, in fact, was never officially supported.

Weird Behaviour of Oracle 11g to 12C

My application runs select sql queries using JDBC driver on Oracle and stores the data in Result set. Then by using buffer writer/file writer writes information to xml.
** Weird Behaviour : Same code when runs with Oracle 11g takes 2 hrs to complete and for 12 C it takes # 12 hrs.
** JDBC driver I am using is compatible with 11g and 12c. Data is same on both the DBs. Both DB are independent instance, so no question of migration problems.
Can somebody please help, what how can I debug for this ?
** select queries uses bind parameter IN clause and has 1000 values in it.
IT seems, there is a bug with Oracle 12C. Working with Oracle support.

Tibco Connection error while connection Oracle 10g Express Edition

I am trying to connect to Oracle Database 10g Express Edition. While connecting am getting the error as
BW-JDBC-100033 "Configuration Test Failed. Failed to find or load the JDBC driver: tibcosoftwareinc.jdbc.oracle.OracleDriver"
Can anyone please help me on this issue?
Which version of TRA are you using? Be aware that from TRA 5.7.0 onwards, the DataDirect drivers (such as tibcosoftwareinc.jdbc.oracle.OracleDriver) are no longer shipped with the product. If that is your case, you have 2 options:
Download the TIBCO Database Drivers Supplement, which includes the DataDirect drivers.
Download the Oracle JDBC driver, drop the appropriate ojdbc jar in the <TIBCO_HOME>/tpcl/5.x/jdbc folder (create the folder if it doesn't exist) and use the oracle.jdbc.driver.OracleDriver reference in your BW project.

Categories

Resources