File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes JDBC driver for mysql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "JDBC driver for mysql" Watch "JDBC driver for mysql" New topic
Author

JDBC driver for mysql

Rashmi Uttarkar
Greenhorn

Joined: Sep 16, 2004
Posts: 2
I am trying to establish a connection to mysql thru weblogic 8.1. I have configured mysql and added the mysql jdbc driver to the
classpath. When I try to create a connection pool weblogic gives me the
following error - 'jdbc driver not in classpath'. I have rechecked my
classpath. Everything seems to be in place. Can somebody please help?
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,

add the mysql jdbc driver to the weblogic classpath not the OS classpath. To do this edit the startWeblogic script you can do something like this:

if you place the mysql driver under, for example:
%WL_HOME%\server\lib\

then you can create a line on the startWeblogic script as:

set MYSQL_CLASSPATH=%WL_HOME%\server\lib\mysql_jdbc.jar

then edit the classpath line on the script to include the MYSQL_CLASSPATH:
Rashmi Uttarkar
Greenhorn

Joined: Sep 16, 2004
Posts: 2
Hi Marcos,

I have tried that too. I have tried all stunts, but it just wont work!!!

Rashmi...
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,

that's weird. I have an application running on Weblogic/Mysql and that did work for me.
Ner min
Ranch Hand

Joined: Sep 14, 2005
Posts: 76
hi,

i have the same problem and it simply dont work
in my startWLS.cmd file
i added this line
set MYSQL_CLASSPATH=%WL_HOME%\server\lib\mysql-connector-java-3.1.11-bin.jar
and replaced this line
set CLASSPATH=%MYSQL_CLASSPATH%;%JAVA_HOME%\lib\tools.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%CLASSPATH

but according to doc this file istn read att all (at least by default bewWL installation) instead the file %WL_HOME%\samples\domains\workshop\startWebLogic.cmd is read
so i placed thos two lines there too and again nothing happand.
hence in
%WL_HOME%\samples\domains\workshop\startWebLogic.cmd

is one line
echo CLASSPATH=%CLASSPATH%

but when i look at the output of cmd(which starts the beaWL)
there is no C:\mysqlconnectorjava3111\mysql-connector-java-3.1.11-bin.jar entry in the classpath although i set it via rightclick on mycomputer->propertis->advenced->env.vars...

i simply dont know which classpath is takeing and where to set it


im running beaWL 8.1 sp3 on w2k sp3

i was able to make a connection via JDBC in DBVisualiser and there C:\mysqlconnectorjava3111\mysql-connector-java-3.1.11-bin.jar worrked. But there was clear question wher to look for jdbc-driver, so i pointed to C:\mysqlconnectorjava3111\mysql-connector-java-3.1.11-bin.jar and there was no problem.
But which(where) is the classpath for beaWL?

please, can anyone help?
[ October 21, 2005: Message edited by: Ner min ]
Davinder Pal Singh
Greenhorn

Joined: Nov 15, 2005
Posts: 1
I am also facing the same issue
jdbc driver not in classpath for mysql when trying to create a connecion pool in weblogic
I have put the mysql-connector-java-3.1.11 in C:\bea\weblogic81\server\lib.

and modified the startweblogic.cmd to make it working..

but it does not help

can someone please tell what the issue is??

Thanks,#
Davinder
Santosh Maskar
Ranch Hand

Joined: Jul 02, 2003
Posts: 226
Add driver jar file into the
\\beasp5\weblogic81\samples\domains\workshopset\DomainEnv.cmd

for eg.
set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%;c:\mysql\mysql_jdbc.jar

after adding the jar file into the classpath you can see the Weblogic console whether your newly added jar files is listed into the server classpath
or you can print the classpath using echo %classpath%


This wokrs fine on my box : WIN2K/WLS8.1SP5
Chris Wash
Greenhorn

Joined: Aug 23, 2004
Posts: 16
weblogic actually edits the startWeblogic.sh/.bat script, so it's probably not a good idea to put anything in there. setDomain.env is a good spot to put your check, you can also put your reference in the /bea/user_projects/domains/wls/_cfgwiz_donotdelete/startscript.xml, which gets merged at runtime as well, ie:

Md. Atif Rasheed
Greenhorn

Joined: Aug 23, 2007
Posts: 2
hey guys i know that the solution to this issue is very late but i feel it may help someone.I have a solution for this problem and its working fine now.

To get the mySQL driver in the classpath of the weblogic server look in the following path for a file commEnv.cmd.

You can find it in d:\\bea\weblogic81\bin\commEnv.cmd

When you open it you will find lot of stuff. Add this at the end of classpath line.

;%WL_HOME%\server\lib\mysql.jar here mysql.jar contains jdbc driver.

and copy the jar file in lib folder of the weblogic server

d:\\bea\weblogic81\server\lib\mysql.jar

and start the weblogic server.It will work fine.

My email id:mdatif07@yahoo.co.in

Byeeee

[ August 23, 2007: Message edited by: decent dude ]
[ August 23, 2007: Message edited by: decent dude ]
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
Hi decent dude,

Your post definitely saved my day! I was trying to add a custom JAAS LoginModule for JMX in WebLogic and was also having classpath issues.

Your solution works very well! Thank you very very much.

Paul


SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
Ken Rubin
Ranch Hand

Joined: Mar 08, 2004
Posts: 66
Dear Atif,

Your advice is continuing to help others. You receive Kudos royalties

Thanks,

Ken
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3716
    
    5

"Atif"

Your name still does not conform to the JavaRanch Naming Policy. Please review the policy and update it appropriately. This is your second warning.

Scott


My Blog: Down Home Country Coding with Scott Selikoff
Priyesh Beohar
Greenhorn

Joined: Sep 09, 2009
Posts: 1
Thanks...
I also successfully connected
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

This post is 5 years old. But we are glad that it helped you.


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Indrayani Bhoir
Greenhorn

Joined: Dec 02, 2002
Posts: 21
Thanks ..it is really helpful
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JDBC driver for mysql