Link to home
Start Free TrialLog in
Avatar of edwbear1976a
edwbear1976a

asked on

right URL for accessing AS400 with Java

Hi there,
 I have tried this before on the JavaChannel with no answers for the right URL, I'm developing a java programm that access AS400 database, I got the right driver for that (JTOPEN), but I'm not sure if the URL 's got enough parameters(or Wheather they are right or not)
 to acces the AS400 /db2  database

this is my subUrl:

String  subUrl = "//"+Server+"/"+Database + ";Uid="+ strLoginId +";Pwd="+strPassword+";prompt=false;errors=full" ;
      
      String driver="com.ibm.as400.access.AS400JDBCDriver";
      String protocol="jdbc:as400:";
      String url=protocol+ subUrl ;
        
ASKER CERTIFIED SOLUTION
Avatar of Member_2_2484401
Member_2_2484401
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of edwbear1976a
edwbear1976a

ASKER

Hi , and thank you for your advice

well I just used your  way to connect and at least I got a error that tells me something

try {
            DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
                     conn = DriverManager.getConnection("jdbc:as400://" + system, username, password);
             DatabaseMetaData dbMetaData = conn.getMetaData();
             conn.close();

           
            }
            catch (SQLException e){System.out.println(e.getMessage());e.printStackTrace () ;}
            catch (ClassNotFoundException e){System.out.println(e.getMessage());e.printStackTrace () ;}
     
     return conn;


--------------------------------------------------------------------------------

And I get this error
****************************************************************************
C:\jakarta-tomcat-5.0.28\work\Catalina\localhost\sisTextEditor\org\apache\jsp\txtEditorLauncher_jsp.java:56: package com.ibm.as400.access does not exist
            DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
                                                                     ^
*************************************************************************
I got the JTOPEN jar files in my classpath
%classpath%;C:\WINNT\java\Packages;C:\windows\system32;C:\jakarta-tomcat-5.0.28\common\lib\servlet-api;C:\jakarta-tomcat-5.0.28\common\lib\jsp-api;c:\sybase\ASEP\3pclass.zip;c:\sybase\ASEP\monclass.zip;C:\IBMJTOPEN\lib\jt400.jar;C:\IBMJTOPEN\lib\util400.jar;C:\IBMJTOPEN\lib\jt400Servlet.jar;
 
and When I use the NetBeans IDE I added the JTOPEN FILES  to my "libraries" so I got the fullpath completed
jt400.jar:
com
      ibm
            as400
                     access
                                as400JDBCDRIVER.class

but even on NetBeans I got the same error "package doesn't exist"
I know that there must be something really silly that I'm missing like adding at the top anything like an import stament or something... should I use Upercase for that package name?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial