• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java conn. to Mysql fails - problem with rights?  RSS feed

 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same java program runs fine with Mysql under Windows, therefore I suspect this to be a problem of ownership/rights in Linux?
I am using Linux Suse 8.1 and downloaded the Driver and made my CLASSPATH show to:
/usr/java/j2sdk1.4.1_01/jul/mysql-connector-java-2.0.14/mysql-connector-java-2.0.14-bin.jar
I also tried without different result:
/usr/java/j2sdk1.4.1_01/jul/mysql-connector-java-2.0.14/mm/org/gjt/mysql/Driver.class
If I try to make my java program Dbtest connect to mysql, I get:
Exception: org.gjt.mm.mysql.Driver
My settings are in /etc/profile.local.
My path looks like this:
export PATH=$JAVA_HOME/bin:usr/bin:$PATH
My mysql is in:
usr/bin/mysql
I am a bit confused about what to try next
(I am still somewhat new to Linux).
Any suggestions are most apreciated!!!
Thanks a lot
Juliane
[ January 20, 2003: Message edited by: juliane gross ]
 
Greg Harris
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have to include a username and password when accessing mysql in linux...
Class.forName( "org.gjt.mm.mysql.Driver" );
String user = "greg", passwd = "xxx" ;
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost:3306/databasename", user, passwd ) ;
i also had a problem with my table/database names and case-sensitivity in linux... my table name is "Properties" and in windows i could write "properties" in my code... buy in linux i had to make the "P" uppercase for it to work.
 
juliane gross
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, Greg.
I just managed to connect - juhuuu!
it was indeed something wrong with the spelling, but not in the java file but in my classpath..
Besides, I put the bin.jar in the lib directory of my java environment (I read this in a book).
I know this was bad (to change two things at the same time) because now I don't know if it would have been working in the other directory as well, but hell, it's working and I don't care..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!