Results 1 to 6 of 6
  1. #1
    ribbs2521 is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default Connect to Access without MS ODBC? <SOLVED>

    Is there any way to connect to an access DB without creating a driver through the Administrative tools in Windows?

    I am going to make a program that 100 or so people will use and I don't want to have to setup 100 computers just to get the program to work on each, not to mention what happens if a new computer is added or if it's re-imaged.

    I'm pretty sure there is a way to just give the connection method the path of the file but I'm not positive. Could someone please help me out?
    Last edited by ribbs2521; 04-16-2009 at 03:34 AM.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    439
    Rep Power
    6

    Default

    I know that it is possible.
    But i dont know how to implement..
    Mak
    (Living @ Virtual World)

  4. #4
    ribbs2521 is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    Quote Originally Posted by masijade View Post
    Here you go
    Thanks, I tried looking online but I just didn't know the right words to use I guess. I don't have the program with me right now but I'll give this a shot, it looks like it will work for what I want.

    Java Code:
    String myDBurl = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/mypath/MyAccessDB.MDB";

  5. #5
    ribbs2521 is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    It didn't work, I get this message:
    Java Code:
    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    
    where options include:
        -client       to select the "client" VM
        -server       to select the "server" VM
        -hotspot      is a synonym for the "client" VM  [deprecated]
                      The default VM is client.
    
        -cp <class search path of directories and zip/jar files>
        -classpath <class search path of directories and zip/jar files>
                      A ; separated list of directories, JAR archives,
                      and ZIP archives to search for class files.
        -D<name>=<value>
                      set a system property
        -verbose[:class|gc|jni]
                      enable verbose output
        -version      print product version and exit
        -version:<value>
                      require the specified version to run
        -showversion  print product version and continue
        -jre-restrict-search | -jre-no-restrict-search
                      include/exclude user private JREs in the version search
        -? -help      print this help message
        -X            print help on non-standard options
        -ea[:<packagename>...|:<classname>]
        -enableassertions[:<packagename>...|:<classname>]
                      enable assertions
        -da[:<packagename>...|:<classname>]
        -disableassertions[:<packagename>...|:<classname>]
                      disable assertions
        -esa | -enablesystemassertions
                      enable system assertions
        -dsa | -disablesystemassertions
                      disable system assertions
        -agentlib:<libname>[=<options>]
                      load native agent library <libname>, e.g. -agentlib:hprof
                        see also, -agentlib:jdwp=help and -agentlib:hprof=help
        -agentpath:<pathname>[=<options>]
                      load native agent library by full pathname
        -javaagent:<jarpath>[=<options>]
                      load Java programming language agent, see java.lang.instrument
    
        -splash:<imagepath>
                      show splash screen with specified image
    Press any key to continue . . .
    Here is my connection method:
    Java Code:
    	public Connection getConnection(String pFile) throws SQLException, IOException
    	{
    		Properties props = new Properties();
    
    		FileInputStream in = new FileInputStream(pFile);
    		props.load(in);
    		in.close();
    
    		String drivers = props.getProperty("jdbc.drivers");
    		if (drivers != null)
    			System.setProperty("jdbc.drivers", drivers);
    		String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=E:/USB Drive/College/" + 
    								"Programming/CIS225 Advanced Java Programming/Data Base/TestDB.MDB";
    		String username = props.getProperty("jdbc.username");
    		String password = props.getProperty("jdbc.password");
    
    		return DriverManager.getConnection(url, username, password);
    	}

  6. #6
    ribbs2521 is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    Nevermind, I was making a stupid mistake when trying to run it. So it does work for anyone who wants to use it.

Similar Threads

  1. Help me this error in JDBC-ODBC connection
    By lordelf in forum Java Servlet
    Replies: 3
    Last Post: 04-04-2009, 08:37 AM
  2. Using JDBC-ODBC bridge
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-06-2008, 09:21 AM
  3. connect to microsoft access
    By bbq in forum JDBC
    Replies: 1
    Last Post: 07-09-2007, 03:33 AM
  4. without ODBC
    By Heather in forum JDBC
    Replies: 2
    Last Post: 06-29-2007, 02:42 PM
  5. Replies: 1
    Last Post: 06-27-2007, 05:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •