问题
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.
Output of the command
echo $INFORMIXSERVER
.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_key
should 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