Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
This is what I do Since you are on Linux, chances are you already have what you need installed. I define a VOC item called TMP which looks like: 0001: F 0002: /tmp 0003: D_VOC And coding that looks like: OPEN ,TMP TO F.TMP ELSE STOP NO /tmp USRNO=@USERNO HOSTNAME= ; * example: http://servername (assumes port 3306) otherwise add --port=port#touse USERNAME= PASSWORD= * TEST=mysql --connect_timeout=15 --user=:USERNAME: --password=:PASSWORD: -h :HOSTNAME: /tmp/output:USRNO: EOF TEST-1=use orders; * TEST-1=select InvNo,TransID,GroupCode,Status from shippingdata where Status is not null; * * TEST-1=quit TEST-1=EOF * WRITE TEST ON F.TMP,TSQLCMD:USRNO CMD1=/tmp/MYSQLCMD:USRNO DELETE F.TMP,output:USRNO EXECUTE SH -c ':CMD1:' CAPTURING ERRORS * READ CRMDATA FROM F.TMP,output:USRNO ELSE PRINT NO MYSQLDATA FOR :USRNO UU=DCOUNT(CRMDATA,CHAR(254)) BLANK=CHAR(9):CHAR(9) RESULT= ; SKIP=1 FOR T=1 TO UU IF CRMDATAT#BLANK THEN IF INDEX(CRMDATAT,InvNo,1)#0 THEN SKIP=0 ; CONTINUE IF SKIP=1 THEN CONTINUE RESULT-1=CHANGE(CRMDATAT,CHAR(9),CHAR(253)) END NEXT T * DELETE F.TMP,MYSQLCMD:USRNO When completed: RESULT will have a 2 dimensioned Dynamic array - with the X dimension being the columns, and the Y dimension being the Rows ERRORS will have any messages from the database -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Manu Fernandes Sent: Saturday, October 01, 2011 4:55 AM To: u2-users@listserver.u2ug.org Subject: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ? Hi group, I'm looking for your experiences... From Universe/linux, I'll execute a mySQL sql phrase. mySQL is installed on a remote server. - What is the mysql-client to be installed beside Universe ? - How to execute a sql-phrase from UV/BASIC ? and capture the result !? Thanks for any advice. Manu ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
Points to keep in mind (misskeys) 1. change any referece of TSQLCMD to MYSQLCMD 2. If you need to add the --port=#, you need to add it to the TEST command and not to the HOSTNAME -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Monday, October 03, 2011 10:02 AM To: U2 Users List Subject: Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ? This is what I do HOSTNAME= ; * example: http://servername (assumes port 3306) otherwise add --port=port#touse * TEST=mysql --connect_timeout=15 --user=:USERNAME: --password=:PASSWORD: -h :HOSTNAME: /tmp/output:USRNO: EOF * WRITE TEST ON F.TMP,TSQLCMD:USRNO ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
The BCI works very well in such circumstances, I have used it lots of times. Take a read of the manual it is fairly easy to get going. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Manu Fernandes Sent: 01 October 2011 09:55 To: u2-users@listserver.u2ug.org Subject: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ? Hi group, I'm looking for your experiences... From Universe/linux, I'll execute a mySQL sql phrase. mySQL is installed on a remote server. - What is the mysql-client to be installed beside Universe ? - How to execute a sql-phrase from UV/BASIC ? and capture the result !? Thanks for any advice. Manu ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users - No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1410 / Virus Database: 1520/3930 - Release Date: 09/30/11 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
The easy answer is to pretend you're doing this from a web page, where the MP in LAMP is MySQL and PHP. From there you have a world full of answers rather than something U2-specific. Note that most shared hosts don't have a MySQL DBMS on the same system as the HTTP servers. They almost Always separate MySQL to a different box for queries, so examples for how to do this are plentiful. So write a small PHP script that does what you need, copy/paste from examples if required. Then invoke the script with a simple SH or ! to execute the script, passing in params. Capture the result with an Execute Capturing clause, or have the script write data to a directory which you reference as a type 1 or type 19. That's it. This one is fairly easy - just think outside of the MV box. HTH T From: Manu Fernandes From Universe/linux, I'll execute a mySQL sql phrase. mySQL is installed on a remote server. - What is the mysql-client to be installed beside Universe ? - How to execute a sql-phrase from UV/BASIC ? and capture the result !? ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
To followup to what Tony said, we do this with PHP by creating a JSON-formatted extract out of Unidata, then ftp it to the other system, then use Apache to kick off a job to post the file into MySQL and PostgreSQL. Works like a champ for small to medium data sets. For large datasets we do something significantly more complicated using triggers and a publisher that publishes changes to the Unidata files using the callHTTP interface to send data to a PHP script running on Apache. -Kevin http://www.PrecisOnline.com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [uv] from uv/linux, execute a remote mysql/sql stmt ?
I believe you'll need an ODBC driver for MySQL. You would then use the syntax described in UniVerse's Basic Calling Interface (BCI) documentation. On Sat, Oct 1, 2011 at 4:55 AM, Manu Fernandes e...@infodata.lu wrote: Hi group, I'm looking for your experiences... From Universe/linux, I'll execute a mySQL sql phrase. mySQL is installed on a remote server. - What is the mysql-client to be installed beside Universe ? - How to execute a sql-phrase from UV/BASIC ? and capture the result !? Thanks for any advice. Manu ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users