Classpath for ExcelDriver in AS/400 enviroment

Hello there!
I'm trying to create application which would be capable copy excel file sheet to AS400 DB2 file.
First of all I created this program on Windows enviroment tryed and it works fine.In this program
Im using two drivers Microsoft Excel Driver(without DSN) for reading Excel file and AS/400 jt.400 driver for writing to AS/400 file.
My problem arised when I put the program into AS/400 enviroment and tryed to do same thing(copy Excel file which is in folder directory on AS/400 to AS/400 ordinary file).
I've got message in AS/400 enviroment:"java.sql.SQLException: No suitable driver"
Of course No suitable driver because I did not put Microsoft Excel Driver on AS/400 enviroment
and did not declare the classpath either.
Question is:Where can I get Microsoft Excel Driver so that put it into AS/400 enviroment?
If somebody need have a look into the source code here is it:
// Convert Excel file to AS/400 DB2 file
// Andrey Parahnevich 05/06/2002
package com.parahnevich.exceltoas400;
import java.sql.*;
import java.io.*;
import com.ibm.as400.access.AS400JDBCDriver.*;
import com.ibm.as400.access.*;
public class ExcelToAS400{
static long qty=0;
public ExcelToAS400()
System.out.println("Entered without parameters!");
System.exit(0);
private static String format(String s,int width)
String formattedString;
if(s.length()<width)
StringBuffer buffer = new StringBuffer(s);
for(int i = s.length(); i<width; ++i)
buffer.append(" ");
formattedString=buffer.toString();
} //endif
else
formattedString=s.substring(0,width);
return formattedString;
} //endmethod format
public static void main(String[] args) throws Exception
String lib = args[0];
String file = args[1];
String pathfile = args[2];
String query_Excel = "";
String insertSQL_AS400 = "";
System.out.println("lib :" + lib);
System.out.println("file :" + file);
System.out.println("pathfile :" + pathfile);
// *************************Connection to Excel***************************
//connection to database
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Before Microsoft Excel Driver loading");
Connection connect_Excel = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ="+pathfile+";DriverID=22;READONLY=false","","");
System.out.println("After Microsoft Excel Driver loading");
/* Construct and execute the sql, positioning before the
first row in the result set */
Statement stmt_Excel = connect_Excel.createStatement();
// *************************Connection to iSeries***************************
/* Connection to the database */
DriverManager.registerDriver(new com.ibm.as400.access.AS400JDBCDriver());
// Get a connection to the database. Since we do not
// provide a user id or password, a prompt will appear.
Connection connect_AS400 = DriverManager.getConnection("jdbc:as400:AS400stam","USER","PASSWORD");
//create statement
Statement stmt_AS400 = connect_AS400.createStatement();
try
System.out.println("Catalog :" + connect_Excel.getCatalog());
DatabaseMetaData dbmeta = connect_Excel.getMetaData();
ResultSet rs1 = dbmeta.getTables(connect_Excel.getCatalog(),null,"%",null);
ResultSetMetaData rsmd1 = rs1.getMetaData();
System.out.println("Table name :"+ rsmd1.getTableName(2));
//while (rs1.next()) {
rs1.next();
String table_cat = rs1.getString("TABLE_CAT");
String table_sch = rs1.getString("TABLE_SCHEM");
String table_type = rs1.getString("TABLE_TYPE");
String table_name = rs1.getString("TABLE_NAME");
query_Excel = "SELECT * FROM ["+table_name+"]";
System.out.println("table_cat is:" + table_cat + " table_sch :" + table_sch + " table_name :" + table_name);
ResultSet rs2 = dbmeta.getColumns(table_cat, table_sch, table_name, "%");
while (rs2.next()) {
String column_name=rs2.getString("COLUMN_NAME");
String type_name =rs2.getString("TYPE_NAME");
String column_size=rs2.getString("COLUMN_SIZE");
String is_nullable=rs2.getString("IS_NULLABLE");
System.out.println("column_name is:" + column_name + " type_name :" + type_name + " column_size :" + column_size + "column_length : " + column_name.length() + " is_nullable :"+ is_nullable);
ResultSet rs3=stmt_Excel.executeQuery(query_Excel);
//get information about this Resultset
//set Column of file
ResultSetMetaData rsmd = rs3.getMetaData();
int columnCount = rsmd.getColumnCount();
String[] columnLabels = new String[columnCount];
int[] columnWidths = new int[columnCount];
for(int i = 1; i<=columnCount; ++i)
columnLabels[i-1]=rsmd.getColumnLabel(i);
columnWidths[i-1]=Math.max(columnLabels[i-1].length(),rsmd.getColumnDisplaySize(i));
}//endloopfor1
for(int i = 1; i<=columnCount; ++i)
System.out.print(format (rsmd.getColumnLabel(i),columnWidths[i-1]));
System.out.print(" ");
}//endloopfor2
System.out.println();
// Iterate throught the rows in the Resultset and
// output the columns for each row.
String [] field_a = new String[columnCount];
Object [] value_a = new Object[columnCount];
while(rs3.next())
++qty;
for(int i = 1; i<=columnCount; ++i)
String value = rs3.getString(i);
if(rs3.wasNull())
value="NULL";
field_a[i-1] = rsmd.getColumnLabel(i);
value_a[i-1] =(Object)value;
System.out.println(format(value,columnWidths[i-1])+" columnLabel: " +field_a[i-1]);
System.out.println(" ");
System.out.println(qty);
// **************************** insert row in iSeries table ********************
insertSQL_AS400 = "Insert Into " + lib +"." + file + " (";
for(int j=1;j<=columnCount; ++j)
String sign = ",";
if (j==columnCount) sign = ")";
insertSQL_AS400 += " "+field_a[j-1] + " " + sign;
insertSQL_AS400 += "Values (";
for(int j=1;j<=columnCount; ++j)
String sign = ",";
if (j==columnCount) sign = ")";
insertSQL_AS400 += " "+value_a[j-1] + " " + sign;
System.out.println("insertSQL_AS400 :" + insertSQL_AS400);
try
stmt_AS400.executeUpdate(insertSQL_AS400);
insertSQL_AS400 = "";
} //endtry
catch(Exception e)
System.out.println("");
System.out.println("ERROR :"+" "+e.getMessage());
} // endcatch
} //endtry
catch(Exception e)
System.out.println("");
System.out.println("ERROR :"+" "+e.getMessage());
} // endcatch
finally
if(connect_Excel != null)
connect_Excel.close();
if(connect_AS400 != null)
connect_AS400.close();
}//endmain method

Is there a Microsoft Excel driver? If there is, its classname would very definitely not be "sun.jdbc.odbc.JdbcOdbcDriver". This forum has a link to FAQ at the top of the page listing posts, one of the FAQs has a link to a list of many drivers. You might find this driver listed there. Otherwise, don't be surprised if the AS/400 doesn't support ODBC.

Similar Messages

  • Path in Classpath for file SapMetamodelWebdynproContent.zip not found.

    How to get rid of these warnings?
                   [Warning]: Path in Classpath for file SapMetamodelWebdynproContent.zip not found.          
    Warning               [Warning]: Version for file SapMetamodelWebdynproContent.zip not found.          
    Warning               [Warning]: Versions of 'SapDictionaryTypeServices.jar' have different prefix.          
    Warning               [Warning]: Versions of 'SapDictionaryTypesRuntime.jar' have different prefix.     
    thanks in advance.

    Hi,
    This is a common problem when you import projects to NWDS. Do like this.
    1.Change to Navigator tab in NWDS and delete gen_wdp folder.
    2.Switch to Web Dynpro Explorer. Select the Project -> Right click-> Select properties -> in the wizard select Java Build Path -> Select Libraries tab -> You will find jar files with warnings
    3.Remove the jar and add the jar file with same name to the project one by one.
    4.For each jar file repeat step 3.
    5.Save the project
    Or
    removed the read-only property from all folders / files of the project and it solved my problem.
    Hope this helps!!
    Thanks & Regards
    Vijay K

  • Can I set classpath for OAS 10g?

    Hi,<br>
    <br>
    I have OAS on my workstation. Here are the details.<br>
    Server : Oracle Application Server 10g Release 3 <br>
    Version : 10.1.3.1.0 SOA4<br>
    Build : 061008.0900.00025<br>
    Platform : Windows XP - SP2<br>
    <br>
    I want to set an explicit classpath for complete OAS 10g as such and not to an individual oc4j application. Will I be able to do it?<br>
    I saw the System Properties after my server started.<br>
    It has a name-value pair as "java.class.path oc4j.jar".<br>
    So, I assume all my classpath settings (done thru Environment Variables from My Computer) are lost.?<br> I want to set it explicitly during the server startup itself. Can I do that?<br>
    I tried setting below in the opmn.xml <br>
    <process-set id="ASG" numprocs="1"><br>
         <module-data>          <br>                         <category id="start-parameters">     <br>               <data id="start-executable" value="C:\Oracle\product\10.1.3.1\OracleAS_1\jdk\bin\java"/>     <br>               <data id="start-args" value="-classpath C:\abc\properties\"/><br>
    I appended my properties folder after all the jar files present in that tag.<br>
    But its not loading any of my properties files.<br>
    <br>
    Can someone please help me out.<br>
    <br>
    Regards,<br>
    <br>
    Prashanth Babu.

    No, the iPad does not support multiple user accounts or preferences.

  • Wildcards in Classpath for JNI-Calls

    Is it possible to use wildcards in the classpath for KNI-Calls?
    I would like to use wildcard for jni-calls like for normal java-calls (java -classpath *.jar ...), but it is not working.
    JDK version is JDK 1.5.0 on Win32

    I would like to use wildcard for jni-calls like for normal
    java-calls (java -classpath *.jar ...), but it is not working.It would be the Shell, not Java doing the wildcard magic.
    You would have to do the globbing manually (or use any OS APIs, or 3rd party APIs).

  • Problem in setting path and classpath for java in RedHat linux 9

    Hi ,
    i am not able to set the PATH and CLASSPATH for j2sdk1.4.2_06
    I have tried with export PATH=$PATH:/usr/j2sdk1.4.2_06/bin
    and export CLASSPATH=$CLASSPATH:/usr/j2sdk1.4.2_06/lib
    in terminal
    but i want to configure it as permenant way for the jre and jdk
    and we should only type java or javac according to the requirement
    regards mihir...

    type those in .bashrc ... save and exit
    then at prompt, type 'source .bashrc'
    this is the permanent solution ...
    bhalo thakun

  • How to set a classpath for referring classes

    I am using windows vista.....I had assigned classpath for Variable name and given address of class in variable type ..even then compiler does not recognize class path..........

    Thanks but it is not what I am really asking or I may didnt understand..
    The program is working ok through JCreator.. My problem is when I create an Installation file and then run it..
    the program is being created just fine but when it has to load the jdic then it blocks...
    This is something that must be done through variables right?
    If you ever used Install4J there are 2 columns where you declare variables..
    The first column is for Variable name and the second one is Variable Value..
    Sorry for buthering you with all this but this is the first time that I am dealing with jar files!
    Thanks again !

  • Starting tomcat server after setting classpath for java

    Sorry if this is nothing to do with java, it is more to do with starting tomcat server.
    Tomcat server has been working totally fine, but when I wanted to compile a java servlet I wrote for it, I needed to run a BAT file called gojava in MS-DOS that had the classpath for java to work properly. I then attempted to run Tomcat, but just got 'bad command'. As long as I don't start up java by setting the classpath, tomcat will work, but as I need java to write servlets and then to test them without restarting my PC each time, how do I get tomcat to work?
    Thanks
    Hannah

    Sounds like your batch file is changing your path, not your classpath. If you're getting "Bad command or filename" when attempting to run Tomcat, it can't find the executable. Check out the .bat file and see what it's doing (maybe even post it here for further clarity). If it's changing your path at all, make sure it includes a %path% to indicate that it simply wants to append items to the path, not overwrite it completely. Sorry if i'm way off base with my suggestions, but it sounds like that's where the problem's going to be, especially if rebooting resolves the problem.

  • Did u use jar files as classpath for appletviewer?

    as tested, jar files can not be used as classpath for appletviewer.
    java command is bellow
    appletviewer -J-classpath -Jc:\folder00\some.jar; -Jc:\folder01\any.jar; MyAppletClass
    the jar files (or classpaths) above do not work.
    I am not sure about my test, so i post my Q here for confirming it.
    thx

    appletviewer needs HTML code to run an Applet similar to how the Applet would be run from a browser. It does not have a Classpath option.
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/appletviewer.html

  • How to edit classpath for Domain Admin Server?

    Hi!
    Please, explain me how can I edit the classpath settings for Domain Admin Server of Sun java Application Server 8.2?
    I need to remove some classpath made by application installer in order to make the application work.
    It is said in documentation that I have to login to DAS first, but I can't see how can I make it through Server's web-interface :(

    Hi Rengasamy,
    If you want to set the CLASSPATH for all the managed Servers available in your Domain then "$DOMAIN_HOME/bin/setDomainEnv.sh" has an Environment variable with name "PRE_CLASSPATH" which is usually preferred for Patches or any JAR which we want to override from the WebLogic's existing classpath.
    But if you don;t want to override WebLogic's default CLASSPATH rather include your Jars in it then please add your JAR filenem including absolute path inside the "POST_CLASSPATH" variable inside "$DOMAIN_HOME/bin/setDomainEnv.sh"
    Apart from this another option will be putting your Jars inside the "$DOMAIN_HOME/lib" directory because The jars located in this directory will be picked up and added dynamically to the end of the server classpath at server startup. The jars will be ordered lexically in the classpath. The domain library directory is one mechanism that can be used for adding application libraries to the server classpath. It is possible to override the $DOMAIN_DIR/lib directory using the -Dweblogic.ext.dirs system property during startup. This property specifies a list of directories to pick up jars from and dynamically append to the end of the server classpath using java.io.File.pathSeparator as the delimiter between path entries.
    If you are starting your Managed Servers using NodeManager then please refer to the following Article.:
    Topic: Nodemanager Based ManagedServers setting MEM_ARGS
    http://middlewaremagic.com/weblogic/?p=780
    Regards
    Ravish Mody

  • Database error: TemSe- XRTAB(2)- 1 for table TST01 key [400]JOBLGX13132201X

    Hi
    We are getting the next erros with the jobs:
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            F6H Database error: TemSe->XRTAB(2)->1 for table TST01 key                                  
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            GZZ > retry creation JOBLGX btctlgow216#                                                    
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            F6H Database error: TemSe->XRTAB(2)->1 for table TST01 key [400]JOBLGX13132201X28173,1      
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            GZZ > retry creation JOBLGX btctlgow216#                                                    
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            F6H Database error: TemSe->XRTAB(2)->1 for table TST01 key [400]JOBLGX13132201X28173,1      
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            GZZ > retry creation JOBLGX btctlgow216#                                                    
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            F6H Database error: TemSe->XRTAB(2)->1 for table TST01 key [400]JOBLGX13132201X28173,1      
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            ECF Failed to create log for job POLCASHWIN                                                 
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            EBC > Job POLCASHWIN                                                                        
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            EAY Failed to read status entry for job POLCASHWIN                                          
    13:13:51 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            EBC > Job POLCASHWIN                                                                        
    13:24:21 PRDAUNE2_PRD_02      BTC 22 000 SAPSYS            BYM SQL error 0 . Work processes in reconnect status                                        
    We make a consistency check of spool and temse but nothing is wrong, but if we apply Check Status in  the SM37 some jobs change to Active and run but other are in same status Ready
    We olny found the note 67055 but recommended the consistency check.
    Best Regards
    Reynaldo Rebolledo

    Hi Reynaldo,
    Check for Tablespace PSAPTEMP size for Oracle database when job is running.
    If tablespace is full try adding datafile and run the job.
    Award Points if Helpful

  • Problem with NetWeaver 2004s EAR classpath for EJB

    I'm working with SAP NetWeaver Developer Studio Version: 7.0.09.
    I am trying to reference additional JARs from an EJB at runtime in the J2EE engine.  I have added the additional JARs to my EAR project (I have a separate EJB module project) through "Properties/Archive Build Info."  Then I have updated my EAR classpath by double-clicking on the application-j2ee-engine.xml and selecting Expert settings then specify a list of JAR's in the "Additional classpath" field as such: "log4j-1_2_8.jar, basis-test.jar,commons-beanutils-bean-collections.jar,commons-beanutils-core.jar,commons-beanutils.jar"  Then I build the Application Archive (the EAR) and deploy to the J2EE Engine.
    This is what my application-j2ee-engine.xml in my EAR looks like:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
         <classpath>log4j-1_2_8.jar, basis-test.jar,commons-beanutils-bean-collections.jar,commons-beanutils-core.jar,commons-beanutils.jar</classpath>
         <provider-name>sap.com</provider-name>
         <fail-over-enable
              mode="disable"/>
    </application-j2ee-engine>
    Then when I run my client code against the EJB (actually through a web service) I get an error in the log -- a "NoClassDefFoundError" on the log4j-1_2_8.jar file from a log4j call:
    EntryPoint: [/SalesOrderCalculation/Config1]. Implementation exception occurs. Please check implementation container(e.g. EJB) logs for additional information! com.sap.engine.services.ejb.exceptions.BaseEJBException: Exception in method calculateOrder.->java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
    Why is my EJB not finding the jar file even though I add it to the EAR and specify the additional classpath for the EAR?
    Edited by: Juan Reyes on Jul 30, 2008 9:08 AM

    Removed the word URGENT from your subject.
    Please read the "Rules of Engagement"

  • How to add to classpath for OAF extensions in 11.5.10

    In 11.5.10, how do I add jar files to the default EBS classpath for new custom classes that are used in OAF extensions? Is there a directory which I can drop them in where they will get automatically appended to the classpath? Or is there a configuration file which needs to get updated with the new jar/library dependencies?
    I tried dropping them in $JAVA_TOP, but that only seems to pick up new classes, not complete jar files. However, I need to add several jar files as well (such as log4j). Ideally I would like to be able to do this without manually changing any of the config files.
    Thanks,
    Ed

    Keeping your concern in mind, the standard way of putting customization in OAF which is patch safe is to
    1. create a custom top like xxx_top
    2. prefix the standard page package which you are extending with xxx to separate it from standard seeded ones.
    3. Keep all your custom files on the xxx_top which is registered with the system.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to set Classpath for MySQL

    Hi
    I want to connect to my mySQL db with a java program , but I don't know how to install the mySQL connector driver. Can anyone help me? or indicate somewhere where I might find the answer?
    And how to set Classpath for MySQL.
    my program gives an exception ClassNotFound.
    Exception :com.mysql.jdbc.Driver
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:164)
    at Files.main(Files.java:352)
    Plz help me
    Thanx
    Lalit

    to make your life easy i tried to connect..
    what you have to do is.. you mysql database server should be running
    next you have to download one of the version of mysql driver.. i downloaded mysql-connector-java-5.0.5
    go to my computer right click - >advance tab -> click on environment variable -> put you path e.g. C:\Program Files\Java\jarFiles\mysql-connector-java-5.0.5\mysql-connector-java-5.0.5-bin.jar
    into your classpath in a user variable section..
    Try this code
    import java.sql.*;
    public class MySqlConnect{
         public static void main(String [] args){
              try{
                   Class.forName("com.mysql.jdbc.Driver");
                   String url ="jdbc:mysql://localhost:3306/test";
                   Connection con =DriverManager.getConnection(url,"root", "password");
                   System.out.println("Connection: " + con);
              }catch(ClassNotFoundException cnfe){
                   cnfe.printStackTrace();
              }catch(SQLException se){
                   se.printStackTrace();
    }have fun
    Gurnah

  • JAVA classpath: How to find classpath for a given java process

    I want to find the classpath for java process outside of the process.
    example:
    Lets say I execute the following command
    java -classpath foobar.jar;shoobar.jar javatest
    Is there a way to find the classpath from a different program given the process id that is created for the above command?
    Ami shukla

    Perhaps through an externally connected debugger? Beyond that, the only thing I can think of would be to modify the source to report that information for you.

  • Problem with classpath for XP

    i've made a java applet with three classes, two of which are classes to construct variables needed for the main interface to work. but the interface class cannot recognise that the other two classes exist. it gives out the cannot resolve system error. i know that there is no problem with the program syntax (or which directory they are in) because it compiles on other computers and i can compile the individual classes on my sustem. i have made numerous one class programs before so the compiler definitely works in some situations. i'm thinking then that the problem must be with my jdk in some way. i've tried re-installing my jdk and installing a different jdk but stil no joy. someone mentioned to me it could be something to do with how the classpath is set up but this is something i'm a bit unsure about, i know though that XP is slightly different to the other windows o/s. any advice would be much appreciated.

    My Windows is not English so I'm not sure whether it's exactly the same:
    Start>Configuration>System>Environment variables
    If there is a variable with the name "CLASSPATH" (system variables) look if . is in your classpath. If not, add to the classpath ";." . And if there is no CLASSPATH variable, add it (and add the value . to it).
    I hope it helps.

Maybe you are looking for

  • Nvidia Optimus on a Lenovo Y580

    Greetings folk! I'm trying to get optimus workings on my Lenovo Y580 laptop. I had it working a few months ago, but I ended up having to format and reinstall reciently and now I can't seem to get it working with the latest version, I think I may be d

  • Label Is not centering in a column chart

    I want to center the value on a column graph,i used LabelStyle for this but this is not working exactly. <asp:Chart ID="bargraphconsldtd" runat="server" EnableViewState="true" Width="600px" style="padding:10px;"> <Series> <asp:Series Name="Overall Po

  • Post GR, return to vendor and cancel receipt info from sap to 3rd party sys

    Hi, we are in process of developing a project that will send the following good movements information to the PI Box. goods receipt, return to vendor, cancellation of the receipt. I wanted to know what is the best possible scenario in which we can do.

  • Can't apply fade to slug?

    I put a slug in to serve as a background for text (the shot is bad, but the audio is priceless) I would like the surrounding shots to fade into the black slug, but FCE HD won't let me. I tryied a overwrite with transistion and dragging a cross-fade i

  • Usb port can't find hardware for ipod so won't show on itunes

    My computer says it the usb port for my ipod is unknown and won't show it on my my itunes so i can't add new music. I already installed the whole thing again but it still didn't work. Any ideas?