How to connect to SQL Server through target C

How can I connect to SQL Server from my iOS Objective-C mobile app.

I got a sample code for Android ie

public void ConnectToDatabase(){
try {

     // SET CONNECTIONSTRING
     Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();
     String username = "XXXXXXXXX";
        String password = "XXXXXX";
     Connection DbConn = DriverManager.getConnection("jdbc:jtds:sqlserver://192.188.4.83:1433/DATABASE;user=" + username + ";password=" + password);

     Log.w("Connection","open");
    Statement stmt = DbConn.createStatement();
    ResultSet reset = stmt.executeQuery(" select * from users ");


     EditText num = (EditText) findViewById(R.id.displaymessage);
    num.setText(reset.getString(1));

    DbConn.close();

    } catch (Exception e)
    {
    Log.w("Error connection","" + e.getMessage());
    }

}

Please help me integrate communications in Objective-C.

+4
source share
1 answer

check this url. It contains an Objective-C wrapper around the FreeTDS library to make it extremely easy to connect to SQL Server with iOS.

Microsoft SQL Server Native Library for iOS

0
source

Source: https://habr.com/ru/post/1677328/


All Articles