How to connect a Java application to the Mysql-in App on Azure? [closed]

-2

How to connect an application via url to Mysql bank (Myslq-inApp) within azure?

        String urlLOCAL = "jdbc:mysql://localhost:3306/crudjsp";
        String urlAzure = "jdbc:";


        Class.forName("com.mysql.jdbc.Driver"); 

        Connection conn = DriverManager.getConnection(urlLOCAL,"root","");
        Statement stmt = conn.createStatement();

        ResultSet rs = stmt.executeQuery("SELECT * FROM usuarios");

    
asked by anonymous 17.06.2017 / 02:15

1 answer

0

The connection in the MySql-InApp database in azure is very similar to the local connection of the Xampp server. Just set the user variables: "azure", password: "password" and host: "local" to make the connection. My code looks like this:

String user = "azure";
String password = "6#vWHD_$";

String urlAzure= "jdbc:mysql://127.0.0.1:54447/localdb";    
Class.forName("com.mysql.jdbc.Driver"); 

Connection conn = DriverManager.getConnection(urlAzure,user,password);      
Statement stmt = conn.createStatement();

ResultSet rs = stmt.executeQuery("SELECT * FROM usuarios");

Response obtained from this post: link

    
20.06.2017 / 16:48