CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 JDBC MySQL Driver

Print topic Send  topic

Author Message
dekacode

Posts: 53
Posted: 07/08/2004, 4:07 PM

How to use the same JDBC MySQL Driver properties on Linux & Windows (see below)?

Currently different connection strings for Windows XP and Linux are required.
Using "org.gjt.mm.mysql.Driver" on Windows produces the following error:
"CCLogger [08-07 03:27:54.171] ERROR: Can't register JDBC driver: org.gjt.mm.mysql.Driver, Exception: java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver"

Properties
LINUX (JDBC):
JDBC Driver: org.gjt.mm.mysql.Driver
Database URL: jdbc:mysql://host/database_name

WINDOWS (ODBC):
JDBC Driver: sun.jdbc.odbc.JdbcOdbcDriver
Database URL: jdbc:odbc:<DSN_name>

CLASSPATH
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\servlet.jar;
C:\j2sdk1.4.2_04\jre\lib\ext\mysql-connector-java-3.0.14-production-bin.jar;

View profile  Send private message
Anton
Posted: 07/16/2004, 1:14 AM

That's odd I have:

JDBC Driver: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://localhost/yourdb

and mysql308.jar in the shared libs directory of TomCat.

This is true for both the Windows and Linux settings.

Anton
dekacode

Posts: 53
Posted: 07/16/2004, 1:57 PM

Anton,
ENV:
Ant 1.6.1
Tomcat 1.4
connector/J 3.0.14

The error msg below is generated when mysql3014.jar is in the Tomcat shared libs folder.

call "C:\apache-ant-1.6.1\bin\ant.bat" -buildfile "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~TaskManager1\CCSBuild\build.xml" -logfile "C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\~TaskManager1\CCSBuild\build.log"

Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.0
optional: 1.6.1
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\mysql3014.jar
Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.0
optional: 1.6.1
C:\Program Files\Apache Group\Tomcat 4.1\common\lib\mysql3014.jar

Error:
BUILD FAILED
For additional information please see the above messages.
View profile  Send private message
Anton
Posted: 07/20/2004, 2:53 AM

How even more odd, do you have any jars in ANT_HOME\lib sub-dir which belong to previous Ant 'optional.jar' installations?

Try renaming the Ant installation and installing ant clean again.

You must be picking up jar files from unexpected places due to application servers having their own way to load jars/classes.

I use DbVisualizer because of these problems. It's Java and you can run it first on your *indows box and then on the *inux box. You can then be sure of the class paths and user connection settings which will work.

The 'Driver Manager' feature is rather good at finding redundant and old driver files. Go for ADD CLASSPATH to search - extremely useful.

I use Java 1.4.x so Ant XML DOM requirements are not a problem.

Anton
rabindra
Posted: 08/05/2004, 1:11 AM

i still need mysql jsp connection in Tomcat server by "com.mysql......"and "org.gjt.........."
kundan
Posted: 08/10/2004, 8:09 AM

sir
Exception: com.mysql.jdbc.Driver the error are occured .i canot slove this problem. my classpath is correct. i have also installed the mysql jdbc connector.gives the write path in system variable.
but now i cannot slove the problem. please help me. tell me what i am doing
kundan
Dark Vader
Posted: 08/26/2004, 2:27 AM

:-)

The biggest mistake people make (including me) is to import the mysql driver in the package.

Solution : import the driver in the project...
Have fun


Jonny Boy
Posted: 09/23/2004, 2:22 AM

ENV:
JDBC Driver: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://localhost/mydb
have included the mysql.jar file in my web/libs folder

I have a web app that runs perfectly ok on windows on my home PC, but when I upload it to my hosting site (shared JVM) running under Unix, I get the following;

Exception: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"

dekacode

Posts: 53
Posted: 09/23/2004, 10:38 AM

The name of the class that implements java.sql.Driver in MySQL Connector/J is 'com.mysql.jdbc.Driver'. The 'org.gjt.mm.mysql.Driver' class name is also usable to remain backwards-compatible with MM.MySQL.

Look in the Cpanel "MySQL Databases Manager" for the
JDBC connection string on your server:

Connection connection = null;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://localhost/<DB>?user=<USER>&password=<PASSWORD HERE>");
View profile  Send private message
dekacode

Posts: 53
Posted: 10/16/2004, 2:22 PM

Put jar in your classpath, either by adding the
FULL path to it to your CLASSPATH enviornment variable, or putting it
in $JAVA_HOME/jre/lib/ext.

If you are using a servlet engine or application server, you will have
to read your vendor's documentation for more information on how to
configure third-party class libraries, as most application servers
ignore the CLASSPATH environment variable. If you are developing
servlets and/or JSPs, and your application server is J2EE-compliant,
you should put the driver's .jar file in the WEB-INF/lib subdirectory
of your webapp, as this is the standard location for third party
class libraries in J2EE web applications. You can also use the
MysqlDataSource, MysqlConnectionPoolDataSource or MysqlXADataSource
classes in the org.gjt.mm.mysql.jdbc2.optional package, if your J2EE
application server supports/requires them. MysqlDataSource supports the
following parameters (through standard "set" mutators):
View profile  Send private message
sbwtxj
Posted: 10/26/2004, 10:22 AM

Quote Anton:
How even more odd, do you have any jars in ANT_HOME\lib sub-dir which belong to previous Ant 'optional.jar' installations?

Try renaming the Ant installation and installing ant clean again.

You must be picking up jar files from unexpected places due to application servers having their own way to load jars/classes.

I use DbVisualizer because of these problems. It's Java and you can run it first on your *indows box and then on the *inux box. You can then be sure of the class paths and user connection settings which will work.

The 'Driver Manager' feature is rather good at finding redundant and old driver files. Go for ADD CLASSPATH to search - extremely useful.

I use Java 1.4.x so Ant XML DOM requirements are not a problem.

Anton
:-D :-D
My question is the same.I had setup these JAVA_HOME,ANT_HOME,CANALITA_HOME andCLASSPATH
But my environment is CCS2.3.2.24,ANT1.6.2,J2SDK1.4.2_06,TOMCAT5.0.28.

Pls see the following,WHY!!!!!!!!
-------------------------------------------------------------------------------------
Generating "customers_list"
Generating "customers_maint"
Generating "Footer"
Generating "Header"
Generating Common Files
call "C:\apache-ant-1.6.2\bin\ant.bat" -buildfile "C:\DOCUME~1\sbw\LOCALS~1\Temp\~testJsp2\CCSBuild\build.xml" -logfile "C:\DOCUME~1\sbw\LOCALS~1\Temp\~testJsp2\CCSBuild\build.log"

Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.1
optional: 1.6.2
Invalid implementation version between Ant core and Ant optional tasks.
core : 1.6.1
optional: 1.6.2

Error:
BUILD FAILED
For additional information please see the above messages.
Gnanaprakash
Posted: 11/29/2004, 11:19 PM

set the ant-nodeps.jar in classpath in the beginning of classpath immediately after ant.jar.This will solve ant conflict problem.
Ganesh
Posted: 11/30/2004, 12:33 AM

hi,
can i access a db without creating a DSN?
pls send some piece of code with both oracle and sql server?
Neeraj
Posted: 12/02/2004, 9:13 AM

please tell me how to establish database connection pooling stepwise in tomcat + my sql

it would be better if you tell me in ms sql server

please it's urgent, Thanks in advance
mrachow


Posts: 509
Posted: 12/02/2004, 9:18 AM

After my best of knowledge connection pooling is done per default in Studio generated code.

_________________
Best regards,
Michael
View profile  Send private message
enji
Posted: 12/15/2004, 12:34 AM

Dear All,
I want to ask how can I insert database in arabic

Thank you
Enji
somu
Posted: 01/24/2005, 4:25 AM

Dear all,
Can you help in how to configure the third party JDBC Driver in Tomcat

Thank you,
somu
somu
Posted: 01/24/2005, 4:26 AM

Quote somu:
Dear all,
Can you help in how to configure the third party JDBC Driver(ie MYSQL) in Tomcat

Thank you,
somu
HARITHA
Posted: 02/09/2005, 12:51 AM

O:)
Hi,
Please tell how i can establish the connection for mysql in jsp and how i can more than 5 records for a single table in mysql front
aaaa
Posted: 02/16/2005, 3:43 AM

:-| ;-) :-) :( :-D 8-) :*) :-{} :-X :-O :-@ O:) :-P :-< :-( :-| ;-)
Giri
Posted: 03/10/2005, 6:15 AM

Hi iam getting this error "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" while trying to run the program from the command prompt. I have configured the system variable./ user varialabe for CLASSPATH and the same program is working if i run from edit plus. What could be the problem ??
shail
Posted: 03/14/2005, 7:24 AM

hi everybody can anybody tell me how to connect mysql to jdbc and how to set classpath for mysql driver and i m getting clssnotfound error.plz help me out
anusooya
Posted: 03/29/2005, 1:33 AM

Hi,
I saw you in sun forum.
Can you please send the coding for accessing a DB without creating DSN?
Thanking you in advance,
Anu.
vasudha
Posted: 03/31/2005, 9:57 PM

Quote kundan:
sir
Exception: com.mysql.jdbc.Driver the error are occured .i canot slove this problem. my classpath is correct. i have also installed the mysql jdbc connector.gives the write path in system variable.
but now i cannot slove the problem. please help me. tell me what i am doing
kundan
vasudha
Posted: 03/31/2005, 10:02 PM

Quote Jonny Boy:
ENV:
JDBC Driver: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://localhost/eci?user=eci & password=eciindia");
I have included the com folder in the folder where i had store all my jsp programs. i am getting an Exception.

Exception: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"

Please help me to run my programs.
vasudha
Posted: 03/31/2005, 10:10 PM

Quote Anton:
That's odd I have:

JDBC Driver: com.mysql.jdbc.Driver
Database URL: jdbc:mysql://localhost/yourdb

i donot have mysql308.jar in the shared libs directory of TomCat.
what should i do.
please help

This is true for both the Windows and Linux settings.

Anton
jsp
Ameen
Posted: 04/04/2005, 2:56 AM

any one can help me connenting JSP with mySQL ,thanx
amit bajpai
Posted: 04/19/2005, 10:53 PM

how to connect mysql and jsp in linux
kuldeep
Posted: 04/26/2005, 2:22 AM

hello frnds

i do have in configuring the mysql

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) {
// handle the error
}
}


it gives the exception:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver


and using the following also

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
... try {
Connection conn = DriverManager.getConnection( "mysql","username","password");
....
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}


gives the same exception:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

i have included the .jar file of the driver in to the web-inf/lib of the Tomcat and also in to the Java Home directory i.e. jre/lib/ext ....
and still facing these problems

plz do help me
kalaboso
Posted: 06/02/2005, 10:53 PM

im having problems connecting to mysql it says java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

i copied the following jar files in the C:\jakarta-tomcat-5.5.9\common\lib and also in C:\jakarta-tomcat-5.5.9\webapps\ROOT\WEB-INF\lib

JAR FILES:
mysql-connector-java-3.1.8-bin-g
mysql-connector-java-3.1.8-bin
aspectjtools
aspectjrt
jta-spec1_0_1
jdbc2_0-stdext

my classpath is .;
C:\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar;
C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.jar;
C:\Servlets+JSP;
..;
..\..;
C:\jakarta-struts-1.2.4\lib\struts.jar;
C:\jakarta-tomcat-5.5.9\common\lib\mysql-connector-java-3.1.8-bin.jar;
C:\jakarta-tomcat-5.5.9\webapps\ROOT\WEB-INF\lib\mysql-connector-java-3.1.8-bin.jar;
C:\jakarta-tomcat-5.5.9\webapps\ROOT\WEB-INF\lib\mysql-connector-java-3.1.8-bin-g.jar;
C:\mysql-connector-java-3.1.8.jar;
C:\jakarta-tomcat-5.5.9\common\lib\mysql-connector-java-3.1.8-bin-g.jar

my path is C:\j2sdk1.4.2_08\bin;%PATH%
my JAVA_HOME is C:\j2sdk1.4.2_08


installed programs
C:\j2sdk1.4.2_08
C:\jakarta-tomcat-5.5.9
C:\mysql-4.0.24-win
C:\mysql-connector-java-3.1.8

i have dozens of classpaths and severral copies of the jar files in different locations specified in the classpath but still it cant locate the driver. please help
 Page 1 of 2  Next Last


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.