This content has been marked as final. Show 35 replies
Hmm normally this shouldn't compile without errors:
because you have to escape the backslash '\' like this:
String chemin = "Database\Elcire.mdb";
On Linux the path seperator is not the backslash...it is the slash '/'
String chemin = "Database\\Elcire.mdb";
Maybe you try:
Note that you don't have to escape the slash!
String chemin = "Database/Elcire.mdb";
I would also check the path to the file.....if it is in let's say:
/home/user/Database/Elcire.mbd than you should edit your code accordingly.
Otherwise I would suggest that maybe the driver is not the correct one?
But I am not sure on that....
hope that helps....
Message was edited by:
My guess: you have neither ODBC running nor a Microsoft Access ODBC driver installed on your non-Windows machine ...
good point... is it possible to install the mdb driver on a linux machine?
btw, i just quickly edited those slashes in as i had it as something else.
ur not going to believe this, but the database is located here:
if i cant use that database, i have a mysql 1 running which i cant figure out how to connect too.
Can anyone help me with this one?
Message was edited by:
The last time I installed ODBC on a Linux machine, I got sick of it ... it might have improved since then, though. Not sure about Access drivers for Linux, but I'd try to replace Access by another DBMS ...
alrighty then lets forget the microsoft database.
I found an example of connecting to a mysql database, but i got a class not found exception.
Ill get the error message for ya in a sec.
and heres my code
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at Server.<init>(Server.java:47) at Server.main(Server.java:33)
Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost/elcire", "#####","#####");
Download the mysql driver package and put it into your classpath.
The program can not find the JDBC - Driver witch is needed to
connect to the mysql database.
You have to download the jdbc mysql driver and put it into your classpath,
so that java can find it....
ahh i c.
... whats the classpath? im guessing its the lib folder but i wouldnt bet my life on it
Maybe you try this:
My java is installed into: /usr/lib/jvm/sun-jdk-1.6/
Threre is a subfolder 'lib' (/usr/lib/jvm/sun-jdk-1.6/lib/)
You can download the jdbc driver extract the files and locate the .jar in it.
Copy this .jar file to the lib directory.....should work.....
thanks allot. Ill post back if it works/doenst work...so ill post back no matter what :P
i put the jar file here:
the jar file is named mysql-connector-java-3.1.14-bin.jar. is it supposed to be named something different?
but i still got the same error java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at Server.<init>(Server.java:47) at Server.main(Server.java:33)
Hmm I see...
Does the output of:
contain the same version string than the directory?
n3bul4@Omega ~ $ java -version java version "1.6.0" Java(TM) SE Runtime Environment (build 1.6.0-b105) Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode)
Maybe you have more than one virtual machine running?
I see what you mean, altho i dont see how i could have more than 1 running. i maped a network drive from my windows computer and searched it, and the only .jar files that came up where in that directory. heres the directory listing:
and this is my java version:
root@GlenServer:/usr/lib/j2re1.5-sun/lib# ls applet fontconfig.RedHat.bfc jsse.jar audio fontconfig.RedHat.properties.src jvm.hprof.txt charsets.jar fontconfig.Sun.2003.bfc locale classlist fontconfig.Sun.2003.properties.src logging.properties cmm fontconfig.Sun.bfc management content-types.properties fontconfig.Sun.properties.src mysql-connector-java-3.1.14 deploy.jar fontconfig.SuSE.bfc mysql-connector-java-3.1.14-bin.jar ext fontconfig.SuSE.properties.src mysql-connector-java-3.1.14.tar flavormap.properties fontconfig.Turbo.8.0.bfc net.properties fontconfig.bfc fontconfig.Turbo.8.0.properties.src oblique-fonts fontconfig.properties.src fontconfig.Turbo.bfc plugin.jar fontconfig.RedHat.2.1.bfc fontconfig.Turbo.properties.src psfontj2d.properties fontconfig.RedHat.2.1.properties.src fonts psfont.properties.ja fontconfig.RedHat.3.bfc i386 rt.jar fontconfig.RedHat.3.properties.src im security fontconfig.RedHat.8.0.bfc images sound.properties fontconfig.RedHat.8.0.properties.src javaws zi fontconfig.RedHat.9.0.bfc javaws.jar fontconfig.RedHat.9.0.properties.src jce.jar
java version "1.5.0_11"
Hmm I am not sure if I get you rigth.....
Do you mean you are using a windows vm mounted into your linux system?
This won't work because you have to use the linux vm on linux....
Sry if I got you wrong here....
try to enter the command: java -version in your system shell...
What does it say?
It is possible that more than one vm is installed on your linux box already.....but this is just an asumption.