/usr/share/gtk-doc/html/libgda-5.0/gda-sql-manual-open.html is in libgda-5.0-doc 5.2.4-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Connections management: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="gda-sql.html" title="Part VII. Gda SQL console's user manual">
<link rel="prev" href="gda-sql-manual-dsn.html" title="DSN management">
<link rel="next" href="ch41s02.html" title="Meta data">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gda-sql.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gda-sql-manual-dsn.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ch41s02.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="chapter">
<div class="titlepage"><div><div><h2 class="title">
<a name="gda-sql-manual-open"></a>Connections management</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="sect1"><a href="gda-sql-manual-open.html#id-1.8.6.5">Virtual connections</a></span></dt>
<dt><span class="sect1"><a href="ch41s02.html">Meta data</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s02.html#id-1.8.6.6.6">Information about tables</a></span></dt>
<dt><span class="sect2"><a href="ch41s02.html#id-1.8.6.6.7">Information about views</a></span></dt>
<dt><span class="sect2"><a href="ch41s02.html#id-1.8.6.6.8">Information about schemas</a></span></dt>
<dt><span class="sect2"><a href="ch41s02.html#id-1.8.6.6.9">Information about other objects</a></span></dt>
</dl></dd>
</dl></div>
<p>
The console tool is able to handle several connections at the same time, they can dynamically be opened and
closed during a session. The current connection in use is indicated by the prompt.
Use the <span class="command"><strong>.c</strong></span> command to open a connection with the connection name (the name by which
the connection is identified within the tool) and a connection string; for example:
</p>
<pre class="programlisting">
gda> .c cnc1 SalesTest
cnc1>
</pre>
<p>
</p>
<p>
The list of connection can be listed using the same <span class="command"><strong>.c</strong></span> command without any argument, for example:
</p>
<pre class="programlisting">
ia32> .c
List of opened connections
Name | Provider | DSN or connection string | Username
-----+----------+--------------------------+---------
cnc1 | SQLite | SalesTest |
ia32 | SQLite | IA32Instructions |
(2 rows)
ia32>
</pre>
<p>
</p>
<p>
To switch from one connection to the other, use the <span class="command"><strong>.c</strong></span> command with the connection name to use
as single argument, for example to switch from using the "ia32" to the "cnc1" connection:
</p>
<pre class="programlisting">
ia32> .c cnc1
cnc1>
</pre>
<p>
</p>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id-1.8.6.5"></a>Virtual connections</h2></div></div></div>
<p>
Multiple connections can be <span class="emphasis"><em>bound together</em></span> into a single connection in which it is possible
to runs SQL statements. This effectively allows one to run SQL statements across multiple databases.
</p>
<p>
Binding connections together is done using the <span class="command"><strong>.bind CNC_NAME CNC_NAME1 CNC_NAME2 [CNC_NAME ...]</strong></span>
command which creates new connection named "CNC_NAME" which binds the connections names "CNC_NAME1" and "CNC_NAME2"
together (more connections can be bound); each connection to be bound into a virtual connection must of course
already have been opened. The tables of each bound connection will appear into the new virtual connection as named
"<cnc name>.<table name>".
</p>
<p>
In the following example, there are the "cnc1" and "cnc2" connections opened, and the "cnc3" connection is
a virtual connection binding "cnc1" and "cnc2":
</p>
<pre class="programlisting">
cnc2> .bind cnc3 cnc1 cnc2
Bound connections are as:
cnc1 in the 'cnc1' namespace
cnc2 in the 'cnc2' namespace
cnc3> .c
List of opened connections
Name | Provider | DSN or connection string | Username
-----+----------+--------------------------+---------
cnc1 | SQLite | DB_DIR=.;DB_NAME=pmodel |
cnc2 | SQLite | SalesTest |
cnc3 | | namespace cnc1 |
namespace cnc2
(3 rows)
cnc3>
</pre>
<p>
The contents of each "customers" table in each of the bound connection is accessible:
</p>
<pre class="programlisting">
cnc3> select * from cnc1.customers;
id | name | last_update | default_served_by | country | city
---+-----------------+-----------------------+-------------------+---------+-----
2 | Ed Lamton | 2008-08-12 00:00:00+0 | 4 | SP | MDR
3 | Lew Bonito | 2008-08-13 00:00:00+0 | 1 | FR | TLS
4 | Mark Lawrencep | 2007-12-25 00:00:00+0 | | SP | MDR
9 | Greg Popoff | 2007-12-25 00:00:00+0 | 2 | SP | MDR
10 | Vladimir Zirkov | 2001-01-31 00:00:00+0 | 4 | |
(5 rows)
cnc3> select * from cnc2.customers;
id | name | default_served_by | country | city
---+-----------------+-------------------+---------+-----
2 | Ed Lamton | 4 | SP | MDR
3 | Lew Bonito | 1 | FR | TLS
4 | Mark Lawrencep | | SP | MDR
9 | Greg Popoff | 2 | SP | MDR
10 | Vladimir Zirkov | 4 | |
(5 rows)
cnc3>
</pre>
<p>
The list of customers present in both tables are available as:
</p>
<pre class="programlisting">
cnc3> SELECT * FROM cnc1.customers WHERE name IN (SELECT name FROM cnc2.customers);
id | name | last_update | default_served_by | country | city
---+-----------------+-----------------------+-------------------+---------+-----
2 | Ed Lamton | 2008-08-12 00:00:00+0 | 4 | SP | MDR
3 | Lew Bonito | 2008-08-13 00:00:00+0 | 1 | FR | TLS
4 | Mark Lawrencep | 2007-12-25 00:00:00+0 | | SP | MDR
9 | Greg Popoff | 2007-12-25 00:00:00+0 | 2 | SP | MDR
10 | Vladimir Zirkov | 2001-01-31 00:00:00+0 | 4 | |
(5 rows)
cnc3>
</pre>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>
|