title: Flex to java to mysql - failed connection, scrapbook to java to mysql - successful connection
body: <p>I'm trying to make connection from flex to java and from java to mysql. I managed to connect to java, but having error that class not found: com.mysql.jdbc.Driver. But I downloaded mysql.jar, included it added to library, and connection works when I testing it from eclipse scrapbook. Don't know what to do.</p>
  
  <pre><code>Class.forName("com.mysql.jdbc.Driver");
  String username = "username";
  String password = "password";
  String database = "database"
  String url = "jdbc:mysql://localhost/" + database;
  connect = DriverManager.getConnection(url, username, password);
  statement = connect.createStatement();
  resultSet = statement.executeQuery(query);
  </code></pre>
  
  <p><strong>SOLVED</strong></p>
  
  <p>Basically the solution was simple. Everybody keeps saying to put jar into lib folder, so I done it, but I wasn't realised that I have to put into my servers lib directory, not app lib directory and this miserable mistake cost so much.</p>
  
  <p>In this particular situation I'm using red5, so I putted it into my red5 dist/lib directory and "surprisingly" it's started to work.</p>