May 23rd, 2008
528 Part V . Advanced Performance Table 18-1 Options For Master Server In MySQL Replication Option Description binlog-ignore-db Replication will be done on all databases except database specified. log-bin Sends replication updates to logfile in binary format. log-bin-index Sets the filename of the file to track which log number is current. PURGE MASTER LOGS TO Deletes replication logs. RESET MASTER Purges replication-related logfiles and restarts replication. server-id Unique integer value of server within a replication set. SET SQL_LOG_BIN=0 Stops replication or updating of the binary log. SET SQL_LOG_BIN=1 Starts replication or updating of the binary log. SHOW BINLOG EVENTS Used for debugging, this statement shows items in the binary log. SHOW MASTER LOGS Gives information on the binary logs residing on the master. SHOW MASTER STATUS Gives information on the master replication process. binlog-do-db Replication will be performed only on updates to database specified. The options and settings applicable for a slave server are shown in Figure 18-2. As in Table 18-1, SQL statements are shown in all uppercase. Table 18-2 Options For Slave Server In MySQL Replication Option Description CHANGE MASTER TO Changes the master that a slave replicates with. LOAD DATA FROM MASTER Transfers a snapshot copy of the data from master to begin replication. LOAD TABLE FROM MASTER Transfers a specific table from a master server. log-slave-updates Enables logging of updates on slave server. master-host The IP or hostname of the master server. master-user Username to use for replication.
Check Tomcat Web Hosting services for best quality webspace to host your web application.
Posted in Domain | No Comments »
May 22nd, 2008
Chapter 18 . Replication 527 MySQL server versions For replication to work successfully, you must be running the same version of MySQL on all servers participating in the replication. There are exceptions to this rule, but for the most part it s a good idea to get the latest version of MySQL running on all participating replication servers so that the features and back-end code operate as expected. The file format for replication changed in MySQL version 3.23.26 and again in version 4. If you are running an older version and cannot update, you re required to run old versions of MySQL on all servers that participate in the replication. Version 4 of MySQL can participate in a 3.23.26 (or greater) version of replication. The server will check the version running on the master, and if it is a 3.x version, the appropriate format is used. Security By default, replication traffic is sent via unencrypted packets an unacceptable arrangement for secure databases and updates. This is especially true of updates that traverse untrusted networks. Beginning with version 4 of MySQL you can configure replication to use Secure Sockets Layer (SSL) for replication traffic. Using SSL, traffic is encrypted and thus safer as it travels across an untrusted network. Using SSL with MySQL replication assumes that you have OpenSSL installed and working. If you do not have OpenSSL installed, you can t use SSL for MySQL replication. Configuring Replication This section gets down to the business of configuring replication. I ll begin by examining the variables and settings for replication and then continue by looking at a simple replication configuration between one master server and two slaves. Additional replication configurations are also examined in this section. Replication variables and settings Some options for replication are only available within a particular context; they apply only to a master server or only to a slave server. The options are set within the MySQL configuration file such as my.cnf or my.ini. Table 18-1 lists the settings applicable for a master server.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.
Posted in Domain | No Comments »
May 21st, 2008
526 Part V . Advanced Performance Considerations for replication A couple of common terms that will be used throughout this chapter are master and slave. The master server receives updates to the data from applications and through other means and is considered the primary MySQL server in the replication set. The slave server receives updates only from the master server. The master server knows nothing about any slave servers that read the updates and replication information. The slave server is responsible for contacting the master server and reading the replication updates. Replication does not require a constant or high-speed connection between the master and slave. If a slave loses its connection to the master, it will try to reconnect according to values set by the administrator. Further, if a slave server stops replicating, it will remember where it left off and catch up later. Replication does require that both the master and slave have the same data to begin with. Therefore, if you are beginning with a 6GB database, you need that data transferred to the slave. (There are a couple of methods for performing this task, which I discuss later.) Replication uses a log, called the binary log, for tracking updates to data. This file is kept on the master in a replication set or on slave servers that have log- slave-updates enabled. On some file systems, notably ext2 in Linux, the maximum default file size is 2GB. Therefore, you must monitor replication and perform a replication- and-restart operation before the binary log grows to 2GB. Replication can be configured in a number of forms. The simplest and most widely used form of replication is with one master and one or more slaves. Replication can also be configured with more than one master though only one is active at any time. Finally, replication can be configured in a two-way format where updates are logged back to the master. Two-way replication can create problems such as when there is an update for the same record received at the same time. MySQL enables the administrator to choose the data to replicate. The data can be selected with granularity down to the table level. Therefore, you can replicate all databases on the server, only certain databases, or simply a table. Additionally, you can select tables with wildcard-like matching and even select a table or tables not to include while including all others. The values for auto_increment columns are automatically updated as part of the replication process. No need to worry about the values becoming skewed between replication participants.
Searching for affordable and reliable webhost to host and run your web applications? Go to our java web server services and you will be pleased.
Posted in Domain | No Comments »
May 7th, 2008
Replication 18 1818 CHAPTER An area that has received a lot of attention from the MySQL development team has been replication. Replication refers to the automated copying of changes made to databases and data between two or more MySQL servers. The MySQL development team has made replication in MySQL a robust and stable feature. As part of my daily routine, I manage a fairly large-scale database that is replicated across five states in real time using MySQL replication. The system has been operational for two years with very little difficulty. Even two years ago, replication in MySQL was stable. The stability and added features of today s MySQL replication make it a good choice for redundancy and mission-critical applications alike. This chapter looks at MySQL replication, including how to install and configure replication between two or more MySQL servers. MySQL AB has gone to great lengths to make replication configuration easy as you ll see in the following pages. Planning and Preparing for Replication Before undertaking the tasks involved in actually setting up replication, take some time to plan and prepare for those tasks. The planning includes making sure replication is right for your implementation, deciding what databases or tables will be replicated, how many servers will participate in the replication, and how you will monitor replication. Preparing for replication includes ensuring that all participating servers are running on the same MySQL version. …. In This Chapter Getting ready for replication Setting your configurations for replication Keeping an eye on replication Using replication shortcuts ….
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.
Posted in Domain | No Comments »
May 6th, 2008
PART Advanced V VVPerformance …. In This Part Chapter 18 Replication Chapter 19 Integration of Internet Services Chapter 20 NuSphere Enhanced MySQL ….
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.
Posted in Domain | No Comments »
May 5th, 2008
Chapter 17 . ODBC/JDBC 521 Statement stmt = con.createStatement(); ResultSet productinfo = stmt.executeQuery( SELECT name,artist FROM product ); while (productinfo.next()) { System.out.println(productinfo.getString( name ) + + productinfo.getString( artist )); } You can save the program as SimpleSelect.javaand compile it by typing the following command: javac SimpleSelect.java Summary MyODBC is MySQL AB s version of an ODBC driver for MySQL, available for Windows and for some versions of Unix and Linux. . MyODBC can be obtained directly from MySQL AB s Web site. . MyODBC installation in Windows is straightforward using a standard Windows-type setup program. . During setup you enter in basic information about the MySQL ODBC Data Source including the name or IP of the server, username, password, and database to connect to. . You can change the information or add Data Sources for MySQL at a later time through the ODBC Control Panel in Windows. . Connecting MySQL to Microsoft Access is relatively simple and is done through the Get External Data process. . Connecting MySQL to Microsoft Word is done through the use of Microsoft Query to build a SELECT query for the data you d like to integrate. . JDBC is the Java equivalent of ODBC. JDBC is distributed with the Java Software Development Kit from Sun. . MySQL has a driver to integrate with the JDBC so you can connect MySQL to Java programs and applets. …
Searching for affordable and proven webhost to host and run your servlet applications? Go to Linux Web Hosting services and you will find it.
Posted in Domain | No Comments »
May 4th, 2008
520 Part IV . Development Creating a basic MySQL JDBC Program Building on the simple connection program from the last section, I ll retrieve some results from a query by using the following code: import java.sql.*; public class SimpleSelect { public static void main(String args[]) { String url = jdbc:mysql://localhost/ecommerce ; Connection con; try { Class.forName( org.gjt.mm.mysql.Driver ); } catch(java.lang.ClassNotFoundException e) { System.err.print( ClassNotFoundException: ); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url, suehring , evh5150 ); System.out.println( Connection established! ); Statement stmt = con.createStatement(); ResultSet productinfo = stmt.executeQuery( SELECT name,artist FROM product ); while (productinfo.next()) { System.out.println(productinfo.getString( name ) + + productinfo.getString( artist )); } con.close(); } catch(SQLException ex) { System.err.println( SQLException: + ex.getMessage()); } } } The code just given has a new section added to execute the statement and retrieve the results. A Statementobject, stmt, is created. Then the query is issued. The results are then retrieved by using the getString method with the column name in quotes:
If you are looking for affordable and reliable webhost to host and run your business application visit our ftp web hosting services.
Posted in Domain | No Comments »
May 4th, 2008
Chapter 17 . ODBC/JDBC 519 You can save this connection as a program named FirstConnection.java and compile it by typing javac FirstConnection.java Once the program is compiled, you can run it by typing java FirstConnection When your first connection is successful, a Connection Successful message appears. Examining some of the code snippets reveals that a string variable, url, is initialized and contains the connection information for the server (localhost) that I want to connect to, along with the database (ecommerce) that I want to use. If I want to specify a port other than the default 3306, I can use localhost:port. For example, I could use localhost:5150like this: String url = jdbc:mysql://localhost/ecommerce ; A connection object, con, is created next: Connection con; The MySQL JDBC driver is now loaded, according to the syntax discussed in the previous section. If the loading of the driver is unsuccessful, an error message is printed; the following code displays the error message: try { Class.forName( org.gjt.mm.mysql.Driver ); } catch(java.lang.ClassNotFoundException e) { System.err.print( ClassNotFoundException: ); System.err.println(e.getMessage()); } The connection is attempted next; if it does not succeed, use SQLException to retrieve the error message. That operation looks like this: try { con = DriverManager.getConnection(url, suehring , evh5150 ); System.out.println( Connection established! ); con.close(); } catch(SQLException ex) { System.err.println( SQLException: + ex.getMessage()); } }
Go visit our java server pages services for a reliable, lowcost webhost to satisfy all your needs.
Posted in Domain | No Comments »
May 3rd, 2008
518 Part IV . Development Cached connections Up to this point, I ve been showing examples using the ResultSetobject. The ResultSet object remains connected to the data source for result retrieval. Because the connection must remain intact and active, the ResultSetobject is not useful for working with data over a networked connection. The JDBC API defines a RowSet interface that includes a CachedRowSetclass that can be used to retrieve results and place them into a cache for later use. Connecting to MySQL with the JDBC API and MySQL Driver Connecting to MySQL with JDBC for the first time can be a humbling experience. After lurking on Java mailing lists for a long time (as well as watching the Usenet newsgroups), I ve seen numerous questions by first-time developers who struggle with this initial JDBC connection. The following code demonstrates a typical connection to a MySQL server, made with Java. import java.sql.*; public class FirstConnection { public static void main(String args[]) { String url = jdbc:mysql://localhost/ecommerce ; Connection con; try { Class.forName( org.gjt.mm.mysql.Driver ); } catch(java.lang.ClassNotFoundException e) { System.err.print( ClassNotFoundException: ); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url, suehring , evh5150 ); System.out.println( Connection established! ); con.close(); } catch(SQLException ex) { System.err.println( SQLException: + ex.getMessage()); } } }
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.
Posted in Domain | No Comments »
May 2nd, 2008
Chapter 17 . ODBC/JDBC 517 System.out.println( Connection established! ); DatabaseMetaData dbmdata = con.getMetaData(); System.out.println( Database Information ); System.out.println( Database name: + dbmdata.getDatabaseProductName()) ; System.out.println( Version: + dbmdata.getDatabaseProductVersion()); System.out.println( Driver: + dbmdata.getDriverName()); System.out.println( Version: + dbmdata.getDriverVersion()); con.close(); } catch(SQLException ex) { System.err.println( SQLException: + ex.getMessage()); } } } Working with JDBC errors The main handler for errors with JDBC is SQLException class. SQLException, when invoked, sends a string with a description of the exception. This error message is retrieved with the getMessage()method. SQLException actually sends three pieces of information; in general terms, these are as follows: . Message string the message itself. . SQL state a five-character string retrieved with the getSQLState() method. . Vendor error code a code defined by the software vendor and retrieved with the getErrorCode()method. Testing for NULL values The wasNull() method serves to determine if a value returned from the database was NULL. The wasNull()method is called as part of the result set for a statement, as in the following example: Statement stmt = con.createStatement(); result = stmt.executeQuery(sql); while (result.next()) { if (result.wasNull()) { System.out.println( Null found. ); } }
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.
Posted in Domain | No Comments »