JDBC Connection Problem
Posted in 2011
Topics: Connectivity: ODBC / JDBC / .NET, Server Administration, Security, Permissions & Auditing, Networking & sqlhosts Configuration, Java & JDBC Development
Hello,
I am having problems connecting via JDBC to my locally running
Informix 11.7 instance on my Mac, OS 10.6. I have this problem when
trying with a couple of a Java GUI query tools.
In /etc/services:
ol_informix117 20200/tcp
dr_informix117 21788/tcp
In sqlhosts:
demo_on onipcshm on_hostname on_servernamedemo_se seipcpip se_hostname sqlexec
ol_informix117 onsoctcp localhost ol_informix117
My attempted JDBC URLs:
jdbc:informix-sqli://localhost:20200/
mydb:INFORMIXSERVER=ol_informix117
jdbc:informix-sqli://127.0.0.1:20200/
mydb:INFORMIXSERVER=ol_informix117
jdbc:informix-sqli://192.68.123.22:20200/
mydb:INFORMIXSERVER=ol_informix117
I tried different users, including the informix user and password.
The error:
com.informix.asf.IfxASFException:
Attempt to connect to database server (ol_informix117) failed.
Unfortunately the driver does not provide any additional details, such
as bad host, bad servername, bad database, bad user/password, etc.
I can connect to mydb using dbaccess just fine, including "dbaccess
mydb@ol_informix117".
When I try and telnet to localhost, port 20200, I can connect
successfully. If I send garbage the connection is aborted and there is
an message in the Informix log file. There is no message in the log
file when I fail to connect via JDBC (not sure if that is normal).
Also, there is no firewall running.
Can anyone help?
hmmmm try:
jdbc:informix-sqli://<ip or host>:<portno>:informixserver=<value of
$INFORMIXSERVER>;database=<nameofdb>;
or
jdbc:informix-sqli://<ip or host>:<portno>:informixserver=<value of
$INFORMIXSERVER>;
user=<username>;
password=<password>;
database=<nameofdb>;
your env:
jdbc:informix-sqli://localhost:
20200:informixserver=ol_informix117;database=mydb;
no passwd user needed since it runs on the same machine otherwise:
jdbc:informix-sqli://localhost:
20200:informixserver=ol_informix117;user=<theuser>;password=<thepassword>;database=mydb;
hmmmmm > com.informix.asf.IfxASFException:
> Attempt to connect to database server (ol_informix117) failed.
>
these query tools should catch the exception and get the errorcode...
catch (SQLException e){
System.out.println( "error :"+e.getErrorCode()+
":message:"+e.getMessage() );
....
Superboer
On 11 mrt, 17:07, "markmadi...@mail.com" <markmadi...@mail.com> wrote:
> Hello,
>
> I am having problems connecting via JDBC to my locally running
> Informix 11.7 instance on my Mac, OS 10.6. I have this problem when
> trying with a couple of a Java GUI query tools.
>
> In /etc/services:
>
> ol_informix117 20200/tcp
> dr_informix117 21788/tcp
>
> In sqlhosts:
>
> demo_on onipcshm on_hostname on_servername> demo_se seipcpip se_hostname sqlexec
> ol_informix117 onsoctcp localhost ol_informix117>
> My attempted JDBC URLs:
>
> jdbc:informix-sqli://localhost:20200/
> mydb:INFORMIXSERVER=ol_informix117
> jdbc:informix-sqli://127.0.0.1:20200/
> mydb:INFORMIXSERVER=ol_informix117
> jdbc:informix-sqli://192.68.123.22:20200/
> mydb:INFORMIXSERVER=ol_informix117
>
> I tried different users, including the informix user and password.
>
> The error:
>
> com.informix.asf.IfxASFException:
> Attempt to connect to database server (ol_informix117) failed.
>
> Unfortunately the driver does not provide any additional details, such
> as bad host, bad servername, bad database, bad user/password, etc.
>
> I can connect to mydb using dbaccess just fine, including "dbaccess
> mydb@ol_informix117".
>
> When I try and telnet to localhost, port 20200, I can connect
> successfully. If I send garbage the connection is aborted and there is
> an message in the Informix log file. There is no message in the log
> file when I fail to connect via JDBC (not sure if that is normal).
>
> Also, there is no firewall running.
>
> Can anyone help?
Localhost is your likely problem
JDBC is not resolving the sqlhost entry.
Best solution would be to either use your machine name or a *
I used to run into the same problem on my MacBook pro
Sent from my iPhone
On Mar 11, 2011, at 12:57 PM, Superboer <superboer7@t-online.de> wrote:
> hmmmm try:
>
>
> jdbc:informix-sqli://<ip or host>:<portno>:informixserver=<value of
> $INFORMIXSERVER>;database=<nameofdb>;
>
> or
>
> jdbc:informix-sqli://<ip or host>:<portno>:informixserver=<value of
> $INFORMIXSERVER>;
> user=<username>;
> password=<password>;
> database=<nameofdb>;
>
> your env:
>
> jdbc:informix-sqli://localhost:
> 20200:informixserver=ol_informix117;database=mydb;
>
> no passwd user needed since it runs on the same machine otherwise:
>
> jdbc:informix-sqli://localhost:
> 20200:informixserver=ol_informix117;user=<theuser>;password=<thepassword>;database=mydb;
>
>
>
> hmmmmm > com.informix.asf.IfxASFException:
>> Attempt to connect to database server (ol_informix117) failed.
>>
>
> these query tools should catch the exception and get the errorcode...
>
> catch (SQLException e){
>
> System.out.println( "error :"+e.getErrorCode()+
> ":message:"+e.getMessage() );
>
> ....
>
> Superboer
>
>
> On 11 mrt, 17:07, "markmadi...@mail.com" <markmadi...@mail.com> wrote:
>> Hello,
>>
>> I am having problems connecting via JDBC to my locally running
>> Informix 11.7 instance on my Mac, OS 10.6. I have this problem when
>> trying with a couple of a Java GUI query tools.
>>
>> In /etc/services:
>>
>> ol_informix117 20200/tcp
>> dr_informix117 21788/tcp
>>
>> In sqlhosts:
>>
>> demo_on onipcshm on_hostname on_servername>> demo_se seipcpip se_hostname sqlexec
>> ol_informix117 onsoctcp localhost ol_informix117>>
>> My attempted JDBC URLs:
>>
>> jdbc:informix-sqli://localhost:20200/
>> mydb:INFORMIXSERVER=ol_informix117
>> jdbc:informix-sqli://127.0.0.1:20200/
>> mydb:INFORMIXSERVER=ol_informix117
>> jdbc:informix-sqli://192.68.123.22:20200/
>> mydb:INFORMIXSERVER=ol_informix117
>>
>> I tried different users, including the informix user and password.
>>
>> The error:
>>
>> com.informix.asf.IfxASFException:
>> Attempt to connect to database server (ol_informix117) failed.
>>
>> Unfortunately the driver does not provide any additional details, such
>> as bad host, bad servername, bad database, bad user/password, etc.
>>
>> I can connect to mydb using dbaccess just fine, including "dbaccess
>> mydb@ol_informix117".
>>
>> When I try and telnet to localhost, port 20200, I can connect
>> successfully. If I send garbage the connection is aborted and there is
>> an message in the Informix log file. There is no message in the log
>> file when I fail to connect via JDBC (not sure if that is normal).
>>
>> Also, there is no firewall running.
>>
>> Can anyone help?
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
On Mar 11, 3:41 pm, Mark Jamison <maj...@me.com> wrote: > Localhost is your likely problem > > JDBC is not resolving the sqlhost entry. > > Best solution would be to either use your machine name or a * > > I used to run into the same problem on my MacBook pro Thank you for the help. I changed sqlhosts to use 127.0.0.1, and that seemed to solve the problem. Thanks again!