Listing 10.17 Connecting to the database. //———————————————————————- — // connect - JDBC API // // Try to make a database connection to the given URL. // The driver should return “null” if it realizes it is the wrong kind // of driver to connect to the given URL. This will be common, as when // the JDBC driver manager is asked to connect to a given URL, it passes // the URL to each loaded driver in turn. // // The driver should raise an SQLException if it is the right // driver to connect to the given URL, but has trouble connecting to // the database. // // The java.util.Properties argument can be used to pass arbitrary // string tag/value pairs as connection arguments. // Normally, at least “user” and “password” properties should be // included in the Properties. // // url The URL of the database to connect to. // // info a list of arbitrary string tag/value pairs as // connection arguments; normally, at least a “user” and // “password” property should be included. // // Returns a Connection to the URL. //———————————————————————- — public Connection connect( String url, java.util.Properties info) throws SQLException { if (traceOn()) { trace(”@connect (url=” + url + “)”); } // Ensure that we can understand the given URL if (!acceptsURL(url)) { return null; } // For typical JDBC drivers, it would be appropriate to check // for a secure environment before connecting, and deny access // to the driver if it is deemed to be unsecure. For the // SimpleText driver, if the environment is not secure, we will // turn it into a read-only driver. // Create a new SimpleTextConnection object SimpleTextConnection con = new SimpleTextConnection(); // Initialize the new object. This is where all of the // connection work is done. con.initialize(this, info);
Maybe you are looking hosting for companies or individuals who want a basic internet presence at budget price with no frills.From our experience you should check Budget Web Hosting part.