path question

From: Yamin (absdfsd_at_sdfdasfsd.com)
Date: 03/06/04

  • Next message: Markku: "Re: path question"
    Date: Sat, 6 Mar 2004 01:59:24 -0500
    
    

    Hi all,

    I'm just started off with databases and jdbc. I've gotten some samples
    going, but I just want to know if theres any 'recommended' style of
    including jdbc drivers.

    Currently, I'm useing mysql as the database server
    I downloaded the jdbc drivers from mysql
    (mysql-connector-java-3.0.11-stable-bin.jar)

    In my Main.java file, I load the driver by:
             Class.forName("com.mysql.jdbc.Driver").newInstance();

    so, now the bulk of the question is where/how do I include the actual jdbc
    driver. The instructions that came with the driver gave too many options.

    1. copy the com/org directories to some dir and include them in the java
    Classpath
    2. copy the jar file to the /ext folder of the java runtine
    3. copy the jar file to the local dir and place it in the Classpath

    For the classpath as well, there are further options.
    1. set the environment variable CLASSPATH
    2. simply set the classpath for the java commandline tools. java -cp
    <jarfile> Main

    What I'm doing right now is just copying the jar file to my local project
    dir, and adding it to the command line path
    java -cp ".;mysqljdbc.jar" Main

    I also had it working with setting the CLASSPATH environment variable. I
    never quite got it to work by just copying it to the /ext folder. I'm on
    windows XP, with jre 1.4 if that's any help on that one.

    I've also been kinda working in NetBean IDE for a bit as well. Just for the
    hell of it. In there, they just ignore all class paths and ask you to mount
    folders and what not.

    Any advice here ?

    Thanks

    Yamin


  • Next message: Markku: "Re: path question"

    Relevant Pages

    • Re: jdbc permissions
      ... Using the SQL Server 2000 Driver for JDBC on a Java 2 Platform ... additional permissions. ...
      (microsoft.public.sqlserver.server)
    • Re: Possible Type Conversion Defect
      ... Specifically we are breaking due to the lack of conversion from BIGINT to ... Microsoft SQL Server 2000 JDBC driver. ... I'll agree that the JDBC API specifications could be a bit more precise. ... a JDBC driver attempts to convert the underlying data to the Java ...
      (microsoft.public.sqlserver.jdbcdriver)
    • Re: Microsoft Access DB Driver for JDBC
      ... The jdbc odbc bridge works but ... >> There is no JDBC driver for Access. ... > poster says it works) to allow Java apps to talk to any ODBC datasource. ...
      (comp.lang.java.programmer)
    • Re: ClassNotFoundException
      ... > Java application, using JDBC. ... > 3) My Java app is on Windows XP Home; ... > driver installed and a CLASSPATH set before running DBPING" ... > c) I know CLASSPATH system variable isn't set. ...
      (comp.lang.java)
    • Re: ClassNotFoundException
      ... When you using database you must have the JDBC Driver for that type of database. ... It has some Interface objets in iut that a specific driver for a specific database must implement. ... So you must have a driver for your specific database in your classpath ...
      (comp.lang.java)