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!

Informix - java.lang.IndexOutOfBoundsException

843859Jul 25 2008 — edited Jan 20 2015
Hi, I am newbie in Java. I have encounter a problem about JDBC, i have try a few ago but I cannot solve it.
Can somebody explain what's mistake to code? TQ

My JDBC 3.0 and JDK1.6.0 is install in Windox XP, Informix Database is install in SolarisOS.
I also set the CLASSPATH in my Window.

Output
---------------------------------------------------------------------------------------------------------------------------------------------------------------
testing
ERROR: failed to connect!
ERROR: Message text will be provided in later releases java.lang.IndexOutOfBound
sException
java.sql.SQLException: Message text will be provided in later releases java.lang
.IndexOutOfBoundsException
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:448)
at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1035)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:254)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at Connect.main(Connect.java:31)

Input
---------------------------------------------------------------------------------------------------------------------------------------------------------------
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;

class Connect
{

   public static void main(String args[])
   {
	System.out.println("testing");

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


	try
	{
	   Connection conn = 

DriverManager.getConnection("jdbc:informix-sqli://128.18.5.55:88/empTbl:INFORMIXSERVER=onway90;user=webster5u;password=681di");
	}
	catch (SQLException e)
	{
	   System.out.println("ERROR: failed to connect!");
	   System.out.println("ERROR: " + e.getMessage());
	   e.printStackTrace();
	   return;
	}

   }

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2008
Added on Jul 25 2008
3 comments
663 views