Подскажите, можно ли конектиться к mySQL серверу непосредственно через ХАМЭЭЛЬсокет.
У меня есть результат но положительным его не назовешь :-( (хотя любой результат изысканий можно назвать положительным)
Делаю так:
Код:
//lockalhost
var hostName:String = "127.0.0.1";
var port:uint = 3306;
var socket:XMLSocket;
var mySocket = new XMLSocket();
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.CLOSE, closeHandler);
dispatcher.addEventListener(Event.CONNECT, connectHandler);
dispatcher.addEventListener(DataEvent.DATA, dataHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
}
function closeHandler(event:Event):void {
trace("closeHandler: " + event);
}
function connectHandler(event:Event):void {
trace("connectHandler: " + event);
}
function dataHandler(event:DataEvent):void {
trace("dataHandler: " + event);
}
function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event);
}
function progressHandler(event:ProgressEvent):void {
trace("progressHandler loaded:" + event.bytesLoaded + " total: " + event.bytesTotal);
}
function securityErrorHandler(event:SecurityErrorEvent):void {
trace("securityErrorHandler: " + event);
}
configureListeners(mySocket);
mySocket.connect(hostName,port)
_________
При этом в mySQLAdministrator появляется сообщение о не авторизированном подключении к серверу.
А флэш в аутпут выдает такой мегатрэш.
_________
Код:
connectHandler: [Event type="connect" bubbles=false cancelable=false eventPhase=2]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="E"]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="
5.0.27-community-nt-log"]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="7"]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="=;MQ.3V6"]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=",ў "]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data=null]
dataHandler: [DataEvent type="data" bubbles=false cancelable=false eventPhase=2 data="JQ8bf[u[I;-l"]
closeHandler: [Event type="close" bubbles=false cancelable=false eventPhase=2]
___________________________________
Тот самый mySQLAdministrator в своем логе говорит, что мол соединение оборвано т.к. приложение не может прочесть серверные пакеты (какое приложение я не понял), если я правильно и туда куда нужно посмотрел и понял что увидел :-) по времени поялвения в логе вроде то . . .
___________________________________
Отсюда вопросы:
1. Вроде работает, да/нет?
2. Почему ответ сервера в нечитабельном виде и как его прочесть (видно дело в энкодинге где и какой ставить и (главное как)).
3. В каком виде (и форме) :-) создавать XML запросы передаваемые через
XMLSocket.send(someXMLdata)
4. Если все это не будет работать, то скажите почему, а иначе ничего не говорите и не разубеждайте меня.
P.S. Я думаю, что все можно заставить работать, кидать запросы и получать ответы. Да, классов для этого нет (или есть :-)), но есть бинарные массивы и тому подобное и все можно сделать, или нет :-). Лишь бы наладить "трубопровод". . . С КолдФьюжином же наладили гады (да, походу на уровне API)!