If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Example of a JDBC connection

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-05, 09:23
clony clony is offline
Registered User
 
Join Date: Jan 2005
Posts: 12
Example of a JDBC connection

Hi everybody,

Does anyone have an example of a connection using the jdbc driver for informix?

thanks
Reply With Quote
  #2 (permalink)  
Old 02-04-05, 16:17
ponsjohann ponsjohann is offline
Registered User
 
Join Date: Feb 2005
Posts: 5
Informix Jdbc

import java.sql.*;
import java.util.*;

public class Connect
{
public static void main(String[] args)
{
Connection conn = null;
String url = "jdbc:informix-sqli://123.45.67.89:1533:INFORMIXSERVER=myserver;user=rdt est;password=test",

try
{
Class.forName("com.informix.jdbc.IfxDriver");
System.out.println("Driver OK");
}
catch (Exception e)
{
System.out.println("FAILED: failed to load Informix JDBC driver.");
}

try
{
conn = DriverManager.getConnection(url);
}
catch (SQLException e)
{
System.out.println("FAILED: failed to connect!"+e);
}

}
}
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On