Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

jdbc connect to informix error - SQLException

Status
Not open for further replies.

stephenxero

Programmer
Jun 17, 2002
1
HK
Dear all,

I have used the JDK1.3 and informix jdbc driver 2.11 for connecting the informix se 7.1. The java coding show as following,

==============start===========================

package myprojects.informixse;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;
import sqlj.runtime.ref.DefaultContext;

public class InformixSE {



public static void main(String args[]){

Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String DRIVER = null ; //JDBC Driver class
String DBURL = null ; //Database URL
String UID = null ; //User ID for database account
String PWD = null ; //Password for database account
String cmd = null;
int rc;

try{


DRIVER = "com.informix.jdbc.IfxDriver";
DBURL = "jdbc:informix-sqli://192.168.1.30:30000:INFORMIXSERVER=test;user=informix;password=informix";
UID = "informix";
PWD = "informix";

Driver d = (Driver)(Class.forName( DRIVER ).newInstance());
DriverManager.registerDriver(d);

System.out.println("000");
conn = DriverManager.getConnection (DBURL, UID, PWD);
stmt = conn.createStatement();

String sql = "use test";

System.out.println("before run the sql");
rs = stmt.executeQuery(sql);
System.out.println("after run the sql");


System.out.println(conn);

//cmd="database test";
//rc = stmt.executeUpdate(cmd);
}
catch(Exception ee)
{
System.out.println(ee);
}
finally
{
try{
if(stmt != null)
stmt.close();
if(conn != null)
conn.close();
}catch(Exception e){
System.out.println(e);
}
}


}
}

============== end ===========================

When I run the coding, there is an error "java.sql.SQLException: ????????????????". Does anyone kindly to help me solve these issues? Is it relate to the database environment setting in informix??

Thanks,

StephenXero
 
do you have informix-jdbc added to your classpath when you run java??? this is native SUN exception not Informix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top