Java on  Linux with .MDB file

Hi,
I have created a small java project (experementing actually) to connect to my database .mdb in windows. it works find in my windows environment (Vista + Java + .mdb). I created a .jar file and try to execute it in the Linux (obundu) the program opens but it does not connect to the database instead it throws an error (null),
I am using the DNSless connection. I have attached the code for checking
   Connection getConnection() throws Exception {
    try{
        String dir=System.getProperty("user.dir")+"/db/Client.mdb";
    System.out.println("1");
         Driver d = (Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    System.out.println("2");
         Connection c=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ="+dir, "admin", "pass");
    System.out.println("3");
    return c;
    catch (exception e){
       System.out.println(e.getMessage());
        System.out.println("4");
    }When I run this code in linux (I have included some print statements for debugging purpose) it print 1,2,null,4
but with windows 1,2,3 (which has opened the connection)
could anyone help me with this connection. I have even installed jdk 6 with netbeans in my linux pc to re-compile in linux itself to check. I still get the same error. the programme not connecting to the database
Thanks

jwenting wrote:
jschell wrote:
jwenting wrote:
there is no ODBC on Linux, hence no bridge driver.ODBC exists on unix.not as standard. Not sure what you mean. It available for most flavors of unix including linux, solaris, OSX, HPUX and AIX.
How more 'standard' does it need to be?
Even if it is installed on OPs machine, it's a fair bet that OP doesn't have a valid DSN set up and doesn't know how to configure one.Could be. But the fact that they are using MS Access means that that point is meaningless.
>
Bridge driver exists on linux.
never seen it, but then I've never looked for it because it's rubbish.That for course doesn't mean it doesn't exist. It exists in all of the Sun VM releases.
>>>
You never use the bridge driver. Not only is it complete rubbish, but it is also a class from the sun.* packages and none of those should ever be used directly.The notation of the bridge driver being a sun.* package is not relevant. One must use the bridge driver or another ODBC driver when using an ODBC only source.
One should never use the bridge driver. It's rubbish. See the documentation for the driver.The driver was donated to Sun by a company that was at the time and still does sell java ODBC drivers. The documentation was probably worded that way specifically to steer people to the commercial drivers.
I have never seen a single problem with the driver itself. The driver up until recently I believe (rather strongly since I have seen bug reports on it for interim releases) was used for unit testing all of the JDBC functonality for the Sun VM releases.
When it was released it was basically the only driver and certainly the only free one. I am rather certain that many projects were successful with it. It was certainly used successfully by me on a large system.
If you insist on using ODBC through Java, get another driver.
mdb file is a MS Access file.I know that... It's however completely irrelevant here, as all that counts is that there's a bad driver being used (and almost certainly incorrectly too).You have a completely different view of the problem domain than I do then. I provided all of the possible solutions for the problem domain that I saw.

Similar Messages

  • How to send mail from linux with .txt file as attachment ..

    I want to send email from linux box and in the body of the email i want to have the content of dblog.txt file.
    I want dglob.txt file content to be part of the mail body.
    Thanks in advance!!

    Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=[email protected], ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)
    Apr 29 16:04:52 lctwprddb01 sendmail[1422]: m3TIP6LJ031388: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:39:46, xdelay=00:48:01, mailer=esmtp, pri=120423, relay=cluster2a.us.messagelabs.com. [216.82.249.211], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
    Apr 29 16:07:36 lctwprddb01 sendmail[1619]: m3TJJZhB001617: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=00:48:01, xdelay=00:48:01, mailer=esmtp, pri=120425, relay=cluster2a.us.messagelabs.com. [216.82.248.44], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
    Apr 29 16:07:52 lctwprddb01 sendmail[1627]: m3TILs2r031176: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:45:58, xdelay=00:48:01, mailer=esmtp, pri=120429, relay=cluster2a.us.messagelabs.com. [216.82.248.45], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.

  • Simple but wierd java.lang.NoClassDefFoundError with jar file

    I'm using ant to jar my .class files. My final objective is to create an executable jar. When I run my jar file - "java -jar PM.jar" - I get:
    Exception in thread "main" java.lang.NoClassDefFoundError: pm/PMApp
    This at least tells me that java found my MANIFEST.MF class and that is the correct class it should be looking for, but it doesn't seem to find the class. But when I do - "jar -tf PM.jar" - I get:
    C:\mike\pm\execs>jar -tf PM.jar
    META-INF/
    META-INF/MANIFEST.MF
    pm/
    pm/EasterEgg.class
    pm/JMSMessageListener.class
    pm/PMApp.class
    pm/ReleasePlanTest.class
    pm/SystemArchitectureFrame$1.class
    pm/SystemArchitectureFrame$2.class
    pm/SystemArchitectureFrame$3.class
    pm/SystemArchitectureFrame$4.class
    pm/SystemArchitectureFrame$5.class
    pm/SystemArchitectureFrame$6.class
    pm/SystemArchitectureFrame$7.class
    pm/SystemArchitectureFrame$8.class
    pm/SystemArchitectureFrame.class
    pm/SystemArchitecturePanel.class
    Which shows me that the class is there. I suspected that it might have something to do with CLASSPATH at first because of the java.lang.NoClassDefFoundError, but now I am skeptical that that could be the problem. I even build a new jar file out of different classes to make sure my method was OK and that worked fine. Any ideas? Thanks for your help in advance.

    Here is my Manifest:
    Main-Class: pm.PMApp<carriage return>
    Class-Path: C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
    I noticed that if I leave the Class-Path variable unset it has no problem finding the class pm/PMApp, but I then get a class loader error concerning J2EE stuff. Am I missing something in my Class-Path? I tried to even specify the jar file I'm running here, but that didn't work either? I have also tried '.' and './', space delimited in my Class-Path, like this:
    Class-Path: . ./ C:/j2sdkee1.3.1/lib/j2ee.jar<carriage return>
    Thanks for the replies, do you have any more suggestions?

  • Download .mdb File

    Hello. Can anyone tell me if it's possible to use java to download an .mdb file? What I'm trying to do specifically is automate a very tedious routine that includes downloading an Access database from my company's web host, making some modifications and then uploading the database back to where I got it. I need help with the uploading and downloading part. If it's possible, can anyone give me some pointers or point me in the right direction? Thank you.

    Thanks to both of you for replying. I will look at
    both of those links. What I'm trying to do is create
    a program that will do everything for me, so I can
    concentrate on other things. This download is part
    of a very time-consuming process and I would like to
    mechanize the whole thing.
    DON'T CROSSPOST!

  • Replace Unknown Source in EcmaError (JSR223) with actual file name

    Hopefully someone here knows how to do this:
    In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this:
    javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) in <Unknown source> at line number 5
    What bugs me is the <Unknown Source>. Multiple files are in one ScriptContext, and it can be hard to track down an error. It also looks horrible.
    Is there a way to replace <Unknown Source> with the actual file name? None of the methods I see support passing a File object, so I'm really confused here.
    Cross posted (and unanswered) at:
    http://stackoverflow.com/questions/2885120/replace-unknown-source-in-java-rhino-jsr223-with-actual-file-name
    http://www.javaprogrammingforums.com/exceptions/4465-replace-unknown-source-ecmaerror-jsr223-actual-file-name.html
    http://groups.google.com/group/mozilla.dev.tech.js-engine.rhino
    http://mozilla-xp.com/mozilla.dev.tech.js-engine.rhino/Replace-Unknown-Source-with-Script-file-name

    You may need to set compile debug option set to true.
    I am not sure if my tip is useful for you, anyway good luck.

  • Connection with Microsoft Access using Java on Linux

    Hi,
    I am very new to Linux & trying to move my application from Windows to Linux.
    I am downloading one database(*.mdb) file from an url & want to select records from tables & add them to my My Sql database.
    Is there any way to connect to Access database on Linux machine ( Without using different Windows machine having Ms Access installed).
    Thanks in advance.
    Regards,
    Veena

    I am having the same problem.
    jackcess worked fine with Access 2000.
    But i want to work with Access having previous version (probably 97).
    Is there any way to do this?

  • Java running under linux with crontab

    I'm having a problem:
    i want to run a java program under linux with crontab.
    my classes are in a directory and aren't in a package. i run em by invoking ./start which is a small script that i wrote. The script is in the same dir as the classes and invokes java by "java Main >>logjava.txt " but this doesn't seem to work all i get is an empty logfile
    i need to run the program every day at 0800 so i inserted the following in crontab:
    0 8 * 1-5 /var/"path"/start > logjava (where path is the path to the classes dir)
    if i run the cmdline from anywhere on the prompt i get the result i want. I think it's because the cron runs it from the root dir thus making java unable to find the classes
    Any suggestions would be welcome. or can some1 tell me how to make linux executables from the java (i usually use jsmooth for the windows exe)

    You can execute several commands in the process started by cron. You separate them using semicolons.
    Have you tried a cron entry like this:
    0 8 * 1-5 cd /var/"path";pwd;echo $PATH; ./start > logjavaOr, you may need to make sure the process started by cron gets the same environment as your interactive shells do, by explicitly loading your setup or .login scripts:
    0 8 * 1-5 . $HOME/.setup;cd /var/"path";pwd;echo $PATH; ./start > logjava

  • How to create java classes when multiple xsd files with same root element

    Hi,
    I got below error
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. 'resultClass' is already defined
    12/08/09 16:26:38 BST: [ERROR] Error while parsing schema(s).Location []. (related to above error) the first definition appears here
    12/08/09 16:26:38 BST: Build errors for viafrance; org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in the plugin manager executing goal 'org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.7.1:generate': Mojo execution failed.
    I tried genarate java classes from multiple xsd files, but getting above error, here in .xsd file i have the <xe: element="resultClass"> in all .xsd files.
    So I removed all .xsd files accept one, now genarated java classes correctly. but i want to genarte the java classes with diffrent names with out changing .xsd
    Can you please tell me any one how to resolve this one......
    regards
    prasad.nadendla

    Gregory:
    If you want to upload several Java classes in one script the solution is .sql file, for example:
    set define ?
    create or replace and compile java source named "my.Sleep" as
    package my;
    import java.lang.Thread;
    public class Sleep {
    public static void main(String []args) throws java.lang.InterruptedException {
    if (args != null && args.length>0) {
    int s = Integer.parseInt(args[0]);
    Thread.sleep(s*1000);
    } else
    Thread.sleep(1000);
    create or replace and compile java source named "my.App" as
    package my;
    public class App {
    public static void main(String []args) throws java.lang.InterruptedException {
    System.out.println(args[0]);
    exit
    Then the .sql file can be parsed using the SQLPlus, JDeveloper or SQLDeveloper tools.
    HTH, Marcelo.

  • How to create a folder with spaces written in Java under Linux?

    Hello,
    I have a serious problem
    I want to run a Linux command using a Java class with the runtime interface, there is a command to create a folder named eg "My Folder", with a space
    For create the Unix command is easy to do either:
    mkdir My\ Folder
    or
    mkdir "My Folder"
    But how to translate this in Java, I tried with two commands :
    Runtime.exec("mkdir My\\ Folder")
    Runtime.exec("mkdir \"My Folder\"")
    For example :
    import java.io.IOException;
    public class CreerDossier {
    public static void main(String[] args) throws IOException {
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("mkdir My\\ Folder");
    runtime.exec("mkdir \"My Folder\"");
    But it's still not working,
    For runtime.exec("mkdir My\\ Folder") it creates two folders My\ and Folder
    For runtime.exec("mkdir \"My Folder\"") it creates also two folders "My and Folder"
    Are there solutions?
    Thank you !

    But my real problem is how to apply the chmod 777 on a folder containing spacesSo why not say so in the first place?
    Runtime.exec ("chmod 777 My\\ Folder");Runtime.exec(new String[]{"chmod", "777", "My Folder"});
    That is why I chose the example of mkdirYour reasoning on this point is incomprehensible. You wanted help with A so you asked about B. Just wasting time.

  • When I inherit Form with binding DataSet why then designer find mdb file in 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\'

    When I inherit Form with binding DataSet why then designer find mdb file in 'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\' 
    Do I have to anything to change in my application settings or what I am doing wrong?
    When I inherit a plain Form with no binding DataSet then is all ok.

    I finally saw my longingly expected inherited window containing binding dataset.
    But only by way that I put mdb file right in to the this damn path.
    "c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Zdrojove Data\ISMS2003.mdb" 
    In addition mdb file shall be clear too of password.
    We have many windows in our application and we have to work strongly good with inheritance of Form Classes.
    But how I will explain to my Boss if he click on that inherited window and will see this break window?
    Though I will advice to my Boss that hi have to copy too that MDB files to this damn path,
    but the best way could be to find what I need to change that this inherited windows shows without copy this MDB files to
    'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\'
    When I check the settings for DataDirectory every paths looks good.
    Even if I set password for the mdb file I almost see only broken designer window.
    Only by copy this MDB file without his password to this path
    'C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\'
     I can see this inherited window right. 

  • How to convert the MS access *.mdb files to Linux oracle?

    Dear all,
    I got a MS Access *.mdb file which has several tables inside
    it. We will like to convert this file into our new oracle
    database of Linux. How should I do to accomplish the converting
    task?
    null

    A third way to convert Access to Oracle is to setup ODBC on the
    client PC which has the access databases.
    Start Access and open the database to the Table view.
    For each table:
    Chose File -> Save As/Export... -> External File or DB -> ODBC
    Enter the table name for the table in Oracle (case used to be a
    problem -- you may have to try uppercase or lowercase)
    Choose the Oracle ODBC driver and login to the Oracle DB.
    Should show you a progress bar while the data goes in.
    You can get the client side Oracle stuff by downloading a trial
    NT server or some other trail software. ODBC drivers are free.
    As I understand it, the Access migration assistant will bring
    across more than just the tables.
    You should probably bring across the data into some temporary
    tables first, then create your real tables and copy across the
    data. That way you can fix things that were broken in the Access
    version.
    Cheers,
    Colin
    null

  • Java.io.NotSerializableException with VORowImpl.java file

    The WLS server shows this error with my file:
    java.io.NotSerializableException:
    @ oracle.apps.hcm.employment.responsibility.external.service.view.AssignmentResponsibilityVORowImpl
    The VORowImpl.java file is auto generated by jdev. How should I fix the NotSerializableException for VORowImple file?
    Thanks.
    Yan

    Hi,
    the question is what you do so that this error occurs. ADF BC performs passivation and there is no need to pass VORowImpl around. So trun the question around and ask what you shouldn't have do in your application
    Frank

  • Set Date Time Computer with Java in Linux OS

    Dear All,
    How to set date time computer with Java in linux OS?
    Rgds,
    Theo

    There is no API for this you'd have to run an external command using Process.exec.
    This is the wrong forum for general Java "how to" questions.

  • JMenuBar display quirks with some window managers on Linux with Java 6

    When I run this code on Windows with Java 5 or Java 6, it works fine.
    When on Linux with Java 5, it works fine.
    When on Linux with Java 6 in KDE, it works fine.
    When on Linux with Java 6 with twm or e17, the JMenu shows when I click on the JMenuBar, but goes away as soon as I release the mouse button. If I manually move or resize the window, it then works fine.
    If I remove setLocationByPlatform(true), the menu bar works, but it does not position the window by platform, which is the desired behavior.
    Am I doing something wrong, is there something wrong with both twm and e17, or is this a bug?
    import java.awt.Dimension;
    import java.awt.Label;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JFrame;
    import javax.swing.JMenuBar;
    import javax.swing.JMenu;
    import javax.swing.JMenuItem;
    import javax.swing.WindowConstants;
    public class Test extends JFrame {
        public Test() {
            super();
            setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
            getContentPane().add( new Label( "Hello World" ) );
            JMenuBar mainMenu = new JMenuBar();
            setJMenuBar( mainMenu );
            JMenu helpMenu = new JMenu();
            mainMenu.add( helpMenu );
            helpMenu.setMnemonic( 'H' );
            helpMenu.setText( "Help" );
            JMenuItem help_about = new JMenuItem();
            helpMenu.add( help_about );
            help_about.setMnemonic( 'A' );
            help_about.setText( "About" );
            help_about.addActionListener(
                new ActionListener() {
                    public void actionPerformed( ActionEvent evt ) {
                        System.out.println( "HELP!" );
            pack();
            setLocationByPlatform( true );
            setVisible( true );
        public static void main( String[] args )
            throws Exception {
            java.awt.EventQueue.invokeLater(
                new Runnable() {
                    public void run() {
                        Test test = new Test();
    }

    In 10.1.3, there's an option to disable the splash screen on the Environment Page in preferences (although, of course, it's not much use if you never get to the main window because of the dialog popping up behind the splash screen... :) )
    The bug with the dialog appearing behind the splashscreen is fixed in the upcoming 11g release. FWIW, it's a problem that appears to be unique to X-based systems, where for some reason the splashscreen window ends up with some super-ueber topmost property that forces all other windows to go behind it.
    There's also a command line flag to suppress the splashscreen in 11g.
    Thanks,
    Brian

  • Problem with:error: java.lang.ClassFormatError: Truncated class file

    Hello, I created an simple applet writing "hello world". Now I would like to add *.class file to my serwer witch I've implemented on microcontroller P89C51RD2BN.
    Serwer is programmed with hex file which is created after compiling C source files. In this case I converted .class file to array in C (using hexedit program). When I am (using IE ) browsing my serwer Html site is loading corectly and *.class file is send from serwer also corectly (define arrays are transfered corectly) but applet is not initiated. When I am runnig Java console I can see this:
    error: java.lang.ClassFormatError: Truncated class file
    When I am runnig the same site with the same class file on my PC everything is ok.
    I would be greatfull for any help. Thx. (sorry for my English :P )

    Not too familiar with native compilation, which I believe you are trying to accomplish here. It would appear that you don't have any problems running your applet, more or less running it after being converted to legacy code. Try the "native methods" forum under "Fundementals/Key Classes", this may be helpful. Sorry for not being too helpful.

Maybe you are looking for

  • Some questons about z61t

    Hello everybody recently I got for myself a z61t-9443. I don't want this laptop to be a replacement of my desktop, I would like to upgrade it abit but my knowledge around laptops is really poor. So here are some questions. Questions about mini-pcie 1

  • Creating Screen Caps

    Can anyone help me to create a screen cap from one of my films and use that as a picture file. I have found how to create a freeze frame but is there a way to turn that freeze frame into a picture file or a screen cap . And Im not sure if its easier

  • How to update Photoshop CC?  C Cloud says I'm up to date -- but I'm not!

    Creative Cloud says all apps are up to date.  But Photoshop CC is only version 14.0, not 14.2.  In PS if I check for updates, Adobe Application Manager says all apps are up-to-date. Online chat help today had me reinstall Adobe Application Manager an

  • How to create a  popup windows

    Hi I have seen in Simon Collins application http://apex.oracle.com/pls/apex/f?p=20411:1:888811517916461 a popup windows. Can anyone help me, buil a popup windows like that or is there any tutorial where i can see how its done. Tanks

  • Automatic filling of 0fiscyear depending on 0fiscper

    Hi Folks, This is related to Variables. We have a variable screen which has 0fiscper & accepts value from user. How can we have a global variable to all queries that reads 0fiscper and fills 0fiscyear ? Regards, Manoj.