MQRC_NOT_AUTHORIZED error while connecting to Websphere MQ 7.1 - ibm-mq

I am "very" new to IBM Websphere Mq, I'll try to give as much details as possible.
I've got Websphere MQ 7.1 installed on Windows server 2003 running on Vmware Workstation. The Host is running Windows 7 with Websphere MQ Client and my ASP.NET application. (My application is supposed to connect to Windows server 2003 Websphere's Queue manager via SVRCONN channel, the Websphere client installed on the host is used just for testing purpose, connecting WMQ Client to WMQ Server results in an AMQ4036 access not authorized error, which leads to conclusion server configuration needed!)
Both System can ping each other and are on the same local network. (did I also mentioned that port 1415 is opened and TCP listener is running on the server virtual machine?)
ASP.NET code segment :
queueManager = new MQQueueManager(queueManagerName, queueProperties);
with queueManagerName matching the server's queue manager and queueProperties as following:
queueProperties[MQC.HOST_NAME_PROPERTY] = "192.168.203.128";
queueProperties[MQC.PORT_PROPERTY] = 1415;
queueProperties[MQC.CHANNEL_PROPERTY] = "QM_TEST.SVRCONN";
queueProperties[MQC.USER_ID_PROPERTY] = "";
queueProperties[MQC.PASSWORD_PROPERTY] = "";
when compiling I get the MQRC_NOT_AUTHORIZED exception and this following logs in AMQERR01.log on server side (NOTE: The IBM WMQ is installed in french language, the logs are generated in french, but I think you'll manage to understand the error.)
3/04/2013 21:32:25 - Process(1120.3) User(MUSR_MQADMIN) Program(amqzmur0.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ6287: WebSphere MQ VC:\Program Files\IBM\WebSphere MQ (Installation1).
EXPLICATION :
Informations système WebSphere MQ :
Produit :- Windows Server 2003, Build 3790: SP1 (MQ Windows 32-bit)
Version :- C:\Program Files\IBM\WebSphere MQ (Installation1)
Informations hôte :- 7.1.0.2 (p710-002-121029)
ACTION :
Aucun(e).
-------------------------------------------------------------------------------
13/04/2013 21:32:25 - Process(2128.11) User(MUSR_MQADMIN) Program(amqzlaa0.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ8075: L'autorisation a échoué car il est impossible d'obtenir le SID de
l'entité 'hatrix'.
EXPLICATION :
Le gestionnaire des droits d'accès aux objets n'a pas pu obtenir le SID de
l'entité spécifiée. Cet incident peut être dû à l'absence de la machine locale
du domaine (l'entité ne peut donc pas être localisée) ou à l'inexistence de
l'entité.
ACTION :
Vérifiez que l'entité est valide et que tous les contrôleurs de domaine requis
sont disponibles. Il peut être nécessaire de créer l'entité sur la machine
locale.
----- amqzfubn.c : 2227 -------------------------------------------------------
13/04/2013 21:32:25 - Process(2524.7) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ9245: Impossible d'extraire des détails de compte pour l'ID utilisateur de
canal MCA.
EXPLICATION :
WebSphere MQ n'a pas pu extraire des détails de compte pour l'ID utilisateur de
canal MCA Hatrix. Il s'agit de l'ID utilisateur MCA pour le canal
QM_TEST.SVRCONN sur le gestionnaire de files d'attente QM_TEST. Il peut avoir
été défini dans la définition de canal ou fourni par un exit de canal ou un
client.
ACTION :
Vérifiez que l'ID utilisateur est correct et qu'il est défini dans le système
local Windows, le domaine local ou un domaine de confiance. Dans le cas d'un ID
utilisateur de domaine, assurez-vous que que tous les contrôleurs de domaines
nécessaires sont disponibles.
----- cmqxrsrv.c : 1778 -------------------------------------------------------
13/04/2013 21:32:25 - Process(2128.11) User(MUSR_MQADMIN) Program(amqzlaa0.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ8073: Echec de l'autorisation. Le SID ((None)) n'a pas pu être corrélé.
EXPLICATION :
Le gestionnaire de droits d'accès aux objets n'a pas pu faire correspondre le
SID spécifié à des informations connues d'entité et de domaine.
ACTION :
Assurez-vous que l'application fournit un SID reconnu sur ce système, que tous
les contrôleurs de domaines nécessaires sont disponibles et que les règles de
sécurité sont correctement définies.
----- amqzfubn.c : 4351 -------------------------------------------------------
DISPLAY CHLAUTH(QM_TEST.SVRCONN) command returns:
CHLAUTH(QM_TEST.SVRCONN) TYPE(USERMAP)
DESCR( ) CUSTOM( )
ADDRESS(*) CLNTUSER(HATRIX)
MCAUSER( ) USERSRC(CHANNEL)
WARN(NO) ALTDATE(2013-04-13)
ALTTIME(13.53.03)
AMQ8878: Affichage des détails relatifs à l'enregistrement d'authentification de
canal.
CHLAUTH(QM_TEST.SVRCONN) TYPE(USERMAP)
DESCR( ) CUSTOM( )
ADDRESS(*) CLNTUSER(MQM)
MCAUSER( ) USERSRC(CHANNEL)
WARN(NO) ALTDATE(2013-04-13)
ALTTIME(13.57.59)
AMQ8878: Affichage des détails relatifs à l'enregistrement d'authentification de
canal.
CHLAUTH(QM_TEST.SVRCONN) TYPE(ADDRESSMAP)
DESCR( ) CUSTOM( )
ADDRESS(*) MCAUSER(ADMINISTRATEUR)
USERSRC(MAP) WARN(NO)
ALTDATE(2013-04-13) ALTTIME(01.53.52)
(note that i have added couple rules, and USERID Hatrix does not exist, i have included it in a SET CHLAUTH command for testing purpose)
I thought it has to do with MCAuser so I gave it a try with the MCAuser set to "Administrateur" (which is the admin's name on WMQ) and connecting with:
queueProperties[MQC.USER_ID_PROPERTY] = "Administrateur";
Still gives me the same error but with different server side log output:
13/04/2013 21:41:18 - Process(1120.3) User(MUSR_MQADMIN) Program(amqzmur0.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ6287: WebSphere MQ VC:\Program Files\IBM\WebSphere MQ (Installation1).
EXPLICATION :
Informations système WebSphere MQ :
Produit :- Windows Server 2003, Build 3790: SP1 (MQ Windows 32-bit)
Version :- C:\Program Files\IBM\WebSphere MQ (Installation1)
Informations hôte :- 7.1.0.2 (p710-002-121029)
ACTION :
Aucun(e).
-------------------------------------------------------------------------------
13/04/2013 21:41:18 - Process(2524.8) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ9776: La canal a été bloqué par l'ID utilisateur.
EXPLICATION :
Le canal entrant 'QM_TEST.SVRCONN' a été bloqué à partir de l'adresse
'192.168.203.1' parce que les valeurs actives du canal étaient mappées sur un
ID utilisateur qui devrai t être bloqué. Les valeurs actives du canal étaient
**'MCAUSER(Administrateur) CLNTUSER(Hatrix)'.**
ACTION :
Prenez contact avec l'administrateur système qui examinera les enregistrements
d'authentification de canal pour s'assurer que les paramètres corrects ont été
configurés. Le commutateur ALTER QMGR CHLAUTH permet de contrôler si les
enregistrements d'authentification de canal sont utilisés. La commande DISPLAY
CHLAUTH peut être utilisée pour interroger les enregistrements
d'authentification de canal.
----- cmqxrmsa.c : 1004 -------------------------------------------------------
13/04/2013 21:41:18 - Process(2524.8) User(MUSR_MQADMIN) Program(amqrmppa.exe)
Host(HATRIXX-82HDFHA) Installation(Installation1)
VRMF(7.1.0.2) QMgr(QM_TEST)
AMQ9999: Le canal 'QM_TEST.SVRCONN' vers l'hôte 'FAIROUZ (192.168.203.1)' s'est
terminé anormalement.
EXPLICATION :
Le programme du canl s'exécutant sous l'ID processus 2524(488) pour le canal
'QM_TEST.SVRCONN' a pris fin anormalement. Le canal est 'FAIROUZ
(192.168.203.1)'. Dans certains cas, son nom ne peut pas être déterminé et il
est représenté par '????'.
ACTION :
Examinez les messages d'erreur précédents du programme de canal dans les
journaux des erreurs afin de déterminer la cause de l'incident. Notez que ce
message peut être totalement exclus ou supprimé en réglant les attributs
"ExcludeMessage" ou "SuppressMessage" sous la strophe "QMErrorLog" dans le
fichier qm.ini. D'autres informations figurent dans le guide d'administration
du système.
----- amqrmrsa.c : 925 --------------------------------------------------------
What I couldn't understand is, what's the use of USERID and PASSWORD in the queuemanager properties in ASP.NET where the USERID identified in WMQ is "Hatrix" (which is the windows 7 account's name).
Do I have to create a new USERID "Hatrix" in WMQ in order to make my code works? (i couldn't figured out how )
Thanks in advance,
MqDebug.

First issue is that the QMgr must be able to resolve the ID passed to it. That means the ID either is defined locally or in a domain to which the QMgr has access. Normally, permissions are granted on the group and if so then it too must be resolved by the receiving QMgr.
Now comes the question of what, exactly, does the QMgr resolve? When you have a connection from a Windows machine to a QMgr on a Windows machine then the ID that is passed by the channel is the Windows SID which is a Universally Unique Identifier (UUID)and not the text string. Similarly, the group resolves to a Windows SID.
So, for example, you may have an ID called ADMINISTRATEUR defined locally on two Windows boxes and it still fails. The errors will say that the ID presented was ADMINISTRATEUR and that the ID is not authorized and you can clearly see in the dspmqaut commands that ADMINISTRATEUR is authorized. Except what is happening is that ADMINISTRATEUR on one host has its unique UUID and the account of the same name on the other host has a different UUID and Windows is looking at the UUID and not the text string.
When you have the same ID defined in multiple places, the QMgr must be able to differentiate between them. When it cannot, strange and unusual things occur.
For example, let's say you define a channel with MCAUSER('hatrix') and then run setmqaut -p hatrix. Let's further stipulate that the hatrix ID is not defined locally but rather is defined in both DOMAINA and DOMAINB and that when the command is run, the DOMAINA domain server is first in the search path.
The setmqaut command resolves the name hatrix to a UUID defined in DOMAINA.
Later due to normal activity in the network, DOMAINB rises to the first spot in the domain search path. Now when the MCAUSER('hatrix') attempts to connect, the string hatrix resolves in DOMAINB which is a different UUID than the one the setmqaut command resolved. The channel which was connecting normally suddenly throws a 2035 error.
The answer to this problem is to qualify both the setmqaut command and the MCAUSER value with the desired domain. For example, setmqaut -p hatrix#DOMAINA and then MCAUSER('hatrix#DOMAINA') will work regardless of whether DOMAINA or DOMAINB are first in the search path, or even if hatrix is defined locally on the WMQ host server. (Assuming that hatrix is indeed defined in DOMAINA of course.
As a rule, you generally do not want to use the -p option on setmqaut commands. The only exception is Windows hosts, and then only when the ID is qualified with a domain or server name as shown above.
Finally, leaving the channel's MCAUSER blank is what allows your Windows ID to flow to the MCA and be used for authorization checks. What you need to realize is that there is no authentication going on. Yes, it's true that the Windows client will send its Windows SID. However if you run a Linux VM on your Windows box and connect with that, there is no SID to pass and so the Windows QMgr falls back to resolving the string value of the ID. That means anyone can connect to that channel as any ID just by asserting the desired ID from a non-Windows client.
So, strongly authenticate administrative connections with certificates. For low-privileged connections, use CHLAUTH rules or an exit to set the MCAUSER rather than letting it flow through, and then use setmqaut to make sure that MCAUSER is not administrative. That means never grant +set on the QMgr and +crt on queues to non-admins and avoid +setid, +setall wherever possible.
For lots more WMQ Security content, please go to t-rob.net.

Use setmqaut to assign permission to "Hatrix" UserID but it is better to do it against a group rather than a UserID.

fixing...the command is
setmquat -m qmgrname -t qmgr -p username +allqmi
whrere:
qmgrname is the name of qmgr
username is the account name under eclipse is running and that account is not in ban list.

Related

ORA-12505 while creating new connection in Oracle SQL Developer

I installed few moments later the Oracle database XE 18.4.0.0.0 (18c).
Next I downloaded the Oracle SQL Developer tool and I tried to create a new connection, but I'm getting this error:
The master password is correct and the listerner is running, (UPDATED after #EdStevens reply):
C:\WINDOWS\system32> lsnrctl start
LSNRCTL for 64-bit Windows: Version 18.0.0.0.0 - Production on 22-OTT-2020 09:04:27
Copyright (c) 1991, 2018, Oracle. All rights reserved.
Avvio di tnslsnr: attendere...
TNSLSNR for 64-bit Windows: Version 18.0.0.0.0 - Production
Il file dei parametri di sistema Þ C:\app\gabri\product\18.0.0\dbhomeXE\network\admin\listener.ora
Ascolto su: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Connessione a (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521)))
STATO del LISTENER
------------------------
Alias LISTENER
Versione TNSLSNR for 64-bit Windows: Version 18.0.0.0.0 - Production
Data di inizio 22-OTT-2020 09:04:34
Tempo di attivitÓ 0 giorni 0 ore 0 min. 12 sec.
Livello trace off
Sicurezza ON: Local OS Authentication
SNMP OFF
File di parametri listenerC:\app\gabri\product\18.0.0\dbhomeXE\network\admin\listener.ora
Summary table degli endpoint di ascolto...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Summary table dei servizi...
Il servizio "CLRExtProc" ha 1 istanze.
L'istanza "CLRExtProc", stato UNKNOWN, ha 1 handler per questo servizio...
Il servizio "database" ha 1 istanze.
L'istanza "XE", stato UNKNOWN, ha 1 handler per questo servizio...
Il comando Þ stato eseguito
Here my listener.ora:
# listener.ora Network Configuration File: C:\app\gabri\product\18.0.0\dbhomeXE\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
DEFAULT_SERVICE_LISTENER = XE
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\gabri\product\18.0.0\dbhomeXE)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\gabri\product\18.0.0\dbhomeXE\bin\oraclr18.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = PortatileGabriele)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
And tnsnames.ora:
# tnsnames.ora Network Configuration File: C:\app\gabri\product\18.0.0\dbhomeXE\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
I hope that someone can help me!
Thanks in advance
EDIT:
C:\WINDOWS\system32>echo %ORACLE_HOMEd%
%ORACLE_HOMEd%
C:\WINDOWS\system32>echo %ORACLE_SID%
%ORACLE_SID%
C:\WINDOWS\system32>sqlplus / as sysdba'
SQL*Plus: Release 18.0.0.0.0 - Production on Gio Ott 22 14:27:19 2020
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
ERROR:
ORA-12560: TNS: errore dell'adattatore del protocollo
Immettere il nome utente: SYSTEM
Immettere la password:
ERROR:
ORA-12560: TNS: errore dell'adattatore del protocollo
Immettere il nome utente:
First, the error 'listener does not know of sid' is absolutley correct. We see from 'lsnrctl status' that no database is registered with the listener. So until you get a database actually started and registered with the listener, nothing else matters.
Second, once you do get a database running, your SQL Dev 'connection type' of 'basic' means you are supplying all necessary connection info directly, and tnsnames.ora is not called into play. NOthing wrong with that, but if you do want to use tnsnames, then change your connection type to 'tns'. The necessary input fields with change accordingly.
Third, as mentioned, whether you use tns or basic connection, you want to specify service name, not sid.

Jython scripts doesn't work when executing in ODI

I have an ODI job with a procedure that have 3 Tasks. These tasks are coded in Jython technology. When I execute these scripts using Jython standalone in my PC are working fine, but when I run them from the ODI menu these doesn't make nothing.
The execution is marked as OK and I don't see any error logs in any window.
I checked that code works in jython standalone. Tried with paths using "/", using "\", my folder (Using windows in development mode) has all permissions available.
FILE_NAME = "FILES-100-*-000001.csv"
NAS_FOLDER = "/apps/dataflow/src/"
WORK_FOLDER = "/apps/dataflow/target/"
#Extraemos prefijo y sufijo del fichero a procesar
splitted_value = FILE_NAME.split("*")
prefix = splitted_value[0]
suffix = splitted_value[1]
#Obtenemos listado de ficheros de la ruta del NAS y movemos los que cumplan condiciones al directorio WORK
files = os.listdir(NAS_FOLDER)
for file in files:
if file.find(prefix) >= 0 and file.find(suffix) > 0:
print "Fichero origen: " + NAS_FOLDER+file + " | Fichero destino: " + WORK_FOLDER+file
try:
os.rename(NAS_FOLDER+file, WORK_FOLDER+file)
except:
print("No se ha podido mover el fichero: " + NAS_FOLDER+file)
I expect the files moved succesfully. (These with the correct name and not moved before). I expect see any logs or error info too.
Thanks in advance.

Cannot connect to fresh installed DB2 on WINDOWS 10

I just installed a DB2 on my Windows 10 laptop.
Installation looks ok.
If I run db2level I get this answer:
C:\IBM\SQLLIB\BIN>db2licm -l
Nome prodotto: "IBM DB2 Developer-C Edition"
Tipo di licenza: "Comunità "
Data scadenza: "Permanente"
Identificativo prodotto: "db2dec"
Informazioni sulla versione: "11.1"
Quantità massima di memoria (GB): "16"
Numero massimo di core: "4"
Numero massimo di tablespace (GB): "100"
When I run db2licm -l I get this:
C:\IBM\SQLLIB\BIN>db2licm -l
Nome prodotto: "IBM DB2 Developer-C Edition"
Tipo di licenza: "Comunità "
Data scadenza: "Permanente"
Identificativo prodotto: "db2dec"
Informazioni sulla versione: "11.1"
Quantità massima di memoria (GB): "16"
Numero massimo di core: "4"
Numero massimo di tablespace (GB): "100"
DB2 is started, I can issue db2stop and db2start command without any issue.
And now the PROLBLEM: I cannot find a way to CONNECT to the DB2 instance.
In fact when I run CONNECT command CLPPlus window freezes this way:
CLPPlus window
while RAM usage start rising:
DB2 RAM usage
I googled IBM sites without finding any suitable solution.
Has anyone experienced the same problem?
Thanks a lot
Ettore
2018-10-22
I think you put me on the right way.
I checked whether I could create the SAMPLE database and I got this:
C:\IBM\SQLLIB\BIN>db2sampl
Creating database "SAMPLE"...
Existing "SAMPLE" database found...
The "-force" option was not specified...
Attempt to create the database "SAMPLE" failed.
SQL1005N L'alias del database "SAMPLE" esiste già nella directory del database locale oppure nella directory del database di sistema.
'db2sampl' processing complete.
So, SAMPLE database already existed, I tried to recreate it but operation failed:
C:\IBM\SQLLIB\BIN>db2sampl -force
Creating database "SAMPLE"...
Existing "SAMPLE" database found...
Dropping and recreating database "SAMPLE"...
Attempt to drop existing database "SAMPLE" failed.
Attempt to create the database "SAMPLE" failed.
SQL30082N Elaborazione di sicurezza non riuscita con codice di errore "3" ("PASSWORD MISSING"). SQLSTATE=08001
'db2sampl' processing complete.
Something was wrong with SAMPLE database.
So I tried to create a new database and it worked:
db2 => CREATE DATABASE TEST_DB AUTOMATIC STORAGE YES
DB20000I Il comando CREATE DATABASE è stato completato con esito positivo.
and CONNECT command worked too:
db2 => CONNECT TO TEST_DB
Informazioni sul collegamento del database
Server database = DB2/NT64 11.1.3.3
ID autorizzazione SQL = ETTORE
Alias database locale = TEST_DB
db2 =>
Then I tried to drop SAMPLE database:
db2 => DROP DATABASE SAMPLE
L'applicazione è già collegata a "DB2" mentre il comando emesso richiede un collegamento a "NDEDE68D" per l'esito positivo dell'esecuzione.
db2 =>
What does this mean?
When I give command DB2 in D:\IBM\SQLLIB\BIN I'm not aware about the Instance I'm connecting to. Is "NDEDE68D" another instance?
In any case I tried to connect TEST_DB to in DATA STUDIO and it succeeded:
IBM DATA STUDIO Connection to TEST_DB
while when I tried (again) to connect to SAMPLE db from the DB2 window, after a few seconds, DB2 had started devouring RAM:
RAM usage
Concluding, the problem now concerns just SAMPLE database.
How to connect to SAMPLE database or how to get rid of it and rebuild it?
Thanks a lot
2018-10-22 14:37
#Paul: here the answers to your questions.
Thanks a lot!
db2 => LIST NODE DIRECTORY
Directory nodo
Numero di voci nella directory = 1
Voce nodo 1:
Nome nodo = NDEDE68D
Commento
Tipo voce di directory = LOCAL
Protocollo = TCPIP
Nome Host = localhost
Nome servizio = 50000
db2 => LIST DATABASE DIRECTORY
Directory del database di sistema
Numero di voci nella directory = 2
Voce di database 1:
Alias del database = TEST_DB
Nome database = TEST_DB
Directory database locale = C:
Livello di release database = 14.00
Commento =
Tipo voce di directory = Indiretto
Numero partizione database catalogo = 0
Nome host server alternativo =
Numero porta server alternativo =
Voce di database 2:
Alias del database = SAMPLE
Nome database = SAMPLE
Nome nodo = NDEDE68D
Livello di release database = 14.00
Commento =
Tipo voce di directory = Remoto
Numero partizione database catalogo = -1
Nome host server alternativo =
Numero porta server alternativo =
db2 =>

Insert in Access Database via VB / Visual Studio (2017)

I´m trying to develop a system that reproduces a quiz game. Basically it´s developed with vb (vs 2017) and microsoft access database.
In certain point after the player choose the wrong answer, the system compiles the results with name, amount of righ questions and maximum score.
Aftewards it should record in the database the results., but, it doensnt make it.
My code follow bellow:
Sub RegistraJogo()
Try
Dim Conn As New OleDbConnection
Conn.ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source=DbDesafioQuiz.accdb"
Conn.Open()
Dim cmd = Conn.CreateCommand
cmd.CommandText = "INSERT INTO TbRecordes (Nome, Data, Pontos, Acertadas) VALUES (#Jogador, #Datas, #Pts, #Corretas)"
cmd.Parameters.AddWithValue("#Jogador", LbJogador.Text) 'nome do jogador
cmd.Parameters.AddWithValue("#Datas", CStr(Now())) 'data do jogo
cmd.Parameters.AddWithValue("#Pts", CStr(PontosTotais * QtdRespondidas)) 'variáveis com valores de pontos e qtd de questões resp
cmd.Parameters.AddWithValue("#Corretas", QtdRespondidas) 'qtd de questões respondidas
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
receivedData = 0
End Sub
Someone could help me, indicanting what i´m doing wrong? Thanks in advance.
I´ve changed the connection string, putting the complete address of database, like:
"c:\temp\dbdesafioquiz.accdb"

How to read multiline response from FTP server?

I am writing FTP client program in C. I am use blocking socket. I have put recv () in while loop and I break it when last two received characters are \r\n. I am able to run it on some servers but it doesn't read whole message on some servers like ftp.secyt.gov.ar.
I think the problem is because of the messages from server which contains characters \r \n together.
How should I deal with such case?
After sending the user name and password to server at ftp.secyt.gov.ar, I want to print the message received from server.
password = getpass("Password: ");
sprintf(pass, "PASS %s\r\n",password);
send(sockfd, pass, strlen(pass), 0);
while((no_of_bytes = recv(sockfd, message_from_server, MAXSZ, 0)) > 0)
{
message_from_server[no_of_bytes] = '\0';
printf("%s\n", message_from_server);
if (message_from_server[no_of_bytes-2] == '\r' &&
message_from_server[no_of_bytes-1] == '\n')
break;
}
Server sends this message:
230-=====================================================================
BIENVENIDOS AL SERVIDOR FTP DE LA MINCyT
----------------------------------------
Usuario anonymous, desde la maquina ::ffff:116.203.73.60, gracias por
utilizar el FTP del Ministerio de Ciencia, Tecnologia e
Innovacion Productiva.
Para sugerencias, consultas o informacin adicional nuestros correos
electrnicos son:
webmaster#mincyt.gov.ar
=========================================================================
230 User anonymous logged in.
But it is printing only:
230-=====================================================================
Your code reads a line (a string terminated by \r\n) from the server.
But an FTP response can be multi-line, according to the FTP specification.
See the RFC 959, section 4.2 FTP Replies:
Thus the format for multi-line replies is that the first line
will begin with the exact required reply code, followed
immediately by a Hyphen, "-" (also known as Minus), followed by
text. The last line will begin with the same code, followed
immediately by Space , optionally some text, and the Telnet
end-of-line code.
For example:
123-First line
Second line
234 A line beginning with numbers
123 The last line
The user-process then simply needs to search for the second
occurrence of the same reply code, followed by (Space), at
the beginning of a line, and ignore all intermediary lines. If
an intermediary line begins with a 3-digit number, the Server
must pad the front to avoid confusion.
See also How to know the end of FTP Welcome message.

Resources