The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
June 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

a problem with connection

Posted by EL MRANI on June 28, 2000 at 6:00 AM

Good morning,
I have a problem with Java and AS/400, i have made a program and i try to connect to my DataBase in AS/400 with Java baut i can't i have a program :
import java.awt.*;
import javax.swing.*;
import java.lang.Object.*;
import java.net.URLConnection.*;
import java.net.URL.*;
import java.net.*;
import java.sql.*;

// seconnecter.Java


public class seconnecter
{
public static void main(String[] arguments)
{

try
{

Class.forName("com.ibm.as400.access.AS400JDBCDriver");
System.out.println("La classe est charg�e");
Connection conn = DriverManager.getConnection("jdbc:as400:HGPFICH/EDIREG");
System.out.println("La connection est �tablie");
Statement st = conn.createStatement();
ResultSet rec = st.executeQuery(
"SELECT CDMMEX, CDEP "+
"FROM PORTED.ffd "+
"WHERE " +
"ORDER BY NAME ");
while (rec.next())
{
System.out.println(rec.getString("CDEP") + "\n"
+ rec.getString("CDMMEX") +"\n");
}
st.close();
}catch(Exception e)
{
System.out.println("Impossible d'�tablir la connexion" + e.toString());
}
}
}

I don't want to use JDBC-ODBC bridge, juste JDBC or if there are another methode like to access directly with SQL.

and when i execute this program i have an error message :
O:\mes documents\hicham\jdk1.2.2\bin\java.exe seconnecter

Working Directory - O:\Mes documents\Hicham\Programmes\

Class Path - D:\InterBase Corp\InterClient\interclient.jar;D:\Jars\jt400.jar;.;o:\mes documents\hicham\kawainstall\kawaclasses.zip;

o:\mes documents\hicham\jdk1.2.2\lib\tools.jar;o:\mes documents\hicham\jdk1.2.2\jre\lib\rt.jar;

o:\mes documents\hicham\jdk1.2.2\jre\lib\i18n.jar;D:\Jars;O:\Mes documents\Hicham\Toolbox

La classe est charg�e

Impossible d'�tablir la connexionjava.sql.SQLException: The application requester cannot establish the connection.

Please if you have any idea i would like to send it to me.

and i know if there are a methode without using access JDBC-ODBC bridge and JDBC to access a database

Thanks.




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us