Using MySQL connector from jar

I want to use MySQLconnector without unziping it. that is, directly from the jar file.
Anyone know how to do that??
thanx

MySQLconnector is the paquet with the necesary drivers to connect to a MySQL database server.
Those drivers are classes packed in a jar file.
To actually use the connector you have to load it with the following line:
Class.forName("com.mysql.jdbc.Driver") ;
That works fine if I unzip the jar file in the working directory. But if I just put the jar file alone, the line above throws an exception because it cannot be able to find the class.

Similar Messages

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

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

  • "No suitable driver" error using Kodo 3.1.0, MySQL Connector/J & eclipse 3.0M8

    Hi,
    I'm getting the following error when trying to use the mapping tool from
    within eclipse 3.0M8:
    <error>-An error occurred running MappingTool
    kodo.util.FatalDataStoreException: No suitable driver
    NestedThrowables:
    java.sql.SQLException: No suitable driver
    <info>-Done.
    I followed the instructions on using the eclipse plugin, including copying
    all jars from kodo's lib folder to the plugin folder, copying the MySQL
    Connector/J jar to the kodo plugin folder, adding all of those jars to the
    project classpath, and even added an entry to the plugin.xml file to
    include the MySQL Connector/J jar. If I remove the project reference to
    the MySQL Connector/J jar, the error changes to:
    <error>-An error occurred running MappingTool
    kodo.util.FatalDataStoreException: com.mysql.jdbc.Driver
    NestedThrowables:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    <info>-Done.
    This would imply that adding a <library> entry for the MySQL Connector/J
    jar in my plugin.xml does not have any effect; if I remove it, I see the
    same error as above. If I add the MySQL jar back to the project
    classpath, the error changes back to 'No suitable driver' as above.
    The behavior is the same whether I use the Kodo preferences
    (Window\Preferences\Kodo Preferences) individually without a
    kodo.properties file, or when I clear all individual properties and
    indicate a kodo.properties file.
    Help?
    Thanks,
    Matthew
    Here's my kodo.properties file:
    # Kodo JDO Properties configuration
    kodo.LicenseKey: xxx
    javax.jdo.PersistenceManagerFactoryClass:
    kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName: com.mysql.jdbc.Driver
    javax.jdo.option.ConnectionUserName: root
    javax.jdo.option.ConnectionPassword:
    javax.jdo.option.ConnectionURL: jdbc:mysql://localhost/kodo
    javax.jdo.option.Optimistic: true
    javax.jdo.option.RetainValues: true
    javax.jdo.option.NontransactionalRead: true
    kodo.Log: DefaultLevel=WARN, Runtime=INFO, Tool=INFO
    Here's my eclipse-3.0M8/plugins/kodo.eclipse_2.1.0/plugin.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin id="kodo"
    name="%name"
    version="1.0.1"
    provider-name="%provider-name"
    class="kodo.jdbc.integration.eclipse.KodoPlugin">
    <runtime>
    <!--
    Put your jdbc driver in this directory and enter the filename
    here (and configure in Preferences the changes you make) -->
    <!--<library name="jdbc-hsql-1_7_0.jar"/>-->
    <library name="mysql-connector-java-3.0.11-stable-bin.jar"/>
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <library name="kodo-jdo.jar"/>
    <library name="jakarta-commons-collections-2.1.jar"/>
    <library name="jakarta-commons-lang-1.0.1.jar"/>
    <library name="jakarta-commons-pool-1.0.1.jar"/>
    <library name="jakarta-regexp-1.1.jar"/>
    <library name="jca1.0.jar"/>
    <library name="jdbc2_0-stdext.jar"/>
    <library name="jdo-1.0.1.jar"/>
    <library name="jta-spec1_0_1.jar"/>
    <library name="xalan.jar"/>
    <library name="xercesImpl.jar"/>
    <library name="xml-apis.jar"/>
    <library name="jfreechart-0.9.16.jar"/>
    <library name="jcommon-0.9.1.jar"/>
    <library name="mx4j-admb.jar"/>
    <library name="mx4j-jmx.jar"/>
    <library name="mx4j-tools.jar"/>
    <library name="jline.jar"/>
    <library name="sqlline.jar"/>
    </runtime>
    <requires>
    <import plugin="org.eclipse.ui"/>
    <import plugin="org.eclipse.core.resources"/>
    <import plugin="org.eclipse.jdt.core"/>
    <import plugin="org.eclipse.jdt.launching"/>
    </requires>
    <extension point="org.eclipse.ui.actionSets">
    <actionSet id="kodo.jdbc.integration.eclipse.actionSet"
    label="%action-set-name"
    visible="true">
    <menu id="kodo.menu"
    label="%group-label">
    <separator name="baseGroup"/>
    </menu>
    <action id="kodo.removeBuilder"
    label="%remove-builder-label"
    class="kodo.jdbc.integration.eclipse.RemoveBuilderAction"
    tooltip="%remove-builder-tooltip"
    menubarPath="kodo.menu/baseGroup"
    enablesFor="1">
    </action>
    <action id="kodo.addbuilder"
    label="%add-builder-label"
    class="kodo.jdbc.integration.eclipse.AddBuilderAction"
    tooltip="%add-builder-tooltip"
    menubarPath="kodo.menu/baseGroup"
    enablesFor="1">
    </action>
    <action id="kodo.mapping.build"
    label="%mapping-build-label"
    tooltip="%mapping-build-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$BuildSchema"
    icon="icons/BuildSchemaMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.mapping.drop"
    label="%mapping-drop-label"
    tooltip="%mapping-drop-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$Drop"
    icon="icons/DropMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.mapping.refresh"
    label="%mapping-refresh-label"
    tooltip="%mapping-refresh-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$Refresh"
    icon="icons/RefreshMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.enhance"
    label="%enhance-label"
    icon="icons/EnhancerAction.gif"
    class="kodo.jdbc.integration.eclipse.EnhancerAction"
    tooltip="%enhance-tooltip"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    </actionSet>
    </extension>
    <!-- lock our actions into the base perspective -->
    <extension point="org.eclipse.ui.perspectiveExtensions">
    <perspectiveExtension
    targetID="org.eclipse.ui.resourcePerspective">
    <actionSet
    id="kodo.jdbc.integration.eclipse.actionSet">
    </actionSet>
    </perspectiveExtension>
    </extension>
    <!-- put our extensions in -->
    <extension point="org.eclipse.ui.preferencePages">
    <page name="%preference-name"
    class="kodo.jdbc.integration.eclipse.KodoPreferencePage"
    id="kodo.jdbc.integration.eclipse.preferences.KodoPreferencePage">
    </page>
    </extension>
    <!-- lock in our eclipse-generated xml editor -->
    <extension point="org.eclipse.ui.editors">
    <editor name="%mappingeditor-name" extensions="mapping"
    icon="icons/mapping.gif"
    contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
    class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
    id="kodo.jdbc.integration.eclipse.editor.XMLEditorMapping">
    </editor>
    <editor name="%editor-name" extensions="jdo,schema"
    icon="icons/metadata.gif"
    contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
    class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
    id="kodo.jdbc.integration.eclipse.editor.XMLEditor">
    </editor>
    </extension>
    <!-- lock in our "view" -->
    <extension point="org.eclipse.ui.views">
    <view id="kodo.jdbc.integration.eclipse.KodoView"
    name="%view-name"
    category="org.eclipse.jdt.ui.java"
    icon="icons/kodosmall.gif"
    class="kodo.jdbc.integration.eclipse.KodoView">
    </view>
    </extension>
    <!-- lock in our builder -->
    <extension point="org.eclipse.core.resources.builders"
    id="kodo.jdbc.integration.eclipse.EnhancerBuilder"
    name="%builder-name">
    <builder>
    <run
    class="kodo.jdbc.integration.eclipse.EnhancerBuilder">
    </run>
    </builder>
    </extension>
    <!-- put our view onto the bottom bar -->
    <extension point="org.eclipse.ui.perspectiveExtensions">
    <perspectiveExtension
    targetID="org.eclipse.debug.ui.DebugPerspective">
    <view id="kodo.jdbc.integration.eclipse.KodoView"
    relative="org.eclipse.debug.ui.ExpressionView"
    relationship="stack"/>
    <viewShortcut id="org.eclipse.jdt.debug.ui.DisplayView"/>
    </perspectiveExtension>
    </extension>
    </plugin>

    I am not using Eclipse but am also experiencing problems similar to those
    described below. The fact is I cannot validate a configuration file which
    specifies either a traditional MySQL driver or a MySQL DataSoure.
    I am using what I believe to be the official stable version of MySQL
    Connector/J which is 3.0.11 and has been for several months. Are you
    saying that 3.0.11 (or even 3.0.8) is not supported?
    3.0.12 was recently released as the latest stable version so 3.0.11 should
    at least be supported by now.
    -Neil
    Stephen Kim wrote:
    The milestones are not fully supported versions as they are of beta
    quality. I would suggest using a proper release instead.
    Wolfgang Kundrus wrote:
    Hi,
    I have excactly the same behaviour here with Eclipse 3.0M8 and MySQL. It
    is the same with 3.0.8. and 3.0.11. What is the solution ?
    Best regards
    Wolfgang Kundrus
    Marc Prud'hommeaux wrote:
    Matthew-
    Everything looks correct to me. If you try an older version of the MySQL
    driver (such as 3.0.8, which is what we test with), do you see anything
    different?
    If you try to run a stand-alone Kodo program using the MySQL driver, do
    you see the same exception? If so, can you post the complete stack
    trace?
    In article <[email protected]>, Matthew T. Adams wrote:
    Hi,
    I'm getting the following error when trying to use the mapping tool from
    within eclipse 3.0M8:
    <error>-An error occurred running MappingTool
    kodo.util.FatalDataStoreException: No suitable driver
    NestedThrowables:
    java.sql.SQLException: No suitable driver
    <info>-Done.
    I followed the instructions on using the eclipse plugin, including copying
    all jars from kodo's lib folder to the plugin folder, copying the MySQL
    Connector/J jar to the kodo plugin folder, adding all of those jars to the
    project classpath, and even added an entry to the plugin.xml file to
    include the MySQL Connector/J jar. If I remove the project reference to
    the MySQL Connector/J jar, the error changes to:
    <error>-An error occurred running MappingTool
    kodo.util.FatalDataStoreException: com.mysql.jdbc.Driver
    NestedThrowables:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    <info>-Done.
    This would imply that adding a <library> entry for the MySQL Connector/J
    jar in my plugin.xml does not have any effect; if I remove it, I see the
    same error as above. If I add the MySQL jar back to the project
    classpath, the error changes back to 'No suitable driver' as above.
    The behavior is the same whether I use the Kodo preferences
    (WindowPreferencesKodo Preferences) individually without a
    kodo.properties file, or when I clear all individual properties and
    indicate a kodo.properties file.
    Help?
    Thanks,
    Matthew
    Here's my kodo.properties file:
    # Kodo JDO Properties configuration
    kodo.LicenseKey: xxx
    javax.jdo.PersistenceManagerFactoryClass:
    kodo.jdbc.runtime.JDBCPersistenceManagerFactory
    javax.jdo.option.ConnectionDriverName: com.mysql.jdbc.Driver
    javax.jdo.option.ConnectionUserName: root
    javax.jdo.option.ConnectionPassword:
    javax.jdo.option.ConnectionURL: jdbc:mysql://localhost/kodo
    javax.jdo.option.Optimistic: true
    javax.jdo.option.RetainValues: true
    javax.jdo.option.NontransactionalRead: true
    kodo.Log: DefaultLevel=WARN, Runtime=INFO, Tool=INFO
    Here's my eclipse-3.0M8/plugins/kodo.eclipse_2.1.0/plugin.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin id="kodo"
    name="%name"
    version="1.0.1"
    provider-name="%provider-name"
    class="kodo.jdbc.integration.eclipse.KodoPlugin">
    <runtime>
    <!--
    Put your jdbc driver in this directory and enter the filename
    here (and configure in Preferences the changes you make) -->
    <!--<library name="jdbc-hsql-1_7_0.jar"/>-->
    <library name="mysql-connector-java-3.0.11-stable-bin.jar"/>
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <!-- ########### do not modify below ######### -->
    <library name="kodo-jdo.jar"/>
    <library name="jakarta-commons-collections-2.1.jar"/>
    <library name="jakarta-commons-lang-1.0.1.jar"/>
    <library name="jakarta-commons-pool-1.0.1.jar"/>
    <library name="jakarta-regexp-1.1.jar"/>
    <library name="jca1.0.jar"/>
    <library name="jdbc2_0-stdext.jar"/>
    <library name="jdo-1.0.1.jar"/>
    <library name="jta-spec1_0_1.jar"/>
    <library name="xalan.jar"/>
    <library name="xercesImpl.jar"/>
    <library name="xml-apis.jar"/>
    <library name="jfreechart-0.9.16.jar"/>
    <library name="jcommon-0.9.1.jar"/>
    <library name="mx4j-admb.jar"/>
    <library name="mx4j-jmx.jar"/>
    <library name="mx4j-tools.jar"/>
    <library name="jline.jar"/>
    <library name="sqlline.jar"/>
    </runtime>
    <requires>
    <import plugin="org.eclipse.ui"/>
    <import plugin="org.eclipse.core.resources"/>
    <import plugin="org.eclipse.jdt.core"/>
    <import plugin="org.eclipse.jdt.launching"/>
    </requires>
    <extension point="org.eclipse.ui.actionSets">
    <actionSet id="kodo.jdbc.integration.eclipse.actionSet"
    label="%action-set-name"
    visible="true">
    <menu id="kodo.menu"
    label="%group-label">
    <separator name="baseGroup"/>
    </menu>
    <action id="kodo.removeBuilder"
    label="%remove-builder-label"
    class="kodo.jdbc.integration.eclipse.RemoveBuilderAction"
    tooltip="%remove-builder-tooltip"
    menubarPath="kodo.menu/baseGroup"
    enablesFor="1">
    </action>
    <action id="kodo.addbuilder"
    label="%add-builder-label"
    class="kodo.jdbc.integration.eclipse.AddBuilderAction"
    tooltip="%add-builder-tooltip"
    menubarPath="kodo.menu/baseGroup"
    enablesFor="1">
    </action>
    <action id="kodo.mapping.build"
    label="%mapping-build-label"
    tooltip="%mapping-build-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$BuildSchema"
    icon="icons/BuildSchemaMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.mapping.drop"
    label="%mapping-drop-label"
    tooltip="%mapping-drop-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$Drop"
    icon="icons/DropMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.mapping.refresh"
    label="%mapping-refresh-label"
    tooltip="%mapping-refresh-tooltip"
    class="kodo.jdbc.integration.eclipse.MappingToolAction$Refresh"
    icon="icons/RefreshMappingTool.gif"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    <action id="kodo.enhance"
    label="%enhance-label"
    icon="icons/EnhancerAction.gif"
    class="kodo.jdbc.integration.eclipse.EnhancerAction"
    tooltip="%enhance-tooltip"
    menubarPath="kodo.menu/baseGroup"
    toolbarPath="Normal/Kodo"
    enablesFor="+">
    <selection class="org.eclipse.core.resources.IFile"
    name="*.jdo">
    </selection>
    </action>
    </actionSet>
    </extension>
    <!-- lock our actions into the base perspective -->
    <extension point="org.eclipse.ui.perspectiveExtensions">
    <perspectiveExtension
    targetID="org.eclipse.ui.resourcePerspective">
    <actionSet
    id="kodo.jdbc.integration.eclipse.actionSet">
    </actionSet>
    </perspectiveExtension>
    </extension>
    <!-- put our extensions in -->
    <extension point="org.eclipse.ui.preferencePages">
    <page name="%preference-name"
    class="kodo.jdbc.integration.eclipse.KodoPreferencePage"
    id="kodo.jdbc.integration.eclipse.preferences.KodoPreferencePage">
    </page>
    </extension>
    <!-- lock in our eclipse-generated xml editor -->
    <extension point="org.eclipse.ui.editors">
    <editor name="%mappingeditor-name" extensions="mapping"
    icon="icons/mapping.gif"
    contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
    >>
    class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
    id="kodo.jdbc.integration.eclipse.editor.XMLEditorMapping">
    </editor>
    <editor name="%editor-name" extensions="jdo,schema"
    icon="icons/metadata.gif"
    contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
    >>
    class="kodo.jdbc.integration.eclipse.editor.XMLEditor"
    id="kodo.jdbc.integration.eclipse.editor.XMLEditor">
    </editor>
    </extension>
    <!-- lock in our "view" -->
    <extension point="org.eclipse.ui.views">
    <view id="kodo.jdbc.integration.eclipse.KodoView"
    name="%view-name"
    category="org.eclipse.jdt.ui.java"
    icon="icons/kodosmall.gif"
    class="kodo.jdbc.integration.eclipse.KodoView">
    </view>
    </extension>
    <!-- lock in our builder -->
    <extension point="org.eclipse.core.resources.builders"
    id="kodo.jdbc.integration.eclipse.EnhancerBuilder"
    name="%builder-name">
    <builder>
    <run
    class="kodo.jdbc.integration.eclipse.EnhancerBuilder">
    </run>
    </builder>
    </extension>
    <!-- put our view onto the bottom bar -->
    <extension point="org.eclipse.ui.perspectiveExtensions">
    <perspectiveExtension
    targetID="org.eclipse.debug.ui.DebugPerspective">
    <view id="kodo.jdbc.integration.eclipse.KodoView"
    relative="org.eclipse.debug.ui.ExpressionView"
    relationship="stack"/>
    <viewShortcut id="org.eclipse.jdt.debug.ui.DisplayView"/>
    </perspectiveExtension>
    </extension>
    </plugin>
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Connecting mysql-4.1.12a-win32 with jakarta-tomcat-3.3.2 using mysql-connec

    hi calverstine here, i have been trying to connect tomcat to mysql using mysql-connector-java-3.1.10, but does not have any clue how to do it, if you guys ask me to refer to :
    http://dev.mysql.com/doc/connector/j/en/cj-classpath.html
    it only told me about installing mysql to unix platform tomcat , not windows xp sp1, is there any tutorial tat's useful for using the mysql-connector-java-3.1.10? where should i place this folder after i unzipped it? what is CLASSPATH as being written in the previous URL that told us to set the environment variable?..anybody care to help?

    You need to place the driver jar in a place that tomcat can access it; if that place is not already in the classpath for Tomcat, then you need to add it.
    After that, you need to supply application code for Tomcat to contain that will use the driver and do whatever it is you want.
    If you don't know how to do any of that, you need to either read the Tomcat documentation, or learn basic Java development.

  • 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

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

  • Reg: Recon using sun connector

    Hi guys,
    I am trying to recon users using sun connector from LDAP directory to OIM.
    I got the error below when i scheduled the recon task
    10:26:00,265 INFO [SJSDS] tcTskIPlanetUserReconciliation[RO=iPlanet User] --> R
    econciliation Starts
    10:26:00,265 INFO [SJSDS] Proceeding to perform the reconciliation task
    10:26:00,265 INFO [SJSDS] Please wait..........................................
    10:26:00,281 INFO [SJSDS] Inside constructSearchFilterForReconcilingUsers metho
    d
    10:26:15,484 INFO [SJSDS]
    10:26:15,500 ERROR [STDERR] javax.naming.ServiceUnavailableException: dfo
    rcedmz.mu.intra.net:636; socket closed
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.Connection.readReply(Connec
    tion.java:416)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapClient.ldapBind(LdapCli
    ent.java:340)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapClient.authenticate(Lda
    pClient.java:192)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.jav
    a:2658)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java
    :287)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(
    LdapCtxFactory.java:175)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs
    (LdapCtxFactory.java:193)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxIn
    stance(LdapCtxFactory.java:136)
    10:26:15,500 ERROR [STDERR] at com.sun.jndi.ldap.LdapCtxFactory.getInitialCo
    ntext(LdapCtxFactory.java:66)
    10:26:15,500 ERROR [STDERR] at javax.naming.spi.NamingManager.getInitialCont
    ext(NamingManager.java:667)
    10:26:15,500 ERROR [STDERR] at javax.naming.InitialContext.getDefaultInitCtx
    (InitialContext.java:288)
    10:26:15,500 ERROR [STDERR] at javax.naming.InitialContext.init(InitialConte
    xt.java:223)
    10:26:15,500 ERROR [STDERR] at javax.naming.ldap.InitialLdapContext.<init>(I
    nitialLdapContext.java:134)
    10:26:15,500 ERROR [STDERR] at com.thortech.xl.integration.iplanet.recon.sch
    edule.tasks.tcTskIPlanetUserReconciliation.countRecord(Unknown Source)
    10:26:15,500 ERROR [STDERR] at com.thortech.xl.integration.iplanet.recon.sch
    edule.tasks.tcTskIPlanetUserReconciliation.analyzeTypeOfReconciliation(Unknown S
    ource)
    10:26:15,500 ERROR [STDERR] at com.thortech.xl.integration.iplanet.recon.sch
    edule.tasks.tcTskIPlanetUserReconciliation.processChange(Unknown Source)
    10:26:15,515 ERROR [STDERR] at com.thortech.xl.integration.iplanet.recon.sch
    edule.tasks.tcTskIPlanetUserReconciliation.execute(Unknown Source)
    10:26:15,515 ERROR [STDERR] at com.thortech.xl.scheduler.tasks.SchedulerBase
    Task.run(Unknown Source)
    10:26:15,515 ERROR [STDERR] at com.thortech.xl.scheduler.core.quartz.QuartzW
    rapper$TaskExecutionAction.run(Unknown Source)
    10:26:15,515 ERROR [STDERR] at Thor.API.Security.LoginHandler.jbossLoginSess
    ion.runAs(Unknown Source)
    10:26:15,515 ERROR [STDERR] at com.thortech.xl.scheduler.core.quartz.QuartzW
    rapper.execute(Unknown Source)
    10:26:15,515 ERROR [STDERR] at org.quartz.core.JobRunShell.run(JobRunShell.j
    ava:203)
    10:26:15,515 ERROR [STDERR] at org.quartz.simpl.SimpleThreadPool$WorkerThrea
    d.run(SimpleThreadPool.java:520)
    10:26:15,515 ERROR [SJSDS] tcTskIPlanetUserReconciliation[RO=iPlanet User] -->
    execute(): failed. Exception in execute() method.
    Any suggestions please.....
    could any please respond at the earliest.
    Thanks,
    divya

    Hi Kelvin,
    I am able to connect through LDAP browser.
    I am able to do provisioning also.
    I followed the following steps to do recon
    1. i imported iPlanetXLResourceObject.xml using Depolyment manager.
    2.In Task scheduler, stop execution and disable check boxes are not checked ,XLDeleteUsersAllowed is set to true, user container is set to one of the LDAP branch,
    Trusted source to true, rest of the values are default values.
    3.In ITResorce, in the Recon Attribute Lookup Code is set to AttrName.Recon.Map
    I scheduled a recon task and deleted a user in LDAP.
    I am getting the above said error,should i set any other values other than these.
    Kindly suggest me the approach,
    Thanks,
    divya

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

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

  • How to get pdf file from sap presentation server using java connector

    Hi Friends,
    with the below code i am able to get po details in pdf in presentation server.
    DATA : w_url TYPE string
           VALUE 'C:\Documents and Settings\1011\Solutions\web\files\podet.pdf'.
    CALL FUNCTION 'ECP_PDF_DISPLAY'
            EXPORTING
              purchase_order       = i_ponum
           IMPORTING
      PDF_BYTECOUNT        =
             pdf                  = file  " data in Xsting format
    *Converting Xstring to binary_tab
          CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
            EXPORTING
              buffer                = file
      APPEND_TO_TABLE       = ' '
    IMPORTING
      OUTPUT_LENGTH         =
            TABLES
              binary_tab            = it_bin " data in binary format
    **Downloading into PDF file
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
      BIN_FILESIZE                    =
              filename                        = w_url
              filetype                        = 'BIN'
             TABLES
              data_tab                        = it_bin
    when i am using java connector , to retirve the file from presentation server , the follwoing error i am getting...
    init:
    deps-jar:
    compile-single:
    run-single:
    com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Error in Control Framework
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.nativeExecute(Native Method)
            at com.sap.mw.jco.rfc.MiddlewareRFC$Client.execute(MiddlewareRFC.java:1244)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3842)
            at com.sap.mw.jco.JCO$Client.execute(JCO.java:3287)
            at PdfGen.<init>(PdfGen.java:35)
            at PdfGen.main(PdfGen.java:78)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 1 second)
    i debugged too, problem with <b>gui_download......</b>
    I am very glad to all with your suggestions!!
    Regards,
    Madhu..!!

    Hi
    You can try to create an external command (transaction SM69).......sorry I've forgotten,,,,they works on application
    How do you call CL_GUI_FRONTEND_SERVICES=>EXECUTE?
    Max
    Edited by: max bianchi on Oct 13, 2011 10:27 AM

  • Error in extracting data from SAP using mySQL server database

    Hello Experts.
    We are now using MySQL server 2005 database for Nakisa OrgChart. We have already configured the SAPExtractor settings. Source-SAP has been provided and Test connection to destination database is successful. We manually created the database ExtractedData and AnalyticData in the MySQL management studio.
    We are getting the error upon starting the extraction
    Processing Function Read Table Function/BAPI Downloading Tables Organizational Assignment
    No Tables were downloaded for Read Table Function/BAPI . Function is flagged as critical.Terminating Extraction.
    Processing Stopped ! ! !
    Downloading from SAP completed.
    Processing Completed. 
    From CDS.log
    ERROR: Sap Authentication : Source {SAP.Connector}: Message {An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)}
    We would appreciate some assistance on this configuration
    Thanks,
    Angelo
    Accenture inc.
    SAP Basis

    Hello Luke,
    We have not done any modification of the downloadschema file. We receive message: The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.  when we open the file.
    The SAP account we used has SAP_AlLL, SAP_NEW authorizations. Are these authorizations sufficient to perform the data extraction?
    Thanks,
    Angelo

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

  • Fat Jar Export: Could not find class-path entry for 'C:Java/jdk/mysql-connector-java-

    ok friends,
    have a normaly running project in eclipse and want to create a jar file...i tried ewerythin in ->export but nothing function
    i wanted to create a runnable jar file but that error ecures:
    JAR export finished with warnings. See details for additional information.
    Exported with compile warnings: ICQJJ/src/ICQJJ.java
    Jar export finished with problems. See details for additional infos.
    Fat Jar Export: Could not find class-path entry for 'C:Java/jdk/mysql-connector-java-5.1.8-bin.jar'
    what's the problem?
    ok, i am using a mysql db und using the driver mysql-connector-java-5.1.8-bin.jar....
    i improted this jar file like this run -> run configuration -> classpath -> add external jar....
    pls help me

    That looks like it might be a binary-distribution JAR that you should unjar. The actual JAR for the classpath is probably inside it.

  • Unable to extract connector/j jar file(mysql)

    im have having a problem on extracting mysql's connector/j jar file on j2sdk1.4.0.
    and may i know does sun allows windows xp users to install various kind of versions of j2sdk? for example, install j2sdk1.4.0 into c:\j2sdk1.4.0, and j2sdk1.4.2_05 into c:\j2sdk1.4.2_05?
    what to do using j2sdk1.4.0 for connector/j?
    i would like to know manual steps instead if automatic step provided by netbean.
    i wish this problem could be solved as sonn as possible

    im have having a problem on extracting mysql's
    connector/j jar file on j2sdk1.4.0.I'm not sure what this means. The MySQL connector JAR isn't part of any JDK. You've got to download it and put it in your CLASSPATH.
    >
    and may i know does sun allows windows xp users to
    install various kind of versions of j2sdk? for
    example, install j2sdk1.4.0 into c:\j2sdk1.4.0, and
    j2sdk1.4.2_05 into c:\j2sdk1.4.2_05?
    what to do using j2sdk1.4.0 for connector/j?
    i would like to know manual steps instead if
    automatic step provided by netbean.
    i wish this problem could be solved as sonn as
    possible

Maybe you are looking for

  • Not appearing under devices

    When I connect my iPod Classic, it does not appear under devices.  I do have it on my iMac desktop, so I think the USB is working properly.  The iPod also will connect to my PC with no problem; I synced yesterday evening.  I have the latest iTunes on

  • Best way to Export/Import

    I am developing my application in Company environment. Whenever I posted in forums, helpers asked credentials on apex.oracle.com. Roel mentioned to create a sql file with all your data definitions (tables, packages etc) and data. But he did not have

  • How to end a procedure immediately

    How to end a procedure immediately before it is ended normally when some exceptions that I can't anticipate occur.

  • ADF and not Oracle database

    Hi all. In trace log I see that ADF creates such SQL for a lock row : [NNN] Executing LOCK "SELECT ... FROM TABLE WHERE PK=? FOR UPDATE" but I use FireBird as SQL Server and for this database syntax has to be "SELECT ... FROM TABLE WHERE PK=? FOR UPD

  • Oracle Form Sessions - 11.5.10.2

    I may have asked this question before but I am still looking for a solid answer on this one. Is there any table or view, in addition to v$session, which would tell me form sessions, wait time by each form module, activities performed by these form se