Connecting to SQL Database Servers
Documentation | Blog | Demos | Support
Connecting to SQL Database Servers
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
All SQL servers require that some type of connection be established between a client program and the server before any database operations can be attempted. In Zim, a connection between a Zim application and an SQL server is established by the “CONNECT” command and removed by the “DISCONNECT” command.
During the execution of any Zim application, a CONNECT command must have been executed prior to the execution of any Zim command requiring database operations to be performed by the SQL server. Connections can be multiple or single as explained below.
Single Connections
When SQL database servers are accessed one at a time, a connection is always followed by a disconnection. Example:
connect to “JDBCSAM” using (“SalesDB”, “sqlserver”, “admin”, “”, “1422”, “172.16.20.33”)
…
disconnect from “JDBCSAM”
…
connect to “JDBCSAM” using (“Marketing”, “oracle”, “scott”, “tiger”, “1501”, “www.mycompany.com”)
…
disconnect from “JDBCSAM”
…
Notice that each CONNECT statement is followed by a DISCONNECT statement. In the above example, the first connection is different from the second one but it can be the same as well.
Multiple or Concurrent Connections
In this scenario, more than one connection is established and maintained at the same time without an intervening disconnection:
connect to “JDBCSAM” using (“SalesDB”, “sqlserver”, “admin”, “”, “1422”, “172.16.20.33”)
connect to “MYJDBC” using (“Marketing”, “oracle”, “scott”, “tiger”, “1501”, “www.mycompany.com”)
…
disconnect from “MYJDBC”
disconnect from “JDBCSAM”
Now, the second connection is performed not to JDBCSAM anymore but an alias to it called MYJDBC. The reasoning behind this difference is that all ZIM objects need to reference a specific type of object (for Entity Sets, it is the EntType; for Relationships, it is the RelType and so on) and Zim needs to know which object belongs to each type.
The aliases are defined in the “zimalias.zim” configuration file as described in the Servers Alias Configuration File.
Obviously, an alias could have been used in the example for single connections as well.
5 out of 5 stars
1 rating
5 Stars | 100% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |