You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/asciidoc/chapters/connection/connection.adoc
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -53,12 +53,17 @@ public class HelloServer {
53
53
----
54
54
55
55
The first line of this code is important -- it tells Java to load the Jaybird JDBC driver.
56
-
As required by the JDBC specification, at this point driver registers itself with `java.sql.DriverManager`.
56
+
As required by the JDBC specification, at this point the driver registers itself with `java.sql.DriverManager`.
57
57
58
58
Since Java 6 (JDBC 4), explicitly loading the driver using `Class.forName("org.firebirdsql.jdbc.FBDriver")` is no longer necessary, except when the driver is not on the system class path.
59
59
Examples where it may be necessary to explicitly load the driver are web applications that include the driver in the deployment (e.g. in `WEB-INF/lib` of the WAR).
60
60
There, the driver is not on the system class path, so it will need to be loaded explicitly.
61
61
62
+
[TIP]
63
+
====
64
+
Explicitly loading the driver with `Class.forName("org.firebirdsql.jdbc.FBDriver")` may aid in debugging "`__No suitable driver found for jdbc:firebird...__`" errors (e.g. whether the driver is not on the classpath, or it was found but an error occurred during loading or initialization, or -- if the error goes away -- it was not loaded by automatic driver loading).
65
+
====
66
+
62
67
We will leave out usages of `Class.forName` in further examples;
63
68
they will work because of automatic driver loading.
64
69
@@ -95,7 +100,7 @@ java\
95
100
The second statement of the example tells the `java.sql.DriverManager` to open a database connection to the Firebird server running on localhost, and the path to the database is `c:/database/employee.fdb`.
96
101
97
102
The connection specification consists of the host name of the database server, optionally you can specify a port (by default port 3050 is used).
98
-
The host name can be specified using either its DNS name (for example `fb-server.mycompany.com` or just `fb-server`), or its IP address (for example `192.168.0.5`, or `[1080::8:800:200C:417A]` for an IPv6 address).
103
+
The host name can be specified using either its DNS name (for example `fb-server.mycompany.com` or just `fb-server`), or its IP address (e.g. `192.0.2.5`, or `[2001:db8::5]` for an IPv6 address).
99
104
100
105
After the server name and port, the alias or path to the database is specified.
101
106
We suggest to specify a database alias instead of the absolute database path.
@@ -105,7 +110,7 @@ The format of the path depends on the platform of the Firebird server.
105
110
106
111
On Windows, the path must include the drive letter and path, for example `c:/database/employee.fdb`, which points to the employee database that can be found in the `database` directory of drive `C:`.
107
112
Java (and Firebird) supports either `/` or `\` (escaped as `\\`) as path separator on the Windows platform.
108
-
On Unix and Linux platform, you can use only `/` as the path separator.
113
+
On Unix and Linux platforms, you can use only `/` as the path separator.
109
114
110
115
On Unix platforms the path must include the root, as the path is otherwise interpreted relative to a server-dependent folder.
111
116
Having to include the root has the effect that a database in `/var/firebird/employee.fdb` needs to use a double `//` after the host name (and port) in the connection string: `jdbc:firebird://localhost//var/firebird/employee.fdb`.
0 commit comments