<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem mit MySQL-Verbindung]]></title><description><![CDATA[<p>Hey Leute,<br />
wie schon im Titel geschrieben, habe ich Probleme eine Verbindung zu MySQL aufzubauen.<br />
Den Quellcode habe ich aus einem Tutorial und ich habe echt keine Ahnung wie ich die Fehlermeldung beheben kann.</p>
<pre><code>#include &quot;stdafx.h&quot;

#include &lt;stdlib.h&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;
#include &lt;stdexcept&gt;

#include &quot;mysql_connection.h&quot;

#include &lt;cppconn/driver.h&gt;
#include &lt;cppconn/exception.h&gt;
#include &lt;cppconn/resultset.h&gt;
#include &lt;cppconn/statement.h&gt;
#include &lt;cppconn/prepared_statement.h&gt;

#define EXAMPLE_HOST &quot;localhost&quot;
#define EXAMPLE_USER &quot;root&quot;
#define EXAMPLE_PASS &quot;&quot;
#define EXAMPLE_DB &quot;world&quot;

using namespace std;

int main(int argc, const char **argv)
{	

    string url(argc &gt;= 2 ? argv[1] : EXAMPLE_HOST);
    const string user(argc &gt;= 3 ? argv[2] : EXAMPLE_USER);
    const string pass(argc &gt;= 4 ? argv[3] : EXAMPLE_PASS);
    const string database(argc &gt;= 5 ? argv[4] : EXAMPLE_DB);

    cout &lt;&lt; &quot;Connector/C++ tutorial framework...&quot; &lt;&lt; endl;
    cout &lt;&lt; endl;

    try {

	/* INSERT TUTORIAL CODE HERE! */
		sql::Driver *driver;
  sql::Connection *con;
  sql::Statement *stmt;
  sql::ResultSet *res;

  /* Create a connection */
  driver = get_driver_instance();
  con = driver-&gt;connect(&quot;tcp://127.0.0.1:3306&quot;, &quot;root&quot;, &quot;1234&quot;);
  /* Connect to the MySQL test database */
  con-&gt;setSchema(&quot;test&quot;);

    } catch (sql::SQLException &amp;e) {
        /*
          The MySQL Connector/C++ throws three different exceptions:

          - sql::MethodNotImplementedException (derived from sql::SQLException)
          - sql::InvalidArgumentException (derived from sql::SQLException)
          - sql::SQLException (derived from std::runtime_error)
        */
        cout &lt;&lt; &quot;# ERR: SQLException in &quot; &lt;&lt; __FILE__;
        cout &lt;&lt; &quot;(&quot; &lt;&lt; __FUNCTION__ &lt;&lt; &quot;) on line &quot; &lt;&lt; __LINE__ &lt;&lt; endl;
        /* Use what() (derived from std::runtime_error) to fetch the error message */
        cout &lt;&lt; &quot;# ERR: &quot; &lt;&lt; e.what();
        cout &lt;&lt; &quot; (MySQL error code: &quot; &lt;&lt; e.getErrorCode();
        cout &lt;&lt; &quot;, SQLState: &quot; &lt;&lt; e.getSQLState() &lt;&lt; &quot; )&quot; &lt;&lt; endl;

        return EXIT_FAILURE;
    }

    cout &lt;&lt; &quot;Done.&quot; &lt;&lt; endl;
	system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>&quot;Unbehandelte Ausnahme bei 0x733db9f0 in connecttobumsdeinemudder.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000020.&quot;<br />
Das ist die Fehlermeldung und Visual zeigt mir, dass sie in dieser</p>
<pre><code>con = driver-&gt;connect(&quot;tcp://127.0.0.1:3306&quot;, &quot;root&quot;, &quot;1234&quot;);
</code></pre>
<p>Zeile auftaucht.</p>
<p>Ich hoffe ihr könnt mir helfen.<br />
Vielen Dank schon mal im Voraus dafür, dass ihr in den Thread geguckt habt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/273366/problem-mit-mysql-verbindung</link><generator>RSS for Node</generator><lastBuildDate>Fri, 28 Aug 2026 05:12:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/273366.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 06 Sep 2010 06:33:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit MySQL-Verbindung on Mon, 06 Sep 2010 06:33:54 GMT]]></title><description><![CDATA[<p>Hey Leute,<br />
wie schon im Titel geschrieben, habe ich Probleme eine Verbindung zu MySQL aufzubauen.<br />
Den Quellcode habe ich aus einem Tutorial und ich habe echt keine Ahnung wie ich die Fehlermeldung beheben kann.</p>
<pre><code>#include &quot;stdafx.h&quot;

#include &lt;stdlib.h&gt;
#include &lt;iostream&gt;
#include &lt;sstream&gt;
#include &lt;stdexcept&gt;

#include &quot;mysql_connection.h&quot;

#include &lt;cppconn/driver.h&gt;
#include &lt;cppconn/exception.h&gt;
#include &lt;cppconn/resultset.h&gt;
#include &lt;cppconn/statement.h&gt;
#include &lt;cppconn/prepared_statement.h&gt;

#define EXAMPLE_HOST &quot;localhost&quot;
#define EXAMPLE_USER &quot;root&quot;
#define EXAMPLE_PASS &quot;&quot;
#define EXAMPLE_DB &quot;world&quot;

using namespace std;

int main(int argc, const char **argv)
{	

    string url(argc &gt;= 2 ? argv[1] : EXAMPLE_HOST);
    const string user(argc &gt;= 3 ? argv[2] : EXAMPLE_USER);
    const string pass(argc &gt;= 4 ? argv[3] : EXAMPLE_PASS);
    const string database(argc &gt;= 5 ? argv[4] : EXAMPLE_DB);

    cout &lt;&lt; &quot;Connector/C++ tutorial framework...&quot; &lt;&lt; endl;
    cout &lt;&lt; endl;

    try {

	/* INSERT TUTORIAL CODE HERE! */
		sql::Driver *driver;
  sql::Connection *con;
  sql::Statement *stmt;
  sql::ResultSet *res;

  /* Create a connection */
  driver = get_driver_instance();
  con = driver-&gt;connect(&quot;tcp://127.0.0.1:3306&quot;, &quot;root&quot;, &quot;1234&quot;);
  /* Connect to the MySQL test database */
  con-&gt;setSchema(&quot;test&quot;);

    } catch (sql::SQLException &amp;e) {
        /*
          The MySQL Connector/C++ throws three different exceptions:

          - sql::MethodNotImplementedException (derived from sql::SQLException)
          - sql::InvalidArgumentException (derived from sql::SQLException)
          - sql::SQLException (derived from std::runtime_error)
        */
        cout &lt;&lt; &quot;# ERR: SQLException in &quot; &lt;&lt; __FILE__;
        cout &lt;&lt; &quot;(&quot; &lt;&lt; __FUNCTION__ &lt;&lt; &quot;) on line &quot; &lt;&lt; __LINE__ &lt;&lt; endl;
        /* Use what() (derived from std::runtime_error) to fetch the error message */
        cout &lt;&lt; &quot;# ERR: &quot; &lt;&lt; e.what();
        cout &lt;&lt; &quot; (MySQL error code: &quot; &lt;&lt; e.getErrorCode();
        cout &lt;&lt; &quot;, SQLState: &quot; &lt;&lt; e.getSQLState() &lt;&lt; &quot; )&quot; &lt;&lt; endl;

        return EXIT_FAILURE;
    }

    cout &lt;&lt; &quot;Done.&quot; &lt;&lt; endl;
	system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>&quot;Unbehandelte Ausnahme bei 0x733db9f0 in connecttobumsdeinemudder.exe: 0xC0000005: Zugriffsverletzung beim Lesen an Position 0x00000020.&quot;<br />
Das ist die Fehlermeldung und Visual zeigt mir, dass sie in dieser</p>
<pre><code>con = driver-&gt;connect(&quot;tcp://127.0.0.1:3306&quot;, &quot;root&quot;, &quot;1234&quot;);
</code></pre>
<p>Zeile auftaucht.</p>
<p>Ich hoffe ihr könnt mir helfen.<br />
Vielen Dank schon mal im Voraus dafür, dass ihr in den Thread geguckt habt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1948652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1948652</guid><dc:creator><![CDATA[Dianchen]]></dc:creator><pubDate>Mon, 06 Sep 2010 06:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MySQL-Verbindung on Mon, 06 Sep 2010 13:54:39 GMT]]></title><description><![CDATA[<p>Hat sich erledigt. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1948808</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1948808</guid><dc:creator><![CDATA[Dianchen]]></dc:creator><pubDate>Mon, 06 Sep 2010 13:54:39 GMT</pubDate></item></channel></rss>