Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Connection conexionMySQL = null;
- public static void CreaConexion (Context context, String usuario, String pass, String ip, String puerto, String catalogo)
- {
- if (conexionMySQL == null)
- {
- String urlConexionMySQL = "";
- if (catalogo != "")
- {
- urlConexionMySQL = "jdbc:mysql://address=(protocol=tcp)(host="+ip+")(port="+puerto+")(user=root)/"+catalogo+"";
- }
- else
- urlConexionMySQL = "jdbc:mysql://address=(protocol=tcp)(host="+ip+")(port="+puerto+")(user=root)/";
- if (usuario != "" & pass != "" & ip != "" & puerto != "")
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- Toast.makeText(context, urlConexionMySQL, Toast.LENGTH_LONG).show();
- conexionMySQL = DriverManager.getConnection(urlConexionMySQL, usuario, pass);
- }
- catch (ClassNotFoundException e)
- {
- Toast.makeText(context, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
- }
- catch (SQLException e)
- {
- Toast.makeText(context, "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
- }
- }
- }
- }
- # SERVER SECTION
- # ----------------------------------------------------------------------
- #
- # The following options will be read by the MySQL Server. Make sure that
- # you have installed the server correctly (see above) so it reads this
- # file.
- #
- # server_type=3
- [mysqld]
- # The next three options are mutually exclusive to SERVER_PORT below.
- # skip-networking
- # enable-named-pipe
- # The Pipe the MySQL Server will use
- # socket=mysql
- # The TCP/IP Port the MySQL Server will listen on
- port=3306
- bind-address=*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement