Setting jdbc classpath in xp, completely stuck

I must be going crazy cause i could swear i posted my msg but it never showed up later on, on the forum so here i go again
Plateform: XP
java file: ConTest.java
I am trying to add a classpath to a jdbc drvier (lets calls it jdbcdriver.jar in d:\temp). I set it in environment variable. I create a classpath variable and set the value to d:\temp\jdbcdriver.jar
java is already set in Path, so that part work. Now when i go to run my code, i get an error Exception in thread "main" java.lang.NoClassDefFoundError: ConTest
now if i remove the classpath, i offcourse get "no suitable driver found" exception
I've tested and made sure that my code works. It works fine and gets a db connection when i run in eclipse, since you can tell eclipse where the jdbc driver and eclipse creates its own classpath and stuff. so the code is fine, just a problem with setting the path
I am completely stuck on this and i've spent past 3-4 hours on just trying to fix this stupid problem rather then working on my project.
I'll really really appreciate if any of you kind :) people can help me on this. I am totally stuck on this and can't move on until i get this working
thank you very much

When you set your classpath you need to set ALL the classpath including in your case your working directory where your program is. You include the directory you launch your progam from with a .
so something like...
java -cp .;d:\temp\jdbcdriver ConTestshould work for you...
Hope that helps you out.
Yonge and Eglinton

Similar Messages

  • Setting the classpath of classes12.zip for Tomcat

    Hi
    I am using Apache Tomcat webserver and while trying to run a jsp page which intializes oracle.jdbc.driver.OracleDriver it throws an error
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    Please suggest how to set the classpath of classes12.zip in Apache Tomcat
    My Code Snippett
    <%@ page import="java.util.*,java.sql.*,javax.servlet.*"%>
    <body>
         <%
         Connection con ;
         ResultSet rs ;
         Statement stmt ;
         ResultSetMetaData rsmd ;
         try{ 
         Class.forName("oracle.jdbc.driver.OracleDriver");
         catch(Exception e)
         out.println(e);//print the exception on the command prompt
    %>

    The simplest way to do this is to copy classes12.zip to the WEB-INF/lib directory. The JSP should then find this automatically.
    As a side note, that is an ancient JDBC driver - you might want to upgrade to something from this millennium.

  • Setting Up CLASSPATH variable

    Dears,
    In PI 7.1 we are getting one error:
    We are getting an u201CSAPClassNotFoundException:u201D. The reason for this is as I got we need to set the classpath in the PI Server.
    Please do as below:
    The following is an example of the CLASSPATH statement that is used for a Unix/Linux application:
    CLASSPATH =.:/home/usr1/mssqlserverjdbc/Driver/sqljdbc_2.0/enu/sqljdbc.jar
    Please suggest how can I set this path on AIX ,Is it a env variable.If yes then as I am getting aftre setting ones and logging out this variable will get dissaper.
    So please suggest how can i set this path.
    SHivam

    Hi,
    Where you are facing problem?? r u facing problem when you using JDBC Communication Chanels??
    Regards,
    Raj

  • Setting the classpath

    doing a jsp page which calls for:
    <%@ page import="java.sql.*" %>
    <%@ page import="javax.sql.*" %>
    <%@ page import="sun.jdbc.rowset.*" %>
    <%@ page import="java.util.*;" %>
    at the top of the page , so i downloaded the jar files that i needed and set the classpath to:
    C:\jdk1.3.1_01\rowset.jar;C:\jdk1.3.1_01\jdbc2_0-stdext.jar;C:\jdk1.3.1_01\jndi
    this is the first time ive set the classpath
    but when i run the page i get loads of Error: Could not find package named:
    anyone no what im doing wrong?

    When you say you "set the classpath", does that mean that you changed the system CLASSPATH environment variable, or that you went into the configuration of whatever it is that's running your JSPs and put those jars and directories into the appropriate place?

  • Help -setting long classpath in windows 2003

    i have around 50 jars .
    i have to set classpath for all these jars.
    when i try to set environmentvariables\classpath
    its not taking the classpath completly.
    and errors are thrown when program is compiled ..
    pls help
    arvin

    If you're using Java 6 a new classpath feature may help:
    "As a special convenience, a class path element containing a basename of * is considered equivalent to specifying a list of all the files in the directory with the extension .jar or .JAR (a java program cannot tell the difference between the two invocations).
    For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified. All jar files in the specified directory, even hidden ones, are included in the list. A classpath entry consisting simply of * expands to a list of all the jar files in the current directory. The CLASSPATH environment variable, where defined, will be similarly expanded. Any classpath wildcard expansion occurs before the Java virtual machine is started -- no Java program will ever see unexpanded wildcards except by querying the environment. For example; by invoking System.getenv("CLASSPATH"). "

  • How to set the classpath on OS X 10.6

    I am trying to build a web site (first time from mac) I have written a java swing applet in eclipse which works great when run from inside eclipse - however, when I run it from Safari or Firefox via .html doc the applet isn't displayed - I don't get an error message it just doesn't display. I have been able to run other applets this way but this one uses swing and I think it isn't able to find the classes.jar file. I believe if I can set the classpath to point to the classes.jar it should then work or perhaps I am way off base. Any other suggestions or how can I set classpath. I tried echo $CLASSPATH but it appears it isn't set with the exception of perhaps the default as no path is displayed. I really need to get this going as it is holding up the release of its counter part iPhone app.
    thanks,
    PMA

    It's possible, then, that the computers running Snow Leopard have a software problem. I would start by reinstalling Snow Leopard on them.
    Reinstall OS X without erasing the drive
    1. Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. Reinstall Snow Leopard
    If the drive is OK then quit DU and return to the installer.  Proceed with reinstalling OS X.  Note that the Snow Leopard installer will not erase your drive or disturb your files.  After installing a fresh copy of OS X the installer will move your Home folder, third-party applications, support items, and network preferences into the newly installed system.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.

  • Please help me set my classpath

    hi:
    I install the jdbc driver of Microsoft for sql server2000.I set the classpath as the documents say.
    I rewrite the program and want to use the jdbc driver ,Add the "import javax.sql.*; import javax.naming.*;".
    when i run the program .the debug tell me all the new methods from new jdbc jar. cant resovle .
    I notice maybe my classpath is wrong .but it is setted as the documents say step by step .
    I dont find something wrong.
    what can i do?
    can you help me or some advice ?
    thanks for your reading.

    please test ur microsoft jdbc driver with the following testing program
    thanks
    =============================================
    Microsoft SQL Server JDBC Driver Connection Sample program
    =============================================
    import java.sql.*;
    public class MyConnection
    Connection con;
    MyConnection()
    try
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    con = DriverManager.getConnection("jdbc:microsoft:sqlserver://server:1433","userid","password");
    DatabaseMetaData md = con.getMetaData();
    System.out.println("Driver Name " + md.getDriverName());
    System.out.println("Driver Version " + md.getDriverVersion());
    System.out.println("Database URL is " + md.getURL());
    System.out.println("Database UserName is " + md.getUserName());
    System.out.println("Connection Name " + md.getConnection());
    System.out.println("Database Name " + md.getDatabaseProductName());
    System.out.println("Database Version " + md.getDatabaseProductVersion());
    System.out.println("Database ReadOnly Type " + md.isReadOnly());
    System.out.println("MaxColumnNameLength " + md.getMaxColumnNameLength());
    System.out.println("MaxConnections " + md.getMaxConnections());
    System.out.println("");
    catch(ClassNotFoundException cnfe)
    System.out.println(cnfe.getException());
    System.out.println("The Specified Driver Does not Exist....");
    catch(SQLException sqle)
    if(sqle.getErrorCode() == 0)
    System.out.println("No Suitable Driver Found..");
    else if(sqle.getErrorCode() == 1017)
    System.out.println("Wrong UserName Or Password..");
    else if(sqle.getErrorCode() == 1034)
    System.out.println("Database not Started..");
    System.out.println(sqle.getErrorCode());
    System.out.println(sqle.getSQLState());
    System.out.println(sqle);
    public static void main (String args[])
    new MyConnection();
    }

  • Permanantly setting linux classpath

    Hello all;
    I just searched for this question in the archive to no avail.
    How do you set the classpath on a Linux (SuSe specifically if it matters) so that it lives on between sessions and re-boots? I have been using "export JDK_HOME=YadaYada" but this only helps for that session. I am hoping to set this variable for ALL users at one shot (Root et all). Basically I am not sure how/where linux holds it's global environments variables for all users.
    Trying to rid myself completely of Windows, and learning the nuances of linux is a bit slow going.
    TIA, Will--

    The classes of the Java runtime (and extensions) are automatically included, at least when you are using Java2. So I don't think you really want to set a global CLASSPATH for all your users. If you really do, you have to edit the global configuration files of bash. I am not using a SuSe system, so I don't know they exact location on your machine. Look in /etc and /etc/config.d or just type "find /etc -name \*bash\*" and "find /etc -name \*prof\*" - I hope that will find them for you.

  • Lost in setting up classpath

    I was told to read the FAQ in the beginners board regarding classpath .. I did and i was lost
    so maybe someone can help me do this:
    I am trying to access the database via java using asp..
    basically the java part accessing the database rather than asp
    but when I get the the function that accesses the database i get a Classnotfound exception on the class.forname("jdbc.odbc.jdbcodbcdriver")
    the class works fine as a stand alone.. but when it comes to the ASP part I get that Exception.. Somebody on the forum told me that there might be a classpath problem.. but I am new to this and would like to know how to set the classpath
    How do I set the Classpath so ASP can read the odbc drivers?

    That the application works stand alone (using java ..... or appletviewer .... or something else?) and doesn't work "using asp..." (I am assuming you mean through a browser) makes me wonder if you have two different JREs at work, one you installed and the other which came with browers.
    One JRE is doing the work when running stand along, the second when the application is run from the browser.
    If my assumptions are in the ball park about how the applications are being run you can find out which JVM Internet Explorer is using by checking Tools / Internet Options then the Advanced tab.

  • Help, how to install jvm and set the classpath using a batch file

    hello,
    i have created my java application and now have to create an installable / batch file which will install the JVM on the users machine and also the java packages such as javamail and the class files that i have created . it also has to set the classpath.
    i would like to know if anyone can tell me how to go about iti.e. how can i install the JVM using a batch file and then place the javamial packages etc in the apropriate directory .
    or is it advisable to explain it to the user how to go about it in tht user manual.
    and would also like to know that if i install the JVM will the path for the java.exe be set
    or will i have to set the path explicitly from the "batch file" so that the user can run the application without and problem just by running the java command followed by filename from the command prompt.

    hi,
    I have windows and I use it.
    The only problem with the free edition is that you can only create 1 launcher and that during the installation you get 1 popup showing that the installer was created with an unregistered version.
    Stijn

  • How to set JDBC Data Sources in Oracle MapViewer for Oracle database 12c Release 1 (12.1.0.1)

    How to set JDBC Data Sources in Oracle MapViewer for Oracle database 12c Release 1 (12.1.0.1)?
    The following is my configuration in the conf\mapViewerConfig.xml:
    <map_data_source name="mvdemo12"
    jdbc_host="127.0.0.1"
    jdbc_sid="orcl12c1"
    jdbc_port="1522"
    jdbc_user="mvdemo"
    jdbc_password="7OVl2rJ+hOYxG5T3vKJQb+hW4NPgy9EN"
    jdbc_mode="thin"
    number_of_mappers="3"
    allow_jdbc_theme_based_foi="true"
    editable="true"/>
    <!--  ****  -->
    But it does not work.
    After use "sqlplus mvdemo/[email protected]:1522/pdborcl", it connected to the Oracle database 12c.
    Does anyone know it?
    Thanks,

    For 11.1.1.7.1 use the syntax for jdbc_sid, i.e.
    //mypdb1.foo.com as described in the README,
    - MapViewer native (non-container) data sources can now use database service name in place of SID. To supply a db service name, you will use the same jdbc_sid attribute, but specify the service name with double slashes in front, such as follows:
      <map_data_source name="myds"
        jdbc_host="foo.com"
        jdbc_sid="//mypdb1.foo.com"
        jdbc_port="1522"
      />
    For 11.1.1.7.0 use a container_ds instead.
    i.e. instead of using
    <map_data_source name="my_12c_test"
                       jdbc_host="mydbinstance"
                       jdbc_sid="pdborcl12c"
                       jdbc_port="1522"
                       jdbc_user="mytestuser"
                       jdbc_password="m2E7T48U3LfRjKwR0YFETQcjNb4gCMLG8/X0KWjO00Q="
                       jdbc_mode="thin"
                       number_of_mappers="6"
                       allow_jdbc_theme_based_foi="false"
                       editable="false"
       />
    use
      <map_data_source name="my_12c_test"
                       container_ds="jdbc/db12c"
                       number_of_mappers="6"
                       allow_jdbc_theme_based_foi="false"
                       editable="false"
       />
    In my case the Glassfish 3.1.2.2 JDBC connection pool definition was
    Property
    url  jdbc:oracle:thin:@mydbinstance:1522/pdborcl12c.rest_of.service.name
    Uncheck the Wrap JDBC Objects option in Advanced panel, i.e. the Edit JDBC Connection Pool Advanced properties page.
    Add a JDBC resource for that newly created pool
    Use that in mapviewerconfig.xml as above

  • How to set the CLASSPATH in Unix Server

    Hi, everyone~
    Do anyone noe how to set the CLASSPATH in the hp-ux server? I tried the setenv CLASSPATH, but not working.. I think should use export. But my jsp pages still cannot working, dunnoe y?
    I wonder is the hp-ux support jsp and servlet or not?
    In order to let the jsp and servlet to run properly in the unix server, what kinds of steps should taken ?
    Hope somemore who experience with this situation b4 can give me some guidance.. Thanks~~
    regards,
    tzeyik

    Tomcat ignores any and all CLASSPATH environment variables. Even if you could figure out how to set it, Tomcat wouldn't use it.
    Better to learn how Tomcat's CLASSPATH works and how to deploy Web apps properly. - MOD

  • How to set BPEL classpath(urgent)

    Hi
    I Want to set the classpath of the BPEL server with a jar file.
    I have already posted a question on this issue.But didnt get any reply.
    I have mysql jar file which is needed for mysql database connection.In the jdeveloper project settings I am adding the classpath of the library.But when i run my BPEL process i am getting classNotFoundException.Probably when BPEL server starts it sets some classpath.I think i need to update the classpath entry and put my jar file path there.
    And one more thing i am not using Database Adapter rather i am using java class to connect to the database.And the java class is called from BPEL process using <bpelx activity.
    Can anyone help me how to do this.

    Hi,
    I found out the way we can set the classpath.
    In C:\OraBPELPM_1\integration\orabpel\bin directory edit obsetenv.bat file and add ur class files there.
    Thanks

  • Novice Trying to Set The CLASSPATH Variable

    I am trying to compile a file (which can be downloaded at http://java.sun.com/docs/books/tutorial/getStarted/QandE/FirstClass.java). Despite being able to successfully compile several other files, this particular one will not compile. According to my JAVA Tutorial book, the problem may lie in the CLASSPATH variable, but I am having a great deal of trouble trying to set/understand it. My operating system is WINDOWS 2000. PLEASE HELP!!!

    in win 2000, the classpath can be set by the following process.
    Right Click My Computer icon and click on properties.
    (This can be done by going to the Control Panel and Double Clicking the System icon too).
    Once you have the properties window of the system click on the 'Advanced' tab.
    There is a button called 'Environment variables'.Click on it.
    You will have a part called 'System Variables' there.
    Here there is an entry called Classpath. Just add the entry of what you want to add to the classpath, separating each entry with a ';' semicolon as mentioned there and click on the Set button.
    That should set the classpath.If that does not take effect immediately, restart the system and it will take effect.
    Tell me if it worx.
    All the best. Bye!
    Cheers,
    Win!

  • How can i set the classpath??

    CAN ANYONE PLEASE HELP ME HOW TO SET THE CLASSPATH IN WINDOWS ME ,WHAT IS THE RIGHT CODE TO SET THE CLASSPATH I AM USING JDK1.3 VERSION.
    THANK YOU VERY MUCH
    ERICK LUCCIO

    Try this way Start->Program->System tools-> System Summary>startup .Try to find the variable classpath,make sure the path is correct.The classpath contain the the *.java & *.class you save. I'm also new in java .This path & classpath question is so trouble to me .Now i'm running jdk1.3.1_2 in WINME ,WINNT AND WIN2000 IN no problem.........

Maybe you are looking for

  • Invalid cursor problem

    Steve, Were you ever able to look at this item? In the meantime, my work around was to do a separate xsql query for each sub-query(cursor) and then append nodes in my DOM as I went along. But, I would like to help this tool be better. I think I have

  • Fetching data from infotype

    Hi Experts, I have to fetch all data from infotype 0581,can you suggest me how to do this in sap abap-hr. I am not using LDB in my report. Thanks&Regards Priyaranjan

  • Message type EDI is not triggering for outbound deliveries

    Hello, When ever the shipment status is completed message type EDI is triggered for the outbound delivery. However, in spite of the shipment completion the DESADV EDI message is not created in the outbound delivery. So, i request you to help me in th

  • Browser upload window too large

    After downloading Yosemite, the drop down window that comes open when uploading files for emails or imessage is now so large that I can't see the Open or Cancel buttons.  How do I resize this?

  • Outbound Delivery Scheduling Discussion

    Hello Folks, I am about to work on a assignment to setup and configure the outbound scheduling for delivery documents. The reason I start this post is to get input from you all experts on what are the steps involved and what kind of considerations sh