[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.

Similar Messages

  • Java\jdk1.6.0_02\jre\lib\ext\mysql-connector-java-5.1.16-bin.jar was unexp

    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 AM

    Andrew,
    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.

  • 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 applet

    Applet 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.

  • 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.

  • Can't instal mysql connector extension for libreoffice

    I am trying to install a mysql native connector on libreoffice but I get an error during installation:
    "loading component library failed: file:///home.../uno_packages/cache/uno_packages/lu2gkbw6.tmp_/mysql-connector-ooo-1.0.1-linux-intel.oxt/mysqlc.uno.so"
    First I thought it was incompatible with LibreOffice 3.4 as it is an OpenOffice.org extension actually, but I tried and it works at least on windows installtion.
    Has anyone encountered this?

    You would think by now that people would know.
    Tomcat (and any other application server) has its own ideas about Classpath. This is necessary so that each web application can have its own individual classpath setup.
    The classpath for a web application is
    - WEB-INF/classes
    - jar files in WEB-INF/lib
    - shared jar files. eg in Tomcat jar files in /common/lib and /shared/lib
    Setting the system classpath will NOT affect the classpath of a web application.
    To solve your problem:
    Put mysql-connector-java-3.1.12-bin.jar in your WEB-INF/lib directory.
    At that point the class should be found.
    Even better set up a JNDI datasource in Tomcat and use that:
    http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    Better again: Don't put sql code into a JSP. It doesn't belong there.
    meh,
    evnafets

  • 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:52

    LordSvae 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,
    Kishor

    Hi,
    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

  • Mysql connector & ssl

    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 &amp; 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.

  • [SOLVED] MySQL Server issues

    I just installed a fresh ArchLinux, restored a backup from an Ubuntu natty, everything works except my MySQL server connections.
    I cannot connect with odbc or jdbc, I'm using the latest versions available:
    $ pacman -Q mysql unixodbc myodbc jre
    mysql 5.5.12-1
    unixodbc 2.3.0-1
    myodbc 5.1.8-1
    jre 6u25-1
    $ mysql -u mencargo -p
    Server version: 5.5.12 Source distribution
    mysql> use etlcontroltf;
    Database changed
    mysql>
    $ cat /etc/odbcinst.ini
    [MySQL]
    Description = ODBC Driver for MySQL
    Driver = /usr/lib/libmyodbc5.so
    $ cat .odbc.ini
    [MySQL]
    Description = MySQL ODBC
    Driver = MySQL
    Server = localhost
    Database = etlcontroltf
    Port = 3306
    Socket = /var/run/mysqld/mysqld.sock
    $ isql MySQL -v
    [01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/libmyodbc5.so' : file not found
    [ISQL]ERROR: Could not SQLConnect
    $ lsd /usr/lib/libmyodbc5.so
    lrwxrwxrwx 1 root 19 Mar 17 09:05 /usr/lib/libmyodbc5.so -> libmyodbc5-5.1.8.so
    For JDBC I'm trying to use mysql-connector-java-5.1.16-bin.jar with DBvisualizer, getting:
    Product:  DbVisualizer Free 7.1.5
    Build:  #1590 (2011/02/24 17:23)
    Java VM:  Java HotSpot(TM) 64-Bit Server VM
    Java Version:  1.6.0_25
    Java Vendor:  Sun Microsystems Inc.
    OS Name:  Linux
    OS Arch:  amd64
    OS Version:  2.6.38-ARCH
    An error occurred while establishing the connection:
    Long Message:
    Communications link failure
    The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
    Details:
       Type: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
       Error Code: 0
       SQL State: 08S01
    A curious thing about the odbc is that the Arch guide suggests a /usr/lib/libodbcmyS.so file that is not present in my system, or any libodbcmySX.so nor libmyodbcSX.so.
    Anyway, jdbc doesn't have anything to do with odbc, and it's also not working, so maybe it's my server config?
    $ cat /etc/mysql/my.cnf
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    [mysqld]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    datadir = /var/lib/mysql
    skip-external-locking
    key_buffer_size = 64M
    max_allowed_packet = 2M
    table_open_cache = 64
    sort_buffer_size = 1M
    net_buffer_length = 512K
    read_buffer_size = 2M
    read_rnd_buffer_size = 1M
    myisam_sort_buffer_size = 16M
    bind-address = 127.0.0.1
    server-id = 1
    [mysqldump]
    quick
    max_allowed_packet = 64M
    [mysql]
    no-auto-rehash
    [myisamchk]
    key_buffer_size = 32M
    sort_buffer_size = 32M
    read_buffer = 16M
    write_buffer = 16M
    Or is this version of the server broken?
    Last edited by mencargo (2011-06-03 05:49:11)

    The my.cnf code posted is the whole config, I don't have skip-networking.
    $ telnet localhost 3306
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    Connection closed by foreign host.
    $ netop
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1483/mysqld
    tcp 0 0 127.0.0.1:3306 127.0.0.1:43098 TIME_WAIT -
    The port seems open but I'm getting disconnected immediately.
    Any thoughts?
    Last edited by mencargo (2011-05-09 02:04:58)

  • 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
    greetings

    Its 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());
    }

  • Mysql connector

    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.

Maybe you are looking for