Weblogic 10.3 & MySQL Connector
Hello everyone!
I use Windows 7 Professional 64x and try to install MySQL connector for Weblogic server, copied mysql-connector-java-commercial-5.1.14-bin.jar to wlserver_10.3\server\lib directory and start my domain. I get an error "Failed to load Main-Class manifest attribute from mysql-connector-java-commercial-5.1.14-bin.jar [https://docs.google.com/file/d/0B5vWbjiK4UUbZGZCdlpWMUVHN2M/edit?usp=sharing]
Could anybody help me to solve this problem?
just putting it in the directory doesn't get WLS to add it to the classpath.
Edit you domain's bin\setDomainEnv script, and add that jar (full path name)
the the CLASSPATH that script creates.
Similar Messages
-
Hello, please i am new to Jdeveloper and weblogic servers and i developed an application using jdeveloper and when i try to run the application it brings up this error message
"*** Using HTTP port 7101 ***
*** Using SSL port 7102 ***
C:\Users\Lucky\AppData\Roaming\JDeveloper\system11.1.2.3.39.62.76.1\DefaultDomain\bin\startWebLogic.cmd
[waiting for the server to complete its initialization...]
\Java\jdk1.6.0_02\jre\lib\ext\mysql-connector-java-5.1.16-bin.jar was unexpected at this time.
Process exited."
I tried deleting the jdk1.6.6.0_02 and tried it again but it still did not run, I also uninstalled the JDeveloper and weblogic server and reinstalled them but the error message still pops up. Please i need help to fix this.
Thanks.
Edited by: Chinedu on Feb 21, 2013 8:48 AMAndrew,
Thanks for the lightning response... but the problem has been solved.
I rebooted again, and installed again (didn't download again because the filesize checked out) and now it works fine, and I'm none the wiser as to the root cause of the problem, except that rt.jar has magically appeared:
C:\Users\Administrator>dir "C:\Program Files\Java\jre6\lib\*.jar"
Volume in drive C has no label.
Volume Serial Number is 00AC-1BC7
Directory of C:\Program Files\Java\jre6\lib
08/11/2009 06:38 PM 6,685,813 charsets.jar
08/11/2009 06:38 PM 2,989,538 deploy.jar
08/11/2009 06:38 PM 716,841 javaws.jar
08/11/2009 06:38 PM 88,256 jce.jar
08/11/2009 06:38 PM 558,189 jsse.jar
08/11/2009 06:38 PM 382 management-agent.jar
08/11/2009 06:38 PM 1,704,664 plugin.jar
08/11/2009 06:38 PM 1,115,985 resources.jar
08/11/2009 06:38 PM 44,295,255 rt.jar <<<<<<<<<<<<<<<<<<
9 File(s) 58,154,923 bytes
0 Dir(s) 115,454,173,184 bytes freeSOOOO... I presume that the installer failed on rt.jar, probably because something (something in my start-up, I suppose) was using the JRE while the instal was running... but I didn't do anything different the second time (to the best of my knowledge).
Thanks anyways... My hair (what's left of it) greatly appreciates your time.
Cheers. Keith. -
Weblogic 7.0 , MySQL 3.23 JDBC Connection Pools
i am using weblogic 7.0 and MySQL 3.23 and right now my objective is to create,
configure and test a JDBC
connection pool using the Administrative console.
Here is what i have done till now
- set the classpath of the MySQL driver in the startWLS.cmd like this
SET MYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar
set CLASSPATH=%MYSQL_DRIVER%;%CLASSPATH%
- using the weblogic administrative console i have created a new connection pool
named as
testpool.
- Here is what i have in the testpool general tab
Name: testpool
URL: jdbc:mysql//localhost:3306/test (test is the name of the database in mysql)
Driver Classname: org.gjt.mm.mysql.Driver
I have not entered any Properties, ACL Name, Password or Open String Password.
- Now i go the the Testing tab and enter a name of a table in my test database
and click on Apply
and on the command window i am getting the following exception
java.sql.SQLException No suitable driver
Thanks in advance,
AshishThanks a lot Slava. After reading your mail and the post i was able to get it working.
"Slava Imeshev" <[email protected]> wrote:
Hi Ashish,
I figured out what's the problem. URL in the connection pool
definition is malformed. It's
jdbc:mysql//localhost:3306/test
while the correct one should have colon after mysql:
jdbc:mysql://localhost:3306/test
Regards,
Slava Imeshev
"Ashish Sureka" <[email protected]> wrote in message
news:[email protected]...
I am sorry, the program that i posted here is not comming properlyformatted but
i am able to run a simple java program that connects to MySQL and alsoa
servlet
that connects to the MySQL. The only problem i am having is includingthe
MySQL
driver jar files to the weblogic server classpath.
Thanks,
Ashish.
"Ashish Sureka" <[email protected]> wrote:
Hello Joseph Weinstein,
Actually, i already tried the same approach that you have mentioned
in
your reply
before i posted my message here. Following is the program that i use
to check
MySQL connection.
import java.sql.*;
public class MySQLConnect
public static void main(String[] args) throws Exception
try {
Class.forName ( "org.gjt.mm.mysql.Driver" );
System.out.println ( "MySQL Driver Found" );
} catch ( java.lang.ClassNotFoundException e ) {
System.out.println("MySQL JDBC Driver not found ... ");
throw ( e );
String url = "";
Connection con = null;
try {
url = "jdbc:mysql://" + "localhost:3306" + "/" + "test";
con = DriverManager.getConnection(url);
System.out.println("Connection established to " + url + "");
} catch ( java.sql.SQLException e ) {
System.out.println("Connection couldn't be established to " + url);
String sqlStatement = "SELECT * FROM testtable";
try {
Statement s = con.createStatement();
s.execute (sqlStatement);
s.close ( );
} catch ( SQLException e ) {
System.out.println ( "Error executing sql statement" );
con.close();
The classpath that i use to run this program is
SET PATH=C:\bea\jdk131_03\bin
SETCLASSPATH=C:\bea\jdk131_03\jre\lib\rt.jar;C:\bea\weblogic700\ebcc\lib\ext\se
rvlet.jar;C:\CSC413\Demos\HelloApp\HelloAppJAR
SET CLASSPATH=%CLASSPATH%;C:\bea\weblogic700\server\lib\weblogic.jar
SETMYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java
-2.0.14-bin.jar
set CLASSPATH=.;%MYSQL_DRIVER%;%CLASSPATH%
I have also written a Servlet which checks the MySQL connection. For
the servlet
i added the MySQL driver jar files in the WEB-INF/lib directory ofthe
servlet
web application and it is working fine.
do you want me to attach the startWLS.cmd file that i changed to include
the MySQL
driver classpath.
Thanks for your replies,
Ashish.
Joseph Weinstein <[email protected]> wrote:
Ashish Sureka wrote:
When i start the weblogic server using the command prompt by executingthe startWLS.cmd,
i can see the classpath the server is using on the command window
and
that includes
the jar file for the MySQL driver but still it is throwing a
SQLException
and
saying that No Suitable driver.
How do i include a external library or jar file on the weblogic
server's
classpath.
is there a specific directory where i should put the MySQL driver
jar
file .
Thanks,
Ashish.No. Let's simplfy the problem. Please run a tiny standalone Java
program
that
just makes a JDBC connection to your MySQL DBMS, with no weblogic
code in the picture. When you succeed at this, show me the CLASSPATH
and
PATH of the shell that ran the program successfully, and show methe
few lines
of code that made the connection. Then we will know the problem.It
may
be that
the URL you're passing to the pool is not exactly correct for that
driver.
Joe
Joseph Weinstein <[email protected]> wrote:
Ashish Sureka wrote:
i am using weblogic 7.0 and MySQL 3.23 and right now my objective
is
to create,
configure and test a JDBC
connection pool using the Administrative console.
Here is what i have done till now
- set the classpath of the MySQL driver in the startWLS.cmd
like
this
SET
MYSQL_DRIVER=C:\mysqldriver\mysql-connector-java-2.0.14\mysql-connector-java
-2.0.14-bin.jar
set CLASSPATH=%MYSQL_DRIVER%;%CLASSPATH%
- using the weblogic administrative console i have created anew
connection
pool
named as
testpool.
- Here is what i have in the testpool general tab
Name: testpool
URL: jdbc:mysql//localhost:3306/test (test is the name of
the
database
in mysql)
Driver Classname: org.gjt.mm.mysql.Driver
I have not entered any Properties, ACL Name, Password or
Open
String
Password.
- Now i go the the Testing tab and enter a name of a table in
my
test
database
and click on Apply
and on the command window i am getting the following exception
java.sql.SQLException No suitable driverWatch the first lines that the server prints out when the script
starts
it. The script
shows the classpath that was constructed for the server. It is
likely
that you need
to do something else to ensure your driver is really in the classpath
the server uses.
Joe
Thanks in advance,
Ashish -
How to include the mysql-connector in a simple .jar file
Well I started up with java again. Just messing around. This project I'm making now is just plain simple, I have a program thats going to read a table in a database from a server I have here at home. It works fine if I do like this: java javafil to run the file, it reads from the database fine.
But when I made a .jar file out of it using this command: jar cmf manifest.txt javafile.jar *.class
It won't connect to the database. Or it doesn't print out the rows in the table. So I thought I have to include the mysql-connector with the .jar.
manifest.txt
Main-Class: javafile
Now what is an easy way to do this?
This program is also going to be run from a computer that might not have the mysql-connector installed on the computer. Like a friend of mine wants to connect to the database and read it.
I've tried to google "mysql connector in a .jar file" but I get tons of informations about the mysql-connector.jar instead of what I'm looking for.
Thanks,
Torbj�rn Svae
Edited by: LordSvae on 19.jun.2008 14:52LordSvae wrote:
Yeah but the other computer might not have that connector file on their computer. So is there like I way I can use it when it is in the .jar file? Thats kinda what I wanted. You cannot include another JAR in a JAR file. You however can extract it and put the classes in your JAR. Verify the license agreement if it is allowed. Although this is considered as a bad practice (poor upgradebility and maintainability).
If you don't want to use the -cp parameter, then use the class-path entry of the manifest.mf of your JAR. You can also write a batch file with the whole JAR -cp command in a single line and run the batch file instead.
Pluss, even though I have the right classpath in the environment variables set, it doesn't work for me either. So I guess it doesn't load the connector when running the .jar file.The classpath environment variable has nothing to do with running JAR's. Forget about it and use the -cp or -classpath parameter. -
Using mysql-connector-java-5.0.5 from oracle's java procedure.
I need to write the java procedure in Oracle, which will get connection to mySQL server and put some data into it. I am using official mysql-connector-java-5.0.5 driver for this job. Java class for this job work well outside the Oracle. The problem is:
When I try to import jar file of mysql connectior it fail son resolving inside the Oracle db. How can I get access to mysql from Oracle?Thanks for this quick reply!!
--When adding a connection and clicking 'Test' in the end of the wizard or when right-click on the connection and click 'connect'.
Also, I've just noticed this: when I start IDE using jdev.exe I'm getting:
java.lang.NullPointerException at oracle.jdevimpl.cm.dt.DatabaseAddin._registerIDEObjects(DatabaseAddin.java:353)
at oracle.jdevimpl.cm.dt.DatabaseAddin.initialize(DatabaseAddin.java:155
at oracle.ideimpl.extension.AddinManagerImpl.initializeAddin(AddinManage
rImpl.java:425)
at oracle.ideimpl.extension.AddinManagerImpl.initializeAddins(AddinManag
erImpl.java:240)
at oracle.ideimpl.extension.AddinManagerImpl.initProductAndUserAddins(Ad
dinManagerImpl.java:154)
at oracle.ide.IdeCore.initProductAndUserAddins(IdeCore.java:1431)
at oracle.ide.IdeCore.startupImpl(IdeCore.java:1196)
at oracle.ide.Ide.startup(Ide.java:674)
at oracle.ideimpl.Main.start(Main.java:49)
at oracle.ideimpl.Main.main(Main.java:25)
Does not look right to me.
I've never tried to add a DB connection under this IDE installation earlier.
Just yeasterday I've created a project with some DB related (mySQL and Hibernate) libraries, although it compiled fine. -
PreparedStatements and MySQL Connector/J
Hi All,
I was wondering what is the exact SQL statement that is passed to MySQL server when we use PreparedStatements. I was trying using MySQL Connector/J, type4 driver. I tried with a simple servlet
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<head>");
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost/mydb?user=root","root","");
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Connection con=DriverManager.getConnection("jdbc:odbc:test");
PreparedStatement pst=con.prepareStatement("select * from AS_ITM where ID_ITM=?");
out.println("PreparedStatement = "+pst);
out.println("<br>");
pst.setString(1, "10");
out.println("PreparedStatement = "+pst);
//ResultSet rs=pst.executeQuery();
con.close();
}catch(Exception e){
out.println(e);
out.println("</head>");
out.println("<body>");
out.println("</body>");
out.println("</html>");
Here I am printing PreparedStatement object's generated SQL twice and not even executing the query.
And the result is:
PreparedStatement = com.mysql.jdbc.PreparedStatement@19f3736: select * from AS_ITM where ID_ITM=** NOT SPECIFIED **
PreparedStatement = com.mysql.jdbc.PreparedStatement@19f3736: select * from AS_ITM where ID_ITM='10'
See second statement? I have not even sent it to the server.
So is this jdbc driver preparing a simple Statement before it is sent to MySQL server?
Is it what a jdbc driver is supposed to do? So then whats the use of PreparedStatement?Thanks,
KishorHi,
Just exactly what a JDBC driver is supposed to do with a PreparedStatement is not specified in JDBC I believe. I think they only requirement is that a PreparedStatement should be able to insert the various data types correctly into an SQL string.
I am fully aware that PreparedStatements should also be able to give a better performance, for instance by only sending the parameters when you use it the second time, and not the whole the SQL. But I think this is up to the database and driver implementation to decide whether to do this, and how.
Remember, the JDBC driver may be sending other information across to the database than the SQL. We can't see that from looking at the PreparedStatement only. You would have to use a network packet sniffer to see all data exchanged between the driver and the database
-Jakob Jenkov -
Hi,
I have enabled ssl on my mysql server and am using useSSL=true&requireSSL=true in my jdbc connector url.
I am getting the following error:
The root cause was that: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** com.mysql.jdbc.CommunicationsException MESSAGE: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** javax.net.ssl.SSLHandshakeException MESSAGE: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target STACKTRACE: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591) at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:187) at
If anyone had any success connecting to mysql via ssl I would appreciate any help.
Thanks!I used the mysql odbc connector with the certificate and it worked fine so
the problem is not the certificate.
2009/4/8 Alexei Yakovenko <[email protected]>
drieh,
>
A new message was posted in the thread "mysql connector & ssl":
>
http://forums.adobe.com/message/1877560#1877560
>
Author : Alexei Yakovenko
Email : [email protected]
Profile : http://forums.adobe.com/people/injun%20%5B576871%5D
>
Message: -
JSTL - MySQL Connector problem
Hello! I need your help. I don't actually know the reason, but *<sql:query>* doesn't work properly.
So I have such a code:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>
<sql:setDataSource var="datasource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/publish"
user="root" password="root"/>
<sql:query var="books" dataSource="${datasource}">
SELECT id, title, price FROM book
</sql:query>
<html>
<head>
<title>A First JSP Database</title
</head>
<body>
<table border="1">
<tr>
<td>id</td><td>title</td><td>price</td>
</tr>
<c:forEach items="${books.rows}" var="row">
<tr>
<td><c:out value="${row.id}" /></td>
<td><c:out value="${row.title}" /></td>
<td><c:out value="${row.price}" /></td>
</tr>
</c:forEach>
</table>
</body>
</html>The error I get when calling http://localhost:8080/DataAccess/bookList.jsp
org.apache.jasper.JasperException: Exception in JSP: /bookList.jsp:7
4: driver="com.mysql.jdbc.Driver"
5: url="jdbc:mysql://localhost:3306/publish"
6: user="root" password="root"/>
7: <sql:query var="books" dataSource="${datasource}">
8: SELECT id, title, price FROM book
9: </sql:query>
10: <html>May be the reason is that the subfolder WEB-INF is badly configured.
I have such subfolders in WEB-INF:
*/lib*
jaxen-full.jar
jdbc2_0-stdext.jar
jstl.jar
mysql-connector-java-3.0.9-stable-bin.jar
saxpath.jar
standard.jar
xalan.jar
xercesImpl.jar
xml-apis.jar
*/tld*
c-rt.tld
c.tld
fmt-rt.tld
fmt.tld
sql-rt.tld
sql.tld
x-rt.tld
x.tldThe question is what is configured or done incorrectly? I am not quite familiar with JSP and JSTL. Thank you for any help.
P.S I have already used MySQL. So it is set and configured as it is needed to be.ThomYork
It didn't help.
Just in case, I run tomcat 5.5.27-2 on Arch Linux; MySQL 5.0.77; Apache 2.2.11
I tried to put mysql-connector-java-3.0.9-stable-bin.jar into
/opt/tomcat/server/lib
/opt/tomcat/shared/lib
It didn't help.
bandarurm
After some manipulation i get such an error in my script:
*exception*
{noformat}org.apache.jasper.JasperException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}
*root cause*
{noformat}javax.servlet.ServletException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:89)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}
*root cause*
{noformat}javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused"
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:276)
org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:159)
org.apache.jsp.bookList_jsp._jspx_meth_sql_005fquery_005f0(bookList_jsp.java:130)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}
dsdsf
I tried this. I downloaded the example with the source and WEB-INF directory. It doesn't work.
Here is an error:
*exception*
{noformat}org.apache.jasper.JasperException: javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}
*root cause*
{noformat}javax.servlet.ServletException: javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:837)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspService(executeQuery_005fJstlSqlTag_jsp.java:116)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}
*root cause*
{noformat}java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:264)
org.apache.taglibs.standard.tag.common.sql.DataSourceWrapper.setDriverClassName(DataSourceWrapper.java:46)
org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:102)
org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag.doStartTag(SetDataSourceTag.java:67)
org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspx_meth_sql_005fsetDataSource_005f0(executeQuery_005fJstlSqlTag_jsp.java:137)
org.apache.jsp.executeQuery_005fJstlSqlTag_jsp._jspService(executeQuery_005fJstlSqlTag_jsp.java:88)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
{noformat}Nothing with sql query works. So it seems that the problem is in tomcat's configuration. -
Help registering driver mysql-connector-j
Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Hello Everyone, I keep on getting a java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
exception when I attempt to register the mysql-connector-j.
I'm just using the code from it's documentation:
public class LoadDriver {
public static void main(String[] args) {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) {
System.out.println(ex);
I have a CLASSPATH 'user' variable containing...
C:\JavaStuff; C:\mysql-connector-java-3.1.1-alpha\mysql-connector-java-3.1.1-alpha-bin.jar
Where JavaStuff is the location of the LoadDriver class. I have to fix this thing as soon as possible as I'm currently working on a project. Much help will be apprecieated. I have a feeling it may be somthing to do with the classpath!It is the classpath.
Do you really have a space after c:\javastuff? (You shouldn't.)
Is that really the path to the jar file? And does that jar file really contain the driver class?
I assume you are asking in the context of a Java application, which uses the CLASSPATH environment variable. Other possibilities (servlets, applets, executable jar files) have other ways of finding classes. -
JDBC MySQL Connector/J problems when using in applets
I wrote a piece of code which uses the MySQL Connector/J which worked in a normal shell application but when used in an applet it just didnt print anything. The code is:
import java.net.*;
import java.sql.*;
class DB {
static Connection c;
static Statement stmt;
static ResultSet to;
public static String[] getUsers() {
String str[] = new String[100];
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
catch (Exception E) {}
try {
c = DriverManager.getConnection("jdbc:mysql://localhost/PROGRAM?user=blah&password=blah");
stmt = c.createStatement();
to = stmt.executeQuery("SELECT usr_user FROM usr");
for(int i=0; to.next(); i++) str[i] = to.getString(1);
catch (SQLException E) {}
return str;
Is there a problem accessing a MySQL Database via an appletApplet runs out of a sandbox, if you print the exception, you'll see that you have run into security access violation:
catch (SQLException E) {
E.printStackTrace();
}This will tell you why your applet didn't print anything. Just a firendly advice, never try to catch something and don't display what was caught.
;o)
V.V.
PS: To solve, your problem, you can either sign the applet or use a policy file to grant the applet the required access right. -
[solved] MySQL Connector C++ 1.0.5
Hello everyone,
I'm trying to connect to a MySQL db via C++. MySQL has the connector and API available for this. In the process of building this I've run into some troubles/questions.
First off is that MySQL states that MySQL Workbench uses this connector:
MySQL wrote:Note that MySQL Workbench is successfully using MySQL Connector/C++.
source (at the bottom of the page) but I can't seem to find any files which are created by the connector itself.
Second is that when I create a package file it contains files that - I think - shouldn't be included (or at least not in those directories).
PKGBUILD used:
pkgname=mysql-connector-c++
pkgver=1.0.5
pkgrel=1
pkgdesc="MySQL Connector/C++ is a MySQL database connector for C++"
arch=(i686)
url="http://dev.mysql.com/doc/refman/5.1/en/connector-cpp.html"
license=('gpl')
depends=('mysql-clients')
makedepends=('cmake>=2.4' 'glibc>=2.2.3')
source=(http://download.softagency.net/MySQL/Downloads/Connector-C++/$pkgname-$pkgver.tar.gz)
md5sums=('f0ad6655f3ea7db8df3215fa928cba03') #generate with 'makepkg -g'
build() {
cd "$srcdir/$pkgname-$pkgver"
# remove file that is included in release but should be generated by cmake
rm cppconn/config.h
# remove some possible old cmake cache
rm CMakeCache.txt
# patch for use with gcc-4.4
patch -p0 < ${startdir}/mysql-connector-cpp-1.0.5-gcc44.patch
cmake -G "Unix Makefiles" .
make clean
make || return 1
make DESTDIR="$pkgdir/" install
# vim:set ts=2 sw=2 et:
output of pacman -Qlp mysql-connector-c++-1.0.5-1-i686.pkg.tar.gz
mysql-connector-c++ /usr/
mysql-connector-c++ /usr/local/
mysql-connector-c++ /usr/local/ANNOUNCEMENT
mysql-connector-c++ /usr/local/COPYING
mysql-connector-c++ /usr/local/README
mysql-connector-c++ /usr/local/include/
mysql-connector-c++ /usr/local/include/cppconn/
mysql-connector-c++ /usr/local/include/cppconn/build_config.h
mysql-connector-c++ /usr/local/include/cppconn/config.h
mysql-connector-c++ /usr/local/include/cppconn/connection.h
mysql-connector-c++ /usr/local/include/cppconn/datatype.h
mysql-connector-c++ /usr/local/include/cppconn/driver.h
mysql-connector-c++ /usr/local/include/cppconn/exception.h
mysql-connector-c++ /usr/local/include/cppconn/metadata.h
mysql-connector-c++ /usr/local/include/cppconn/parameter_metadata.h
mysql-connector-c++ /usr/local/include/cppconn/prepared_statement.h
mysql-connector-c++ /usr/local/include/cppconn/resultset.h
mysql-connector-c++ /usr/local/include/cppconn/resultset_metadata.h
mysql-connector-c++ /usr/local/include/cppconn/statement.h
mysql-connector-c++ /usr/local/include/cppconn/warning.h
mysql-connector-c++ /usr/local/include/mysql_connection.h
mysql-connector-c++ /usr/local/include/mysql_driver.h
mysql-connector-c++ /usr/local/lib/
mysql-connector-c++ /usr/local/lib/libmysqlcppconn-static.a
mysql-connector-c++ /usr/local/lib/libmysqlcppconn.so
mysql-connector-c++ /usr/local/lib/libmysqlcppconn.so.1
mysql-connector-c++ /usr/local/lib/libmysqlcppconn.so.1.0.5
The files bothering me are:
/usr/local/ANNOUNCEMENT
/usr/local/COPYING
/usr/local/README
Anyone who can enlighten me?:rolleyes:
Thanks in advance,
Arjan Gelderblom
Last edited by Bloged (2009-11-17 09:27:49)Bloged wrote:
Thanks wonder for your reply.
How do I move files using PKGBUILD? I've found an install -D command but that looks at best at copying the file:
install -D COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
Another question is that the patch that is executed is only for gcc-4.4 is there a way to have an if statement for that?
no. we don't have any other version in our repo and that patch will work also with older gcc
Edit: a simple solution is to copy them using install -D and then remove them... is this the correct sollution?
yes. and remove the others two files as well. -
MySQL Connector/ODBC-3.52
Hi, does anyone has or know where to get MySQL Connector/ODBC-3.52
I think that is the solution for the problem "Bad handshake" with MySQL 4.1.1a
greetingsIts not yet available in binary form, you have to compile it from the source.
-
JDBC MySQL connector & autoexec.bat
This what I entered into my autoexec file but when I run my java program it gives me a 'no suitable driver' error. I do not know what I should be entering for the
'CLASSPATH' in the autoexec. Below is what I entered. The file jar file is located in my C:\unzipped\mysql-connector-java-3.1.7/ folder.
C:\unzipped\mysql-connector-java-3.1.7\mysql-connector-java-3.1.7-bin.jar%CLASSPATH%
Can somebody with knowledge in installing the JDBC driver for MySQL give me some help please.This works perfectly in the Eclipse IDE area that I have but when I run the same program on the Net Beans 3.6 IDE area it gives me a 'not suitable driver' error. To note these are both on the same computer. I would really like to get the Net Beans 3.6 IDE working because that is what I am most familiar with using. If you know of the problem why one IDE area recognizes the driver where the next does not I would sure like to know. Somebody passed the idea that when the 3.6 area is executed there are multiple instances running and it resets the ClassPath(I think they where shooting in the dark but it is a lead none the less). Anyway if anybody has had this problem please enlighten me, Thank-You.
The ClassPath is set to the following:
ClassPath = C:\Program Files\Java\jdk1.5.0_02\lib;C:\unzipped\mysql-connector- java-3.1.7\mysql-connector-java-3.1.7;C:\Program Files
\Java\jdk1.5.0_02\jre\lib\ext;
This is the code:
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class Connect2 {
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");
} catch (Exception ex) {
System.out.println("HERE");
try {
String url = "jdbc:mysql://localhost/test";
String username = "root";
String password = "password";
Connection conn = DriverManager.getConnection(
"jdbc:mysql://localhost/test", "root", "password");
Statement c = conn.createStatement();
c.execute("insert into green values('richmond')");
c.execute("select * from green");
ResultSet rs = c.getResultSet();
while (rs.next()) {
System.out.println(rs.getString(1));
// Do something with the Connection
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
} -
hello everyone!
i'm doing a project that is a web based email system..
My pc is running under windows xp pro and i've installed and configured j2sdk1.4.1, Apache Tomcat 4.1.12LE and mysql 31.23.51.The problem i need to connect to the db.. so i've downloaded mysql-connector-java-2.0.14.How do i set the classpath in order to jsp to connect mysql...
it would be helpful to show the steps... Thank you..you can put mysql-connector.jar on the common/lib folder of tomCat.
FYI :
driverClass : com.mysql.jdbc.Driver
url : jdbc:mysql://hostname/databasename
Regrds. -
Include MySQL Connector in JAR
Is there a way to somehow include the MySQL connector in one of my JARs so that a user does not have to have two JARs in one folder for one program to run? Like, instead of having ThisJAR.jar AND MySQL_Connector.jar in one folder for ThisJAR to use MySQL_Connector for a database connection, I just want ThisJAR.jar.
I think I made that as confusing as it could possibly be. :-P
Thanks in advance,
Zach
Edited by: Zach on Apr 15, 2009 6:53 PM>
Is there a way to somehow include the MySQL connector in one of my JARs so that a user does not have to have two JARs in one folder for one program to run? >If you want to make it simple for the end-user, and your app. has a GUI, deploy it using webstart.
A single link can take them to the 'download' page that uses [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html] to check a suitable minimum version of Java is available before inserting the link to the launch/install file. If the user 'follows the prompts' from there, they might end up with a single menu item to launch the app., and no visible Jars.
I provide some [examples of the webstart API|http://pscode.org/jws/api.html] that show some services available to apps. launched using webstart, of particular use for your project might be the ExtensionInstallerService to install the DB, and the PersistenceService to store the path the user chose to install it (you would offer them the choice, of course).
Java webstart also offers other nice features like splash screens, icons..
Again, check the licensing arrangements - you might show the MySql license when installing.
Maybe you are looking for
-
Help on config 1:n multi-map
Hi, guru I refered https://weblogs.sdn.sap.com/pub/wlg/3115. [original link is broken] [original link is broken] [original link is broken] In PI7.1 ESB, Now I created 1:n message mapping and Operation Mapping. I think next step is to create a Integra
-
Is there anyway to change the output sound device in iTunes without going through System Preference? I have an iMac with built-in Speakers, and a 5.1 Griffin Firewave over Firewire. I want my music to come through my external speakers but I don't nee
-
Need Help for locating Standard idocs.
HEllo frineds, I have scenarion file coming from third party legacy needs to get mapped or updated in SAp. Looking for standard Idocs for the same.Plz help 1:Production order release. 2: Bill of material pricing. 3: Contract Sales order(I hope only o
-
Shuffle will not play podcasts in order
I have downloaded a French Lesson podcast - which I found through iTunes. No matter how I import the lessons (i.e. directly from the library, or if I make a playlist for the lessons) the will NOT play in order on my iPod Shuffle. I DO have it switche
-
hi how can i add a MapListener in my application so that i can able to fire aevent when some record are inserted or deleted in cache, i am using java API. regards praveen jian