Using JDBC with Java Applications and Applets 74 (1and1 web hosting)
Using JDBC with Java Applications and Applets 74 Table 5.1 Connection Properties (continued) NAME DESCRIPTION DEFAULT maxRows Limits the total number of rows to be returned by a query. 0 (maximum) useUnicode If true, the server will use Unicode when returning strings; otherwise, the server attempts to use the character set that is being used on the server. true characterEncoding If useUnicode=true, specifies the encoding to be used. None relaxAutoCommit If relaxAutoCommit=true, then the server allows transaction calls even if the server doesn’t support transactions. false capitalizeTypeNames If set to true, type names will be capitalized in DatabaseMetaData results. false profileSql If set to true, queries and timings will be dumped to STDERR. false socketTimeout If > 0 in milliseconds, the driver will drop the connection when the timeout expires and return the SQLState error of 08S01. 0 StrictFloatingPoint If set to true, the driver will compensate for floating float rounding errors in the server. false As you can see, there is quite a bit of information that can be conveyed to the Driver and used for queries to the database. Using Properties with the Connection One of the getConnection() methods exposed by the DriverManager allows the use of a Properties object to pass information to the DriverManager. All of the connection parameters shown in Table 5.1 can be placed in a Java Properties object. For example: Properties prop = new Properties(); prop.setProperty(”user”, “newuser”); prop.setProperty(”password”, “newpass”); myConnection = getConnection( “jdbc:mysql://localhost/accounts”, prop); In this code, a Properties object is instantiated and assigned to the prop variable. Using the setProperty() method, the user and password properties are set
Note: If you are looking for cheap and inexpensive provider to host and run your tomcat application check professional tomcat hosting services