Connecting Java and Teradata via java error - java

I am using 2 jars :
1. tdgssconfig
2. terajdbc4
Class.forName("com.teradata.jdbc.TeraDriver");
connString = "jdbc:teradata://" + host + "/database=" + db + ",tmode=DEFAULT,charset=UTF8,LOGMECH=TD2";
//DriverManager.registerDriver (new com.teradata.jdbc.TeraDriver());
DriverManager.setLoginTimeout(120);
this.conn = DriverManager.getConnection(connString, user,password);
On my computer which as also installed Teradata SQLAssistant the process is working and connecting teradata
but on the server which don't have the software ,the process is failed to connect tera data. I get the following error :
TERAJDBC4 ERROR [main] com.teradata.jdbc.jdk6.JDK6_SQL_Connection

Related

java.lang.ClassCastException: com.ibm.mq.connector.outbound.MQQueueProxy incompatible with com.ibm.mq.jms.MQQueue

Getting below exception at runtime during queue connection -
java.lang.ClassCastException: com.ibm.mq.connector.outbound.MQQueueProxy incompatible with com.ibm.mq.jms.MQQueue
Below is the piece of code for reference. I am trying to run application on Websphere Liberty -
connection = queueConnFactory.createConnection();
logger.debug("got connection = " + (connection != null));
session = connection.createSession(Boolean.FALSE, Session.AUTO_ACKNOWLEDGE);
logger.debug("got Session = " + (session != null));
((MQQueue)requestQueue).setTargetClient(com.ibm.mq.jms.JMSC.MQJMS_CLIENT_NONJMS_MQ);
producer = session.createProducer(requestQueue);
Message documentRequestMessage = session.createTextMessage(messageData);
Getting exception during setTargetClient. I also tried setting target client as MQJMS_CLIENT_JMS_COMPLIANT, but still getting same error.
Following jars are in my dependencies -
com.ibm.mqjms-1.0
com.ibm.mq-1.0
com.ibm.dhbcore-61
In Websphere Liberty profile -
<feature>wmqJmsClient-2.0</feature> is installed.
<variable name="wmqJmsClient.rar.location" value="${shared.resource.dir}/wmq/jmsra.rar"/> - this is also available on the server
This same application is running on Tomcat without any error.

Openfire connection closed with internal error

So i have this code to connect to openfire
XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();
config.setUsernameAndPassword(loginUser, passwordUser);
config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
config.setServiceName(serverAddress);
config.setHost(serverAddress);
config.setPort(5222);
config.setDebuggerEnabled(true);
connection = new XMPPTCPConnection(config.build());
ReconnectionManager.getInstanceFor(connection).enableAutomaticReconnection();
System.out.println("Reconnection enabled : " + ReconnectionManager.getInstanceFor(connection).isAutomaticReconnectEnabled());
ConnectionListener connectionListener = new XMPPConnectionListener();
connection.addConnectionListener(connectionListener);
but when i try to connect i get this error :
org.jivesoftware.smack.XMPPException$StreamErrorException: internal-server-error You can read more about the meaning of this stream error at http://xmpp.org/rfcs/rfc6120.html#streams-error-conditions
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1007)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$300(XMPPTCPConnection.java:948)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:963)
at java.lang.Thread.run(Thread.java:744)
EDIT : Openfire's log :
Warn log :
2016.06.13 11:06:31 org.apache.mina.core.filterchain.DefaultIoFilterChain - Unexpected exception from exceptionCaught handler.
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
at org.jivesoftware.openfire.roster.Roster.broadcastPresence(Roster.java:628)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.broadcastUpdate(PresenceUpdateHandler.java:309)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:163)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:138)
at org.jivesoftware.openfire.handler.PresenceUpdateHandler.process(PresenceUpdateHandler.java:202)
at org.jivesoftware.openfire.PresenceRouter.handle(PresenceRouter.java:144)
at org.jivesoftware.openfire.PresenceRouter.route(PresenceRouter.java:80)
at org.jivesoftware.openfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:88)
at org.jivesoftware.openfire.SessionManager$ClientSessionListener.onConnectionClose(SessionManager.java:1267)
at org.jivesoftware.openfire.nio.NIOConnection.notifyCloseListeners(NIOConnection.java:266)
at org.jivesoftware.openfire.nio.NIOConnection.close(NIOConnection.java:248)
at org.jivesoftware.openfire.nio.ConnectionHandler.exceptionCaught(ConnectionHandler.java:162)
i tried to connect to a local openfire server(windows), i succeded, but I fail when i try to connect to an ubuntu openfre server.
Any help would be appreciated.
Newer versions of Openfire need Java 8 (or higher).
To be precise : openfire needs oracle jre 8 NOT Openjdk

Why can java.util.zip.ZipException happen during Websphere deployment by jython script and wsadmin

I am trying to install myApp in Websphere 8.5 running over zOS/390. I can't imagine a more simple jython than below and it is returning "java.util.zip.ZipException: error in opening zip file". I am sure that the ear file is correct. Any idea about possible reason for ZipException will be appreciatted. Naturally, the server is up and running.
The Jython script:
000001,import sys
000002,EARFILE = "/usr/MyCompanyApps/MyArea/originEAR/MyAppEAR.ear"
000003,APPOPTS = "-appname "
000004,APPOPTS = APPOPTS + "dMYAPP "
000005,APPOPTS = APPOPTS + "-installed.ear.destination "
000006,APPOPTS = APPOPTS + "/WebSphereDevelopment/MYAPP/dtl/currr/deployment/ "
000007,APPOPTS = APPOPTS + "-MapModulesToServers [ "
000008,APPOPTS = APPOPTS + "MyApp MyApp.war,WEB-INF/web.xml WebSphere:"
000009,APPOPTS = APPOPTS + "cell=dtl85cel,node=wlemyAppa,server=WLEMYAPP] "
000010,AdminApp.install(EARFILE, APPOPTS)
The detailed trace log:
000064,java.lang.RuntimeException: java.lang.RuntimeException: Deploying /WebSp
000065," follows:
000066,
000067, com.ibm.websphere.management.application.client.AppDeploymentException:
000068,,at com.ibm.websphere.management.application.AppManagementFactory.handle
000069,,at com.ibm.websphere.management.application.AppManagementFactory.readAr
000070,,at com.ibm.websphere.management.application.AppManagementFactory.readAr
000071,,at com.ibm.ws.scripting.AdminAppClient.getController(AdminAppClient.jav
000072,,at com.ibm.ws.scripting.AdminAppClient.commonPrepare(AdminAppClient.jav
000073,,at com.ibm.ws.scripting.AdminAppClient.doInstall(AdminAppClient.java:22
000074,,at com.ibm.ws.scripting.AdminAppClient.doInstall(AdminAppClient.java:20
000075,,at com.ibm.ws.scripting.AdminAppClient.install(AdminAppClient.java:1414
000076,,at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
000077,,at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
000078,,at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
000079,,at java.lang.reflect.Method.invoke(Method.java:620)
…
000125,Caused by: java.lang.RuntimeException: Deploying /WebSphere/was85/dtl85c
000126,,at com.ibm.ws.sip.application.frameworkext.SarToEarConverterTask.isConv
000127,,at com.ibm.ws.sip.application.frameworkext.SarToEarConverterTask.execut
000128,,at com.ibm.ws.management.application.client.AppInstallHelper.processEar
000129,,at com.ibm.ws.management.application.client.AppInstallHelper.processEar
000130,,at com.ibm.ws.management.application.client.AppInstallHelper.getAppDepl
000131,,at com.ibm.websphere.management.application.AppManagementFactory.readAr
000132,,... 55 more
000133,Caused by: java.util.zip.ZipException: error in opening zip file
000134,,at java.util.zip.ZipFile.open(Native Method)
000135,,at java.util.zip.ZipFile.<init>(ZipFile.java:231)
000136,,at java.util.zip.ZipFile.<init>(ZipFile.java:161)
000137,,at java.util.zip.ZipFile.<init>(ZipFile.java:132)
000138,,at com.ibm.ws.sip.application.frameworkext.SarToEarConverterTask.isCon
000139,,... 60 more
000140,
000141,Ý11/9/15 11:14:24:931 CST¨ 00000001 AbstractShell E WASX7120E: Diagno
000142,java.lang.RuntimeException: java.lang.RuntimeException: Deploying /WebS
000143," follows:
000144,
000145, com.ibm.websphere.management.application.client.AppDeploymentException
I tried via Admin Console Wizzard and I got this message:
The following exception occurred. Check log for details.
com.ibm.websphere.management.application.client.AppDeploymentException: [Root exception is java.lang.RuntimeException: Deploying /WebSphere/was85/dtl85cel/ledm85nd/DeploymentManager/profiles/default/wstemp/867530631/upload/MyAppEAR.ear failed.]
Firstly, thank you to all that try to help me here. I want to let here what has fixed my issue for future searchers: I am transfering the ear file from my windows machine to mainframe via Open Text FTP feature and, in my configurations, it was set up to Auto-Select. There are two file formats allowed: Binary and ASCII. Probably, autoselect was setting to ASCII. The correct is Binary.
Few years back I remember we had this issue.
But at that time our /tmp filesystem was 98%, we cleared it and ran the job again it was successful.
Also other point is on permission,you can clear the wstemp & re-run.
Oh ok.
Can you delete the contents of the wstemp and try to redeploy.
Wstemp folder contains Websphere temp workspace files.
Also to advise - can you try to deploy the EAR file manually via Admin console ?

Java Apache Phoenix 4.1.0/4.2.2. Not able to create connection

I am not able to connect to HBase through Apache phoenix driver.
Env info:
hadoop-2.6.0.
hbase-0.98.9-hadoop2.
phoenix-4.1.0-server-hadoop2(Kept on all region servers).
phoenix-4.1.0-client-hadoop2(Using this jar to create a jdbc connection).
Java Client side , I am getting exception
Caused by: org.apache.phoenix.exception.PhoenixIOException: org.apache.hadoop.hbase.DoNotRetryIOException: java.io.IOException: Class org.apache.phoenix.coprocessor.MetaDataRegionObserver cannot be loaded
at ...
Caused by: java.io.IOException: Class org.apache.phoenix.coprocessor.MetaDataRegionObserver cannot be loaded
at org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost.testTableCoprocessorAttrs...
At HBase Master node logs I am getting this error:
2015-02-02 12:48:11,550 DEBUG [FifoRpcScheduler.handler1-thread-14] util.FSTableDescriptors: Exception during readTableDecriptor. Current table name = SYSTEM.CATALOG
org.apache.hadoop.hbase.TableInfoMissingException: No table descriptor file under hdfs://HadoopNode:9000/home/hduser/Data/hbase/data/default/SYSTEM.CATALOG
Code which I am using to create phoenix connection:
String zkQuorum = "HbaseMasterNode:2222";
try
{
Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
String connectionURL = "jdbc:phoenix:" + zkQuorum;
Connection connection = DriverManager.getConnection(connectionURL);
System.out.println(connection);
}
catch (Exception e)
{
throw new IllegalArgumentException("Create phoenix connection(" + zkQuorum + ") throw exception", e);
}
With the help of Basic Hbase java APIs I am able to connect but this issue I am facing only If I try to use Phoenix driver for HBase.

informix jdbc stuck connecting

I'm trying to connect to a Informix database server with jdbc using the standard way :
connection = DriverManager.getConnection("jdbc:informix-sqli://"+ip+
/"+sid+":INFORMIXSERVER="+server+";user="+user+";password="+pass+"");
But it keeps trying to connect and does not throw a error message (I suppose it tries to connect because it does not show anything). I'm using IBM Informix driver 4.10.00.1534 and Java 1.7.
I have been using this method to connect to Informix servers until now, in fact it only fails with one server. I can connect to this server through Informix clients with odbc but it keeps failing with jdbc with no error message.
Is there any method to verbose the jdbc connection? Any suggestion about why it fails?
UPDATE: The sqlidebug trace:
C->S (4)
SQ_VERSION
SQ_EOT
S->C (14)
SQ_VERSION
"7.31.TD6" [8]
SQ_EOT
C->S (66)
SQ_INFO
INFO_ENV
Name Length = 12
Value Length = 8
"DBTIME"="%d/%M/%Y"
"DBTEMP"="/tmp"
"SUBQCACHESZ"="10"
INFO_DONE
SQ_EOT
S->C (2)
SQ_EOT
C->S (16)
SQ_DBOPEN
"database" [8]
NOT EXCLUSIVE
SQ_EOT
S->C (28)
SQ_DONE
Warning..: 0x15
# rows...: 0
rowid....: 0
serial id: 0
SQ_COST
estimated #rows: 1
estimated I/O..: 1
SQ_EOT
C->S (78)
SQ_PREPARE
# values: 0
CMD.....: "select site from informix.systables where tabname = ' GL_COLLATE'" [65]
SQ_NDESCRIBE
SQ_WANTDONE
SQ_EOT
And the jdbctrace.log says:
trying com.informix.jdbc.IfxDriver
SQLWarning: reason(Database selected) SQLState(01I04)
SQLWarning: reason(Float to decimal conversion has been used) SQLState(01I05)
SQLWarning: reason(Database has transactions) SQLState(01I01)
SQLWarning: reason(Database selected) SQLState(01I04)
SQLWarning: reason(Database has transactions) SQLState(01I01)
SQLWarning: reason(Database selected) SQLState(01I04)
Try to run code that connects do Informix database but also shows full exception info and create trace files. One trace file is for JDBC, one is for Informix. Change URL to database, username and password, and run it. You will probably see the problem on screen or in trace file:
import java.io.FileWriter;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
class informix_trace
{
public static void main(String[] args)
{
try
{
Class.forName("com.informix.jdbc.IfxDriver");
FileWriter fwTrace = new FileWriter("c:\\JDBCTrace.log");
PrintWriter pwTrace = new PrintWriter(fwTrace);
DriverManager.setLogWriter(pwTrace);
String debug_url = "SQLIDEBUG=C:\\sqlidebug.trace";
String url = "jdbc:informix-sqli://1.2.3.4:9088/test_db:informixserver=ol_testifx;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250;" + debug_url
Connection connection = DriverManager.getConnection(url, "user", "passwd");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT FIRST 1 DBINFO('version','full') FROM systables;");
while (resultSet.next())
System.out.println(resultSet.getObject(1));
}
catch (Exception e)
{
e.printStackTrace();
}
}
} // class informix_trace
Informix trace file will be with some postfix (timestamp or similar info) and in my case it was something like sqlidebug.trace1391758523500.0. It is binary but you can analyze it using sqliprt utility.
Example of my session with wrong database name:
c:\>sqliprt sqlidebug.trace1391758523500.0
SQLIDBG Version 1
...
S->C (12)
SQ_ERR
SQL error..........: -329
ISAM/RSAM error....: -111
Offset in statement: 0
Error message......: "" [0]
SQ_EOT
In JDBCTrace.log I can found more interesting info (I see it also on my screen):
SQLState(IX000) vendor code(-111)
java.sql.SQLException: ISAM error: no record found.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3412)
at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2324)
....
at java.sql.DriverManager.getConnection(Unknown Source)
at informix_trace.main(informix_trace.java:20)
getConnection failed: java.sql.SQLException: No database found or wrong system privileges.
(I have translated it from Polish so it can be little different)
My suggestion is to:
build ConnectString and show us its full content, this way we will see if in ip there is only IP address or if it is with port number
instead of adding username and password to ConnectString use 3 parameter version of getConnection() just like:
getConnection("jdbc:informix-sqli://169.0.5.10:9088/test_db:informixserver=ol_test;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250", username, password)
(of course set your own locale instead of my Polish locale)
To spy network traffic use tools like Wireshark. Start capturing ip traffic to your Informix database. In my case Wireshark rule is:
ip.addr == 169.0.5.10
If I set up wrong IP Wireshark will display "Destination unreachable".
You can also see someting using netstat:
c:\>netstat -an | grep 9088
TCP 169.0.1.126:4295 169.0.5.10:9088 TIME_WAIT
It was when my application stopped working.
In case of error (wrong IP port) I see:
c:\>netstat -an | grep 9089
TCP 169.0.1.126:4398 169.0.5.10:9089 SYN_SENT
IBM says that: From version 3.00.JC1 of IBM® Informix® JDBC Driver onwards, debug drivers are no longer shipped.
Informix JDBC Driver now supports SQLIDEBUG. You no longer need to set values for TRACE, TRACEFILE or PROTOCOLTRACE, PROTOCOLTRACEFILE. You only need to set SQLIDEBUG. and the page goes on to outline the steps you need to create a trace. Copying:
Set the CLASSPATH to the Informix JDBC Driver package.
c:\Infx\Java>set
CLASSPATH=C:\infx\JDBC3.00JC3\lib\ifxjdbc.jar;C:\infx\JDBC3.00JC3\lib\ifxjdbcx.jar;.
Compile simple.java
c:\Infx\Java>javac simple.java
Ensure that SQLIDEBUG is set correctly
c:\Infx\Java>grep SQLIDEBUG simple.java
conn=DriverManager.getConnection("jdbc:informix-sqli://irk:1526/sysmaster:INFORMIXSERVER=irk940;USER=informix;
PASSWORD=ximrofni;SQLIDEBUG=C:\infx\java\trace");
Note: SQLIDEBUG is set in the connection string. It points to where
the trace file will be found with a certain format i.e.
trace.xxxxxxx
Remove or move all other trace files
c:\Infx\Java>del trace*
Run java.simple
c:\Infx\Java>java simple systables syscolumns ... ...
oledbordinals
Then locate the trace file
c:\Infx\Java>dir trace* Volume in drive C has no label. Volume
Serial Number is B823-46D8
Directory of c:\Infx\Java
04/04/2006 14:12 20,560 trace1144156355642.0 1 File(s) 20,560 bytes
0 Dir(s) 4,067,995,648 bytes free
c:\Infx\Java>
You will be able to see that a trace file has been created however
you will not be able to read the file.
Send the trace file to your local technical support office for
analysis.
Of course, if you're not using Version 3.00.JC1 of the Informix drivers, ignore the above and follow a different set of instructions; again duplicated for your convenience:
To turn on tracing, specify the environment variables TRACE,
TRACEFILE, PROTOCOLTRACE, and PROTOCOLTRACEFILE in the database URL or
the property list when you establish a connection to an Informix
database or database server. TRACE can be set to one of the following
levels:
Tracing not enabled. This is the default value.
Traces the entry and exit points of methods.
Same as Level 1, plus generic error messages are also traced.
Same as Level 2, plus data variables are also traced. TRACEFILE Specifies the full pathname of the operating system file on the client
computer to which the TRACE messages are written.
PROTOCOLTRACE traces the SQLI protocol messages sent between your Java
program and the Informix database server.
Can be set to the following levels:
Protocol tracing not enabled. This is the default value.
Traces message IDs.
Same as Level 1, plus the data in the message packets are also traced. PROTOCOLTRACFILE specifies the full pathname of the operating
system file on the client computer to which the PROTOCOLTRACE messages
are written.
Hope that helps
try different jdbc version
check NETTYPE configuration parameter and compare it with current number of informix sessions
dump java thread states (kill -3 ) when jdbc connection hangs
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import com.informix.*;
public class DBConnect {
static String url="jdbc:informix-sqli://host_name:port/database_name:INFORMIXSERVER=server;user=username;password=password";
public static void main(String [] args){
try {
Class.forName("com.informix.jdbc.IfxDriver");
}catch (Exception e){
System.out.println("ERROR: failed to load Informix JDBC driver.");
e.printStackTrace();
return;
}
try{
DriverManager.registerDriver((com.informix.jdbc.IfxDriver)Class.forName("com.informix.jdbc.IfxDriver").newInstance());
}catch(Exception ex){
System.out.println("Driver is not Registered");
}
try{
Connection conn = DriverManager.getConnection(url);
System.out.println("Connection Successful");
}catch (SQLException e){
System.out.println("ERROR: failed to connect!");
System.out.println("ERROR: " + e.getMessage());
e.printStackTrace();
return;
}
}
}
For more info go through [this book] (http://www.cursor-distribution.de/aktuell.11.70.xC6/documentation/ids_jdbc_bookmap.pdf)
The problem I encountered was that Informix was listening on local IPv6 address on port 7360, command netstat -a was displaying this format :
TCP [feab::11ab:78ab:efab:8aab%17]:7360 myhostname:0 LISTENING
Therefore my jdbc connection was always failing until I figured out I should have use the IPv6 address in the URL :
jdbc:informix-sqli://fe80::1125:78c0:ef17:8ab5%17:7360:user=informix;password=test;INFORMIXSERVER=ol_informix1210_2
You can test that the connection is working with this simple script :
/***************************************************************************
*
* Title: SimpleConnection.java
*
* Description: Demo a connection to a server (no database specified)
*
* An example of running the program:
*
* java SimpleConnection
* 'jdbc:informix-sqli://myhost:1533:user=<username>;password=<password>'
*
* Expected result:
*
* >>>Simple Connection test.
* URL = "jdbc:informix-sqli://myhost:1533:user=<username>;password=<password>"
* >>>End of Simple Connection test.
*
***************************************************************************
*/
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SimpleConnection {
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("FAILED: connection URL must be provided in order to run the demo!");
return;
}
String url = args[0];
String testName = "Simple Connection";
Connection conn = null;
System.out.println(">>>" + testName + " test.");
System.out.println("URL = \"" + url + "\"");
try {
Class.forName("com.informix.jdbc.IfxDriver");
} catch (Exception e) {
System.out.println("FAILED: failed to load Informix JDBC driver.");
}
try {
PrintWriter out = new PrintWriter(System.out, true);
DriverManager.setLogWriter(out);
conn = DriverManager.getConnection(url);
} catch (SQLException e) {
System.out.println("FAILED: failed to connect!");
}
try {
conn.close();
} catch (SQLException e) {
System.out.println("FAILED: failed to close the connection!");
}
System.out.println(">>>End of " + testName + " test.");
}
}

Categories

Resources