Relative Paths In DSN-less JDBC URL

Whenever I've seen DSN-less URL strings for M$ Access, they've always used an absolute path to the database file:
String url="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\full\\path\\src\\data\\FirstLotParts.mdb";Has anyone tried to give a relative path?
String url="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=src\\data\\FirstLotParts.mdb";I'd like to be able to check out my application to a clean directory and have Ant run JUnit tests without having to change the absolute path. Is it possible? Thanks - MOD

Just answered my own question: Yes, it does work with a relative path:
String url="jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=.\\src\\data\\FirstLotParts.mdb";MOD

Similar Messages

  • Dsn-less jdbc connection

    how do i connect w/out dsn?

    Try the JDBC forum where this question is asked regularly. If it is not in the FAQ for the forum then you should be able to search and find many related posts.

  • DSN-less URL parameters

    Hi all
    After reading some posts and finding the solution to creating a DSN-less connection to a .mdb file, I started to think what do all the parameters used in the jdbc-odbc URL mean (for instance, the URL I saw was "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=<.mdb filepath>").
    Until now, I figured out that "Driver={Microsoft Access Driver (*.mdb)}" means the name of the driver. Nothing to be surprised, but are there other drivers? If so, what are their strings?
    I've tried to find the answer but I haven't found it yet. So, if someone knows what does each part of the URL means, please tell me.
    Thanks in advance!
    Frederico Marvila

    To use another ODBC driver with the JDBC<->ODBC bridge, you have to download and install it.
    A quick Google for "odbc driver" will help you find many of them. However, most such ODBC drivers are specific to a particular database, e.g. MySQL or Oracle, and most of those databases also provide straight JDBC drivers, which are usually the far better choice, straight JDBC performance can be as much as 20 times faster than bridged, depending on DB and drivers transaction load (see http://mmmysql.sourceforge.net/performance/ for an example for mysql).
    However, if you're looking for another ODBC driver to use with Microsoft Access, I suspect you're going to have no luck. Because MS utterly controls the internal format of the .mdb files and has a long and strong history of changing such internals (at least in every other MS product I'm familiar with), no 3rd party in their right mind is going to invest time in a competing driver for Access, except as a labor of love. They might be out there, but my quick Google didn't find any.
    You can think of the DB URL as being a chain of instructions read left to right for your program to find the database/data files it needs, each step possibly invoking a different layer of software:
    jdbc - we're doing JDBC here
    jdbc:odbc - through the JDBC-ODBC bridge
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)} - using the MS Access file
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=<.mdb filepath> - to read these particular Access files
    Each step controls the format of the following step, some other JDBC URLs look like:
    jdbc:oracle:oci8:scott/tiger@database
    jdbc:oracle:thin:@localhost:1521:orcl
    jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
    jdbc:mysql-caucho://localhost:3306/test'
    jdbc:postgresql://<pgsqlDbHost>/<databaseName>
    JDBC<->ODBC URLs
    jdbc:odbc:[data source name]
    (see http://www.onjava.com/pub/a/onjava/synd/2001/08/21/jdbc.html)

  • [svn:bz-trunk] 17772: Update the url in the tests to use a relative path instead of the default localhost : 8400 so that the tests can pass on appservers other than the default Tomcat .

    Revision: 17772
    Revision: 17772
    Author:   [email protected]
    Date:     2010-09-20 15:02:50 -0700 (Mon, 20 Sep 2010)
    Log Message:
    Update the url in the tests to use a relative path instead of the default localhost:8400 so that the tests can pass on appservers other than the default Tomcat.
    Modified Paths:
        blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/Remoting_NetConnectionTest.mxml
        blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/Remoting_NetConnectionTest.mxml

    Revision: 17772
    Revision: 17772
    Author:   [email protected]
    Date:     2010-09-20 15:02:50 -0700 (Mon, 20 Sep 2010)
    Log Message:
    Update the url in the tests to use a relative path instead of the default localhost:8400 so that the tests can pass on appservers other than the default Tomcat.
    Modified Paths:
        blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationFalseTest/Remoting_NetConnectionTest.mxml
        blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/EnforceEndpointValidation/Enforc eEndpointValidationTrueTest/Remoting_NetConnectionTest.mxml

  • Rewrite URL in SMP and Relative Path

    Hi,
    some one have an example how to use Relative Path properties?
    I have read this guide (Defining Back-End Connections - REST API Application Development - SAP Library) but is not very clear for me.
    Thanks and kind Regards,
    Elia.

    When you precompile, can you say "Keepgenerated=TRUE". It might help you track
              down the difference with the URL. You should only get a 404 error when the
              resource is not found at runtime, which is independant of when you compile. The
              difference should be in how the URL is compiled.
              Chris
              ali wrote:
              > I am using WLS 6.0 SP1, when I use relative path in <jsp:forward> in my JSPs
              > it forwards ok if I am using directly JSPs but if I am using pre-compiled
              > JSPs (and have proper servlet-mappings
              > in my web.xml), I get 404 error with the relative-path, if I change it to
              > absolute path with pre-compiled JSPs it forwards ok , then.
              > any ideas why this is so?
              > thanks,
              

  • How to use relative paths in Captivate 8 / Cómo usar URL's relativas en Captivate 8

    Hello, I have developed a bunch of courses which will be migrated to a new site and I am having trouble changing the absolute paths into relative URL's to resources such as PDF files inserted into the scorm packages. I cannot find information on how to use relative paths in Captivate. Please help. Thank you.

    I have the same issue with relative links using Captivate 8.  I am trying to load Captivate modules into an LMS using relative links to document files within the LMS.  The links work fine during a site page test so not an issue in the LMS, but from the Captivate module they aren't working....
    Help?

  • DSN-less connection,BEA weblogic

    Hi , I have a .war file which I deploy into a BEA Weblogic server.
    Now, the .war file contains a ms-access file which is required in a JDBC-ODBC module in the .war file. What I find is that BEA doesn't extract the ms-access file to any temporary folder, and hence I am finding it hard to read the file in my JDBC-ODBC module. What I want is to know the path which I mention in the DSN-less conection if the ms-access file resides inside the .war file?
    con = DriverManager.getConnection("jdbc:odbc:;DRIVER=Microsoft Access Driver (*.mdb);DBQ=c:/databases/StockPrices.mdb");
    Sudhakar

    That's right, WebLogic does not extract WAR file on disk (extracts it just in memory) and why it should do that. WAR files are very convenient and compact format for web application deployment. But if you do want to have directory structure on your disk you can manually extract WAR file using jar tool into applications directory and this web application should work as well as in WAR form (that's so called "exploded form" of web application). WAR file is standard JAR file with some special directory organization according to web application deployment file structure specification having WAR extension!
    Furthermore, try to use some System properties like System.getProperty("user.dir") to get path for your Access MDB file: http://java.sun.com/docs/books/tutorial/essential/system/properties.html
    Finally, my suggestion is to use another type of database having real JDBC driver like freeware MySQL or PostgreSQL.

  • How to create a DSN Less Connection using MySQL

    Hi All
    How to create a DSN Less Connection using MySQL?
    http://www.caucho.com/projects/jdbc-mysql/index.xtp and downloaded Caucho driver and installed the jar ---- caucho-jdbc-mysql-0.2.7.jar in my classpath..
    this is how i embedded the code
    try
    driver = (Driver) Class.forName("com.caucho-jdbc-mysql-0.2.7.Driver").newInstance();
    catch (Exception e)
    lastErr = "Cannot load the driver, reason:"+e.toString();
    nothing seems to work with code..
    Unable to proceed..Any piece of code would be of great help..
    Thanks and regds
    Gautam

    According to the installation instructions for that driver:
    The driver is com.caucho.jdbc.mysql.Driver
    The url is jdbc:mysql-caucho://hostname:port/database
    You used something else for the driver name. So it doesn't work. By the way, I found those instructions here: http://www.caucho.com/projects/jdbc-mysql/

  • Help needed for MySQL 5 database DSN less connection with Oracle reports

    Hi,
    I am using Oracle Develper Suite and java (J2EE) for my application. I am using MySql 5 as database tool. I want to use Oracle reports of Oracle Develper suite. I have created some reports by first creating system DSN for MySql database and then connect Oracle reports to that DSN by "jdbc:odbc" connection string provided in Oracle Report developer wizard. This is working fine.
    I want to generate reports without creating system DSN (DSN less) so that i can use my application on any computer without creating DSN for Oracle Reports. I am deploying my application on OC4j as "EAR" file.
    Help in this regard will be highly appreciated.
    Regards.

    Using an 8i client, you will need to configure the tnsnames.ora file with appropriate connection information if you are using local naming. If you are using host naming or something like an Oracle Names server to resolve TNS aliases, you can skip the tnsnames.ora configuration. A default installation of the Oracle client, though, will probably be using local naming.
    If the tnsnames.ora file is configured, or you have configured an alternate way of resolving TNS aliases, you should be able to use the connection string
    DRIVER={Oracle ODBC Driver};DBQ=<<TNS alias>>;UID=system;PWD=managerIf you wanted to move to the 10g client (the 10g Instant Client could be useful here), there are some streamlined naming methods that could be used instead of configuring the tnsnames.ora file.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to specify relative path for background image  in xsl

    Hi,
    I am generating a PDF from Apcahe FOP. I have an xsl for that, in the xsl fo:block I am displaying a background image. When the image path is absolute like..C:\image\logo.png it works fine. But I want to have the image in my WebContent\images folder and my xsl file is in WebContent\xsls folder. So when I try giving the relative path as ../images/logo.png, the image is not displayed.
    Can anyone tell how to do this???
    Thanks,
    Sanjeev.

    I have a fo:block like this :
    <fo:block border-style="solid" border-width="0.2pt" text-align="left"
                             background-image="url('http://localhost:8080/Project/images/table_header_center.png')"
                             font-size="8pt" font-weight="bold" color="white" padding-top="1pt"
                             padding-bottom="1pt">
                             <xsl:value-of select="tr/td/span" />
                        </fo:block>In the above code you can see that the the background-image="url('http://localhost:8080/Project/images/table_header_center.png')"
    has been given as absolute. The images folder is in my WebContent directory. I want this path to be relative to the context of my application , something like background-image="url('../images/table_header_center.png')".
    Thanks.
    sanjeev.

  • Relative path to file in servlet class file

    Hello,
    I have several classes running as a Tomcat Servlet on my server. However, I have one class that I would like to access a file on the server.
    The problem is, what path do I use? I want to use a relative path as the servlet might be moved and I don't want to recompile each time the servlet is moved. For instance, I placed the file in the servlet directory under webapps in the same level with the WEB-INF directory. However, using "../../text.txt" does not seem to access it.
    What path should I use?
    Thanks in advance.
    Chris

    This is what I have done:
         String FS = System.getProperty("file.separator");
         String ctx = getServletContext( ).getRealPath( "" ) + FS;
         URL url = new URL("file", "", ctx +   "somefile.txt");
         //Create a BufferedReader for reading the inputstream.
         BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));This gets you back to the "root", or one level above WEB-INF. Add the folder name where the file is located. As in      URL url = new URL("file", "", ctx +   "theFolder/somefile.txt");HTH,
    WalkGood

  • Relative paths for images upset by forwarding requests

    Hello World.
              I am using a web app deployed in Weblogic 5.1 with service pack 8.
              I have hit a problem which puzzles me. When I forward a request from
              one JSP to another (say from A to B) the web server seems to take the
              URLs of the images on the served file (B) relative to the path on the
              calling file (A). Here's a detailed explanation...
              Suppose I have a the web app structured as follow
              /oddApp/launch/A.jsp
              /oddApp/B.jsp
              /oddApp/images/tick.gif
              Page A simply stores its request URI and forwards its request to page B
              <jsp:forward page="/B.jsp" />
              Page B displays its requestURI, contextPath and servletPath. It also
              attempts
              to show three images
              <img src="images/tick.gif">
              <img src="../images/tick.gif">
              <img src="/images/tick.gif">
              When I invoke page B directly, the first image is shown, the others are not.
              When I invoke page A, it forwards to B and the second image is shown, the
              others are not.
              In each case the URI, contextPath and servletPath are correctly displayed
              with regard to page B.
              URI = [oddApp/B.jsp]
              contextPath = [oddApp]
              servletPath = [B.jsp]
              The URI in A.jsp is also correct (i.e. /oddApp/launch/A.jsp).
              The search for the images seems to be relative to the original URI (i.e. not
              the URI used to forward), which strikes me as daft. It means that page B
              must be aware of where it is being called from. It is perfectly plausible
              that
              relative paths which suit when called from one location are incorrect when
              called from another.
              I had thought that including the leadling slash (as shown as the third
              image)
              would cause the search relative to the document root (/oddApp/), but this
              appears not to be the case. The search is done relative to the root of the
              server not the web app.
              Adding jsp mappings in the deployment descriptor of the web app does not
              help (I had thought it a long shot anyway).
              Does anyone have any thoughts on this?
              PHiL
              

    i face the same problem (WinNT, WLS6.0): my wep app has a contextRoot " root " which makes it react to the URL: http://host:port/root /: it is this folder which will be used as a basis by the Web server But in the jps I use a relative URL for images: / images/toto.gif : it works very well when I deploy my jsp out of a Web-app by setting a document.root to the weblogic web server.On the other hand, once deployed in a Web-app, images are not found because the default path of the browser is http://host:port, without the context root of the Web-app! In other words, my war has images/*.gif in its root but when /images/toto.gif is resolved in a jsp, as the relative URL is not prefixed by my context-root, the image is not search in the war! actually, if I type http://host:port/root/toto.gif, my image appearsany clues? an alias on the web server? a setting in web.xml/application.xml and their weblogic equivalent files?
              

  • Relative path with images

    Hi All -
    I have a strange situation with relative paths. When I use a relative path in cfinclude it works. But when I use a relative path is "src" attribute of <img>, it does not work. Can anyone suggest why could this be happening?
    Thanks

    Adam Cameron. wrote:
    Because you're expectation is that apples work the same as oranges.
    CF relative paths are relative to the CF file the path is in; HTML relative paths are relative to the URL browsed to.
    Remember CF code is run on the CF server; HTML is rendered on the browser.
    Adam
    The beauty of relative pathing is that it plucks them from the tree and calls either fruit.

  • Problem defining relative path ofr images in struct tiles

    hi
    I have a jsp pages in which i am setting the layout using tiles . To display an image
    i am using < img src= "./../images/abc.gif" />
    this doesnt seem to work.
    but if i give absolute path like src="C:\myDoc|....\abc.gif" it works.
    As i have to deploy it so i cant give absolute path.
    One solution i found is to use request.getContextPath()
    <img src="<%=request.getContextPath()%>/tutorial/images/abc.gif" works.
    is there any way we can give relative path like ?
    < img src= "./../images/abc.gif" />

    Hi , I have found the solution.
    <c:url value='/javascript/menuscript.js'/>"{code} can be used to avoide the absoulte path . The c:url tag takes default  value as Webcontent . so you need to give only path after the webContent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Relative path of XSL in RTF

    Hello,
    I want to use common xsl file in RTF template. I will hardcode the path of the xsl file. Path should be relative path. Can anyone tell me how can I import xsl file into RTF template using relative path. e.g relative path may be BIP web cerver path. Currently I am using <?import: http://xp1111.xxx.co.in:9704/abc.xsl?> but it is not relative path.
    Thanks,
    Amit D.

    Hi Tim,
    I am using BIP 10.1.3.3.2. I am able to access system variable CURRENT_SERVER URL.
    Steps:
    <?param@begin:CURRENT_SERVER_URL?>
    <xsl:value-of select="$ CURRENT_SERVER_URL"/>
    CURRENT_SERVER_URL is getting printed in BI Publisher. Value displayed is http://xx4697.xxx.co.in:9704/xmlpserver.
    Now we are importing xsl into RTF template. File aaa.xsl is stored at [BIP_Installation_Directory\oc4j_bi\j2ee\home\default-web-app]
    We have hardcoded the path for XSL in RTF. The path is <?import: http://xx4697.xxx.co.in:9704/aaa.xsl?>
    As we want to set dynamic path we changed hardcoded xsl path to <?import: {$CURRENT_SERVER_URL}/../aaa.xsl?> but it is not working. Sometimes BIP is taking local path of MyDocuments folder and sometimes Desktop path. If I put that XSL file in MyDocuments folder or Desktop, it is working fine. But ideally it should refer [BIP_Installation_Directory\oc4j_bi\j2ee\home\default-web-app] path.
    Thanks,
    Amit D

Maybe you are looking for