Hi all , i am a beginner in java , and i don't manage to do a mysql
connection with red5 on a debian etch, please can you give me a clue :)
My test :
Here is a simple application to test "ApplicationAdapter" , the method :
"public boolean appConnect( IConnection conn , Object[] params )"
refused the connection if i don't put the true param in
the_nc.connect("rtmp://stream.hpifrance.com/myTest",true); so it works but
nothing is
loggued in my mysql database ...
If someone can help me , i desperate about this
//source code : Application.java
package org.red5.server.webapp.myTest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.red5.server.api.IConnection;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IScope;
import org.red5.server.api.IClient;
import org.red5.server.api.stream.ISubscriberStream;
import org.red5.server.api.service.IServiceCapableConnection;
import org.red5.server.api.scheduling.IScheduledJob;
import org.red5.server.api.scheduling.ISchedulingService;
import java.util.Map;
import java.util.Vector;
import java.util.Iterator;
import org.red5.io.utils.ObjectMap;
import java.sql.*;
public class Application extends ApplicationAdapter
{
static
{
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch ( ClassNotFoundException exception )
{
log.error( "ClassNotFoundException " + exception.getMessage( ) );
}
}
public boolean appStart ( )
{
log.info( "Red5First.appStart" );
return true;
}
public void appStop ( )
{
log.info( "Red5First.appStop" );
}
public boolean appConnect( IConnection conn , Object[] params )
{
log.info( "Red5First.appConnect " + conn.getClient().getId() );
boolean accept = (Boolean)params[0];
try{
Connection connexion =
DriverManager.getConnection("jdbc:mysql://127.0.0.1/red5","red5","supervisorred5");
Map properties = conn.getConnectParams();
//connection time
Long stamp = System.currentTimeMillis( );
// client ip
String ip = (String)conn.getRemoteAddress( );
// agent
String agent = (String)properties.get( "flashVer" );
// referrer
String referrer = (String)properties.get( "swfUrl" );
Statement sttmnt = connexion.createStatement( );
String insert = "INSERT INTO "
+ "`test`.`red5first_users` "
+
"(`counter`,`ip`,`referrer`,`flashversion`,`connection`)"
+ "VALUES(NULL,'" + ip + "','" + referrer + "','" + agent
+ "','" + stamp + "')";
// execute query
sttmnt.executeUpdate( insert );
}
catch ( SQLException exception )
{
log.error( "SQLException at appConnect: " +
exception.getMessage( ) );
}
if ( !accept ) rejectClient( "you passed false..." );
return true;
}
public void appDisconnect( IConnection conn , Object[] params )
{
log.info( "Red5First.appDisconnect " + conn.getClient().getId() );
}
}
//end source code
/////////////compilation ok
javac -classpath
/usr/lib/red5/lib/mysql-connector-java-5.0.6-bin.jar:/usr/lib/red5/red5.jar
Application.java
no error
/////////////jar ok
jar -cfv myTest.jar
no error
but when i connect with rtmp://stream.hpifrance.com/myTest
nothing is log in Mysql :(
Best regard .
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org