INFORMIX error on running a Java program [closed]

允我心安 提交于 2019-12-25 18:17:13

问题


I have been trying to connect to an Informix database using a small program written in Java.

The program is working nicely on one of the Informix test servers but on running in one of the production system it gives us the following exception:

java.sql.SQLException: INFORMIXSERVER does not match either DBSERVERNAME or DBSERVERALIASES.

I did some research and have checked the following two values for discrepancies.

  1. Output of the command echo $INFORMIXSERVER.

  2. Value of the DBSERVERNAME in the onconfig file on the server, present in the $INFORMIXDIR/etc directory.

The value of these two are the same and I can't see any problem in these two values.

Can you guys please suggest me some solution to this or any place where I can look for solution?

Thanks.


回答1:


Your connection string should look something like:

jdbc:informix-sqli://HOSTNAME:PORT:informixserver=DBSERVERNAME;user=USERNAME;password=PASSWORD;

If, for example, your informix sql hosts file looks like:

infx1150        onsoctcp        tardis 15115   k=1

Then, your connection string for the user informix with the password the_keyshould be like:

jdbc:informix-sqli://tardis:15115:informixserver=infx1150;user=informix;password=the_key;

The error you're getting says that the informixserver value on your connection string doesn't match a DBSERVENAME on the given host.

That means you are reaching the host and the port on the connection string, but not the DBSERVERNAME.



来源:https://stackoverflow.com/questions/37383871/informix-error-on-running-a-java-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!