header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
thallium205
Points:20
Posts:0
Answered

5/12/2010 11:22:45 AM

Title: MySQL + Red5


Hello everybody.
I would first like to preface this by saying that I am always very hesitant in asking questions without first trying to solve this problem, and I would like to let you know I have spent hours on this without any progress. I would also like this to act as a guide in the future to all those who would like to do the same.

Goal: To have the Red5 server be able to connect to a MySQL database.

Prerequisites:
Ubuntu 10.04
MySQL 5.1.46
MySQL Connector/J 5.0.8
Red5 9.1 FINAL
Eclipse

Problem:
When trying to connect to the database through Red5, I receive:

Caused by: java.sql.SQLException: No suitable driver found for jbdc:mysql://127.0.0.1/db


Steps I have taken:
1) I have written the serverside code as:


public class MySQLConnector
{
	private Connection connect = null;
	private Statement statement = null;
	private PreparedStatement preparedstatement = null;
	private ResultSet resultset = null;
	public void readUserDB() throws Exception
	{
	
		try
		{
			// This will load the MySQL driver, each DB has its own driver
			Class.forName("com.mysql.jdbc.Driver");		
			
			// Sets up the connection with the DB
			connect = DriverManager.getConnection("jbdc:mysql://127.0.0.1/db", username, pw);
			
			// Statements allow to issue SQL queries to the database
			statement = connect.createStatement();

                       // Omitted SQL commands below ....


2) I have included the 'mysql-connector-java-5.1.12-bin.jar' in both the Eclipse build path (Right mouse click on project -> properties -> java build path -> add external jar) and I have also included this jar file in the 'red5/lib/' installation location.

3) I *think* have to set the classpath in order for red5 to be able to use this jar, and I believe this is where the problem is happening. I have used this guide -> http://www.actionscript.org/resources/articles/617/1/Streaming-and-database-connection-with-red5-media-server/Page1.html to help me do this. I opened up a terminal and I tried issuing the specific location to where red5 is installed on my machine

export CLASSPATH=$CLASSPATH:/home/john/Desktop/Red5/lib/mysql-connector-java-5.1.12-bin.jar

After this did not work, I tried many various other syntax, but with no luck. The problem now is that I have issued multiple CLASSPATH commands, and when I issue:

john@Red5:~$ grep CLASSPATH .?*
.bash_history:export CLASSPATH=$CLASSPATH:/home/john/Desktop/Red5/lib/mysql-connector-java-5.1.12-bin.jar
.bash_history:export CLASSPATH=:/home/john/Desktop/Red5/lib/mysql-connector-java-5.1.12-bin.jar
.bash_history:export set CLASSPATH=/home/john/Desktop/Red5/lib/mysql-connector-java-5.1.12-bin.jar:$CLASSPATH
I have many different places loaded. I think if I can get the CLASSPATH correctly set, this will connect. Any thoughts on how to do this? I have literally exhausted my options and have been to many pages but not anything specific to this problem. Your help is greatly appreciated.



1
Michael
Points: 250
Posts:0
5/12/2010 11:36:57 AM



i have never done anything like this with red5 and flash. And I just have a beginer level of JAVA knowledge. Just a quick look on your code , found :

connect = DriverManager.getConnection("jbdc:mysql://127.0.0.1/db", username, pw);

shouldn't it be jdbc:mysql. just a guess if it effects connection

2
thallium205
Points: 20
Posts:0
5/12/2010 11:47:06 AM



Unfortunately, that did not work. However, I think my syntax is the correct one. I wanted to also mention two things:

1) I installed Red5 by merely extracting the zip to my desktop and installing the red5 plugin .2 for eclipse and linking the server up to the scripts.

2) The connector works because I am able to use it to have Eclipse connect to the database through Data Source Explorer.

3
thallium205
Points: 20
Posts:0
Accepted Answer
5/12/2010 11:57:46 AM



Thanks for pointing that out, you led me on to the problem. I was comparing my settings with the Data Source Explorer and that line, and I needed to include the port number:

// Sets up the connection with the DB  
connect = DriverManager.getConnection("jbdc:mysql://127.0.0.1:3306/db", username, pw); 
It's always the stupid stuff, isn't it?

4
Michael
Points: 250
Posts:0
5/12/2010 12:07:53 PM



cool , it happens !! many times when we are struck in a problem we think in a box( limited area) .


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 6+3 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions