Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use JDBC to connect informix database

843854Oct 3 2002 — edited Oct 7 2002
Dear all,

I want my client application to connect informix database by using JDBC. The JDBC driver has been installed successfully in the client computer (Win2000). The informix 5.0 resides the a Unix server named "dbserver". The following is my java program.

========================
import java.sql.*;
import java.awt.event.*;

public class Application1 {

public static void main(String[] args) {
Connection conn;
try
{
Class.forName("com.informix.jdbc.IfxDriver");
}
catch (Exception e)
{
System.out.println("Error "+e.getmessage());
e.printStackTrace();
return;
}
System.out.println("It is ok");
try
{
conn = DriverManager.getConnection("jdbc:informix-sqli://dbserver:1526:INFORMIXSERVER=dbserver;username=test;password=******");
}
catch (SQLException e)
{
System.out.println("ERROR ."+e.getMessage());
e.printStackTrace();
return;
}
System.out.println("All is fine");
}
}
===========================

However, the error appears mentioning "Attempt to connect to database server (dbserver) failed." I don't know what the problem is because my informix database server is exactly "dbserver".

Kindly need help from you guys. Thanks in advance.

Kevin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2002
Added on Oct 3 2002
6 comments
911 views