notifyix jdbc卡住了 [英] informix jdbc stuck connecting

查看:393
本文介绍了notifyix jdbc卡住了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用标准方式使用jdbc连接到Informix数据库服务器:

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+"");

但是它一直尝试连接并且不会抛出错误消息(我想它尝试连接是因为它什么都不显示).我正在使用IBM Informix驱动程序4.10.00.1534和Java 1.7. 到目前为止,我一直在使用这种方法连接到Informix服务器,实际上,只有一台服务器失败.我可以使用odbc通过Informix客户端连接到该服务器,但是它在使用jdbc时一直失败,并且没有错误消息.

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.

是否有任何详细的jdbc连接方法?关于它为什么失败的任何建议?

Is there any method to verbose the jdbc connection? Any suggestion about why it fails?

更新:sqlidebug跟踪:

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

jdbctrace.log说:

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)

推荐答案

尝试运行连接Informix数据库的代码,但还显示完整的异常信息并创建跟踪文件.一个跟踪文件用于JDBC,一个跟踪文件用于Informix.将URL更改为数据库,用户名和密码,然后运行它.您可能会在屏幕上或跟踪文件中看到问题:

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跟踪文件将带有一些后缀(时间戳或类似信息),在我的情况下,它类似于sqlidebug.trace1391758523500.0.它是二进制文件,但您可以使用sqliprt实用程序对其进行分析.

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

JDBCTrace.log中,我可以找到更多有趣的信息(我也在屏幕上看到了该信息):

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)

这篇关于notifyix jdbc卡住了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆