Ways of Connecting to basex
Tuesday, 23 September 2014 · 6 messages · last reply 24 Sep 2014
FK
Furqan Khan23 Sep 2014 07:27 #
Hi
i m a little new to xml-db environment.
i need to know what are the possible ways to connect to baseX from client api's.
just like in sql the clients could connect to db using :
1)named pipes
2)shared memory
3)tcp and etc...
Does basex offer all the functionalists...
and by default whats the way a client connects,if the tcp connection is not explicitly specified...
regards
Furqan
DK
Dirk Kirsten23 Sep 2014 09:46 #
Hello Furqan,
welcome to the wonderful world of XML databases ;)
Right now, BaseX only supports TCP/IP for client connect. So by definition it will always be used as default.
The details of our server protocol can be found at
https://docs.basex.org/wiki/Server_Protocol
Cheers,
Dirk
Quoted text · Furqan Khan · 17 lines
On 23/09/14 07:27, Furqan Khan wrote: > Hi > i m a little new to xml-db environment. > i need to know what are the possible ways to connect to baseX from client > api's. > just like in sql the clients could connect to db using : > 1)named pipes > 2)shared memory > 3)tcp and etc... > > Does basex offer all the functionalists... > and by default whats the way a client connects,if the tcp connection is not > explicitly specified... > > regards > Furqan >
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
DK
Dirk Kirsten23 Sep 2014 13:45 #
Hello Furqan,
please keep in mind to always include the mailing list in the list of recipients, as others might also benefit from your questions. Also, other people might have much better answers than I can give you.
Sure you can use a network sniffer to listen to the traffic to/from a BaseX server. It is a standard TCP connection, so this is certainly possible. Just give it a try.
The same holds for using a proxy: It is a very conventional TCP connection, so using a proxy shouldn't be a problem. Nginx should works as well, I guess (although I am by no means an expert in nginx). We have used it quite some times for projects using RestXQ to load-balance requests. How to actually achieve that heavily depends on the proxy you decide to use, so you might have to read up there how to do it in detail.
Cheers,
Dirk
Quoted text · Furqan Khan · 67 lines
On 23/09/14 13:13, Furqan Khan wrote: > Derk,just a little quick question > if the using tcp/ip,so assuming my web server is on same machine port 8000 > and the basex server is also on same machine port 1984, > then will it be possible to use a packet sniffer such as wire shark to see > all incoming packets to the baseX-db port 1984... > Further more,is it possible for me to use a reverse proxy in front of basex > server (a web proxy such as nginx may not work)..,so that i may evaluate > incoming packets and trigger my script(java or lua) just as mysql has come > up with mysql proxy as a db-proxy(wh invokes lua scripts),is their any such > option available with basex or any such third party tool that could be > used...i further need to invoke a script,so its not only for analysis > purpose.... > thanks and regards > Furqan > > > On Tue, Sep 23, 2014 at 1:50 PM, Furqan Khan <furqankhan08 at gmail.com> wrote: > >> thanks for the reply >> cheers >> furqan >> >> On Tue, Sep 23, 2014 at 1:16 PM, Dirk Kirsten <dk at basex.org> wrote: >> >>> Hello Furqan, >>> >>> welcome to the wonderful world of XML databases ;) >>> >>> Right now, BaseX only supports TCP/IP for client connect. So by >>> definition it will always be used as default. >>> The details of our server protocol can be found at >>> https://docs.basex.org/wiki/Server_Protocol >>> >>> Cheers, >>> Dirk >>> >>> On 23/09/14 07:27, Furqan Khan wrote: >>>> Hi >>>> i m a little new to xml-db environment. >>>> i need to know what are the possible ways to connect to baseX from >>> client >>>> api's. >>>> just like in sql the clients could connect to db using : >>>> 1)named pipes >>>> 2)shared memory >>>> 3)tcp and etc... >>>> >>>> Does basex offer all the functionalists... >>>> and by default whats the way a client connects,if the tcp connection is >>> not >>>> explicitly specified... >>>> >>>> regards >>>> Furqan >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basex.org >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> >> >> >
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
FK
Furqan Khan24 Sep 2014 08:15 #
hie dirk,i will make that a practice.
getting back to reverse proxy,when using restxq i some how think it is possible to proxy the web application but not the database server.lets take the following nginx configuration
nginx server configuration :
server {
listen *:80; //nginx server running on port 80. server_name www.mywebsite.com //port :8080 name of the website/database to proxy.
access_log logs/test.log;
location / {
proxy_pass http://localhost:8080/db/mywebsite.com;
//exact location of the site to be proxied }
Now what my question is that,this configuration works very well for a web application,that is all requests for website "www.mywebsite.com" are passed through the nginx server.
but if i want requests for a db server basex to pass through it how do i specify that.
i mean a web client can access www.mywebsite.com ,but a database client does not access the database directly from a browser....
assuming my basex server is running on port 1984 and the web application is running on port 8000 ,both on same machine.
now the web application opens the connection to port 1984 and sends queries that i want to capture before they hit the database....
And just to let u know,i m following a black box approach,i need to make the implementation code independent.
how can i do it with the described scenario
what can i specify in the server_name header
any help will be highly appreciated.
thanks
furqan
Quoted text · Dirk Kirsten · 103 lines
On Tue, Sep 23, 2014 at 5:15 PM, Dirk Kirsten <dk at basex.org> wrote: > Hello Furqan, > > please keep in mind to always include the mailing list in the list of > recipients, as others might also benefit from your questions. Also, > other people might have much better answers than I can give you. > > Sure you can use a network sniffer to listen to the traffic to/from a > BaseX server. It is a standard TCP connection, so this is certainly > possible. Just give it a try. > > The same holds for using a proxy: It is a very conventional TCP > connection, so using a proxy shouldn't be a problem. Nginx should works > as well, I guess (although I am by no means an expert in nginx). We have > used it quite some times for projects using RestXQ to load-balance > requests. How to actually achieve that heavily depends on the proxy you > decide to use, so you might have to read up there how to do it in detail. > > Cheers, > Dirk > > On 23/09/14 13:13, Furqan Khan wrote: > > Derk,just a little quick question > > if the using tcp/ip,so assuming my web server is on same machine port > 8000 > > and the basex server is also on same machine port 1984, > > then will it be possible to use a packet sniffer such as wire shark to > see > > all incoming packets to the baseX-db port 1984... > > Further more,is it possible for me to use a reverse proxy in front of > basex > > server (a web proxy such as nginx may not work)..,so that i may evaluate > > incoming packets and trigger my script(java or lua) just as mysql has > come > > up with mysql proxy as a db-proxy(wh invokes lua scripts),is their any > such > > option available with basex or any such third party tool that could be > > used...i further need to invoke a script,so its not only for analysis > > purpose.... > > thanks and regards > > Furqan > > > > > > On Tue, Sep 23, 2014 at 1:50 PM, Furqan Khan <furqankhan08 at gmail.com> > wrote: > > > >> thanks for the reply > >> cheers > >> furqan > >> > >> On Tue, Sep 23, 2014 at 1:16 PM, Dirk Kirsten <dk at basex.org> wrote: > >> > >>> Hello Furqan, > >>> > >>> welcome to the wonderful world of XML databases ;) > >>> > >>> Right now, BaseX only supports TCP/IP for client connect. So by > >>> definition it will always be used as default. > >>> The details of our server protocol can be found at > >>> https://docs.basex.org/wiki/Server_Protocol > >>> > >>> Cheers, > >>> Dirk > >>> > >>> On 23/09/14 07:27, Furqan Khan wrote: > >>>> Hi > >>>> i m a little new to xml-db environment. > >>>> i need to know what are the possible ways to connect to baseX from > >>> client > >>>> api's. > >>>> just like in sql the clients could connect to db using : > >>>> 1)named pipes > >>>> 2)shared memory > >>>> 3)tcp and etc... > >>>> > >>>> Does basex offer all the functionalists... > >>>> and by default whats the way a client connects,if the tcp connection > is > >>> not > >>>> explicitly specified... > >>>> > >>>> regards > >>>> Furqan > >>>> > >>> > >>> -- > >>> Dirk Kirsten, BaseX GmbH, http://basex.org > >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > >>> > >> > >> > > > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
DK
Dirk Kirsten24 Sep 2014 10:28 #
Hello Furqan,
as I said, I am no nginx expert and you are probably better off asking nginx people or on their mailing list for help. I would expect and guess, that "server_name" can also contain an IP address.
However, I read up on it a bit (see
http://serverfault.com/questions/96469/is-there-a-way-to-forward-a-port-based-on-subdomain) and I don't think this is easily possible by not using HTTP.
So for now I guess your only option would be to use the webserver and access BaseX using the REST or RESTXQ interface.
Cheers,
Dirk
Quoted text · Furqan Khan · 147 lines
On 24/09/14 08:15, Furqan Khan wrote: > hie dirk,i will make that a practice. > getting back to reverse proxy,when using restxq i some how think it is > possible to proxy the web application but not the database server.lets take > the following nginx configuration > > nginx server configuration : > server { > > listen *:80; //nginx server running on port 80. > server_name www.mywebsite.com //port :8080 name of the > website/database to proxy. > access_log logs/test.log; > > location / { > proxy_pass http://localhost:8080/db/mywebsite.com; > //exact location of the site to be proxied > > } > > > Now what my question is that,this configuration works very well for a web > application,that is all requests for website "www.mywebsite.com" are passed > through the nginx server. > but if i want requests for a db server basex to pass through it how do i > specify that. > i mean a web client can access www.mywebsite.com ,but a database client > does not access the database directly from a browser.... > assuming my basex server is running on port 1984 and the web application is > running on port 8000 ,both on same machine. > now the web application opens the connection to port 1984 and sends queries > that i want to capture before they hit the database.... > And just to let u know,i m following a black box approach,i need to make > the implementation code independent. > how can i do it with the described scenario > what can i specify in the server_name header > any help will be highly appreciated. > thanks > furqan > > > > On Tue, Sep 23, 2014 at 5:15 PM, Dirk Kirsten <dk at basex.org> wrote: > >> Hello Furqan, >> >> please keep in mind to always include the mailing list in the list of >> recipients, as others might also benefit from your questions. Also, >> other people might have much better answers than I can give you. >> >> Sure you can use a network sniffer to listen to the traffic to/from a >> BaseX server. It is a standard TCP connection, so this is certainly >> possible. Just give it a try. >> >> The same holds for using a proxy: It is a very conventional TCP >> connection, so using a proxy shouldn't be a problem. Nginx should works >> as well, I guess (although I am by no means an expert in nginx). We have >> used it quite some times for projects using RestXQ to load-balance >> requests. How to actually achieve that heavily depends on the proxy you >> decide to use, so you might have to read up there how to do it in detail. >> >> Cheers, >> Dirk >> >> On 23/09/14 13:13, Furqan Khan wrote: >>> Derk,just a little quick question >>> if the using tcp/ip,so assuming my web server is on same machine port >> 8000 >>> and the basex server is also on same machine port 1984, >>> then will it be possible to use a packet sniffer such as wire shark to >> see >>> all incoming packets to the baseX-db port 1984... >>> Further more,is it possible for me to use a reverse proxy in front of >> basex >>> server (a web proxy such as nginx may not work)..,so that i may evaluate >>> incoming packets and trigger my script(java or lua) just as mysql has >> come >>> up with mysql proxy as a db-proxy(wh invokes lua scripts),is their any >> such >>> option available with basex or any such third party tool that could be >>> used...i further need to invoke a script,so its not only for analysis >>> purpose.... >>> thanks and regards >>> Furqan >>> >>> >>> On Tue, Sep 23, 2014 at 1:50 PM, Furqan Khan <furqankhan08 at gmail.com> >> wrote: >>> >>>> thanks for the reply >>>> cheers >>>> furqan >>>> >>>> On Tue, Sep 23, 2014 at 1:16 PM, Dirk Kirsten <dk at basex.org> wrote: >>>> >>>>> Hello Furqan, >>>>> >>>>> welcome to the wonderful world of XML databases ;) >>>>> >>>>> Right now, BaseX only supports TCP/IP for client connect. So by >>>>> definition it will always be used as default. >>>>> The details of our server protocol can be found at >>>>> https://docs.basex.org/wiki/Server_Protocol >>>>> >>>>> Cheers, >>>>> Dirk >>>>> >>>>> On 23/09/14 07:27, Furqan Khan wrote: >>>>>> Hi >>>>>> i m a little new to xml-db environment. >>>>>> i need to know what are the possible ways to connect to baseX from >>>>> client >>>>>> api's. >>>>>> just like in sql the clients could connect to db using : >>>>>> 1)named pipes >>>>>> 2)shared memory >>>>>> 3)tcp and etc... >>>>>> >>>>>> Does basex offer all the functionalists... >>>>>> and by default whats the way a client connects,if the tcp connection >> is >>>>> not >>>>>> explicitly specified... >>>>>> >>>>>> regards >>>>>> Furqan >>>>>> >>>>> >>>>> -- >>>>> Dirk Kirsten, BaseX GmbH, http://basex.org >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>>> >>>> >>> >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basex.org >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >> >
--
Dirk Kirsten, BaseX GmbH, http://basex.org
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
| Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
FK
Furqan Khan24 Sep 2014 11:56 #
hmmm
i have already tried with ip address on server_name.does not work that way....
n ithink i may go ahead n modify the besexclient api....
thanks n cheers
Quoted text · Dirk Kirsten · 180 lines
On Wed, Sep 24, 2014 at 1:58 PM, Dirk Kirsten <dk at basex.org> wrote: > Hello Furqan, > > as I said, I am no nginx expert and you are probably better off asking > nginx people or on their mailing list for help. I would expect and > guess, that "server_name" can also contain an IP address. > > However, I read up on it a bit (see > > http://serverfault.com/questions/96469/is-there-a-way-to-forward-a-port-based-on-subdomain > ) > and I don't think this is easily possible by not using HTTP. > > So for now I guess your only option would be to use the webserver and > access BaseX using the REST or RESTXQ interface. > > Cheers, > Dirk > > On 24/09/14 08:15, Furqan Khan wrote: > > hie dirk,i will make that a practice. > > getting back to reverse proxy,when using restxq i some how think it is > > possible to proxy the web application but not the database server.lets > take > > the following nginx configuration > > > > nginx server configuration : > > server { > > > > listen *:80; //nginx server running on port 80. > > server_name www.mywebsite.com //port :8080 name of the > > website/database to proxy. > > access_log logs/test.log; > > > > location / { > > proxy_pass http://localhost:8080/db/mywebsite.com; > > //exact location of the site to be proxied > > > > } > > > > > > Now what my question is that,this configuration works very well for a web > > application,that is all requests for website "www.mywebsite.com" are > passed > > through the nginx server. > > but if i want requests for a db server basex to pass through it how do i > > specify that. > > i mean a web client can access www.mywebsite.com ,but a database client > > does not access the database directly from a browser.... > > assuming my basex server is running on port 1984 and the web application > is > > running on port 8000 ,both on same machine. > > now the web application opens the connection to port 1984 and sends > queries > > that i want to capture before they hit the database.... > > And just to let u know,i m following a black box approach,i need to make > > the implementation code independent. > > how can i do it with the described scenario > > what can i specify in the server_name header > > any help will be highly appreciated. > > thanks > > furqan > > > > > > > > On Tue, Sep 23, 2014 at 5:15 PM, Dirk Kirsten <dk at basex.org> wrote: > > > >> Hello Furqan, > >> > >> please keep in mind to always include the mailing list in the list of > >> recipients, as others might also benefit from your questions. Also, > >> other people might have much better answers than I can give you. > >> > >> Sure you can use a network sniffer to listen to the traffic to/from a > >> BaseX server. It is a standard TCP connection, so this is certainly > >> possible. Just give it a try. > >> > >> The same holds for using a proxy: It is a very conventional TCP > >> connection, so using a proxy shouldn't be a problem. Nginx should works > >> as well, I guess (although I am by no means an expert in nginx). We have > >> used it quite some times for projects using RestXQ to load-balance > >> requests. How to actually achieve that heavily depends on the proxy you > >> decide to use, so you might have to read up there how to do it in > detail. > >> > >> Cheers, > >> Dirk > >> > >> On 23/09/14 13:13, Furqan Khan wrote: > >>> Derk,just a little quick question > >>> if the using tcp/ip,so assuming my web server is on same machine port > >> 8000 > >>> and the basex server is also on same machine port 1984, > >>> then will it be possible to use a packet sniffer such as wire shark to > >> see > >>> all incoming packets to the baseX-db port 1984... > >>> Further more,is it possible for me to use a reverse proxy in front of > >> basex > >>> server (a web proxy such as nginx may not work)..,so that i may > evaluate > >>> incoming packets and trigger my script(java or lua) just as mysql has > >> come > >>> up with mysql proxy as a db-proxy(wh invokes lua scripts),is their any > >> such > >>> option available with basex or any such third party tool that could be > >>> used...i further need to invoke a script,so its not only for analysis > >>> purpose.... > >>> thanks and regards > >>> Furqan > >>> > >>> > >>> On Tue, Sep 23, 2014 at 1:50 PM, Furqan Khan <furqankhan08 at gmail.com> > >> wrote: > >>> > >>>> thanks for the reply > >>>> cheers > >>>> furqan > >>>> > >>>> On Tue, Sep 23, 2014 at 1:16 PM, Dirk Kirsten <dk at basex.org> wrote: > >>>> > >>>>> Hello Furqan, > >>>>> > >>>>> welcome to the wonderful world of XML databases ;) > >>>>> > >>>>> Right now, BaseX only supports TCP/IP for client connect. So by > >>>>> definition it will always be used as default. > >>>>> The details of our server protocol can be found at > >>>>> https://docs.basex.org/wiki/Server_Protocol > >>>>> > >>>>> Cheers, > >>>>> Dirk > >>>>> > >>>>> On 23/09/14 07:27, Furqan Khan wrote: > >>>>>> Hi > >>>>>> i m a little new to xml-db environment. > >>>>>> i need to know what are the possible ways to connect to baseX from > >>>>> client > >>>>>> api's. > >>>>>> just like in sql the clients could connect to db using : > >>>>>> 1)named pipes > >>>>>> 2)shared memory > >>>>>> 3)tcp and etc... > >>>>>> > >>>>>> Does basex offer all the functionalists... > >>>>>> and by default whats the way a client connects,if the tcp connection > >> is > >>>>> not > >>>>>> explicitly specified... > >>>>>> > >>>>>> regards > >>>>>> Furqan > >>>>>> > >>>>> > >>>>> -- > >>>>> Dirk Kirsten, BaseX GmbH, http://basex.org > >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > >>>>> > >>>> > >>>> > >>> > >> > >> -- > >> Dirk Kirsten, BaseX GmbH, http://basex.org > >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 > >> > > > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
Written for BaseX 7.9. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery