SQL database server connecting to Android Studio

1

I'm creating an app for school in Android Studio where users can check the boxes with their symptoms and the system will use a database to look up what diagnose is most likely. I have my Access database uploaded to Microsoft SQL server management studio, but when I try to run the code, I receive aSQLERROR from the catch (SQLException throwables) {throwables.printStackTrace();command. The application doesn't crash anymore, but I'm still receiving the SQLERROR.

Full exception:

2021-02-02 16:28:15.679 6182-6182/? E/psemedicustest: Unknown bits set in runtime_flags: 0x8000
2021-02-02 16:28:16.080 6182-6182/com.example.ipsemedicustest1 W/psemedicustest: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-02-02 16:28:16.082 6182-6182/com.example.ipsemedicustest1 W/psemedicustest: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-02-02 16:28:16.204 6182-6217/com.example.ipsemedicustest1 I/AdrenoGLES-0: QUALCOMM build                   : 39a1dfd, Ic628754133
   Build Date                       : 06/29/20
   OpenGL ES Shader Compiler Version: EV031.29.00.13
   Local Branch                     : 
   Remote Branch                    : 
   Remote Branch                    : 
   Reconstruct Branch               : 
2021-02-02 16:28:16.204 6182-6217/com.example.ipsemedicustest1 I/AdrenoGLES-0: Build Config                     : S P 8.0.16 AArch64
2021-02-02 16:28:16.204 6182-6217/com.example.ipsemedicustest1 I/AdrenoGLES-0: Driver Path                      : /vendor/lib64/egl/libGLESv2_adreno.so
2021-02-02 16:28:16.209 6182-6217/com.example.ipsemedicustest1 I/AdrenoGLES-0: PFP: 0x016ee188, ME: 0x00000000
2021-02-02 16:28:18.173 6182-6182/com.example.ipsemedicustest1 W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@e5772e6
2021-02-02 16:28:19.345 6182-6182/com.example.ipsemedicustest1 D/succes: knop ingedrukt
2021-02-02 16:28:19.354 6182-6182/com.example.ipsemedicustest1 D/succes: naar Thuisarts
2021-02-02 16:28:19.366 6182-6182/com.example.ipsemedicustest1 W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@22d4b15
2021-02-02 16:28:19.479 6182-6182/com.example.ipsemedicustest1 D/succes: internettoestemming toegestaan
2021-02-02 16:28:19.479 6182-6182/com.example.ipsemedicustest1 D/succes: Threadpolicy
2021-02-02 16:28:19.487 6182-6182/com.example.ipsemedicustest1 D/succes: zoeken voor verbinding
2021-02-02 16:28:26.779 6182-6182/com.example.ipsemedicustest1 D/mislukt: SQLERROR
2021-02-02 16:28:26.780 6182-6182/com.example.ipsemedicustest1 W/System.err: java.sql.SQLException: Network error IOException: failed to connect to /192.168.178.24 (port 1433) from /:: (port 40922): connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:28:26.780 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:436)
2021-02-02 16:28:26.780 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
2021-02-02 16:28:26.780 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.sql.DriverManager.getConnection(DriverManager.java:580)
2021-02-02 16:28:26.780 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.sql.DriverManager.getConnection(DriverManager.java:218)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.example.ipsemedicustest1.ThuisartsActivity.onCreate(ThuisartsActivity.java:55)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Activity.performCreate(Activity.java:7822)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Activity.performCreate(Activity.java:7811)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1328)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3598)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2021-02-02 16:28:26.781 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2164)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.os.Looper.loop(Looper.java:241)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7582)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err: Caused by: java.net.ConnectException: failed to connect to /192.168.178.24 (port 1433) from /:: (port 40922): connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:143)
2021-02-02 16:28:26.782 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.Socket.connect(Socket.java:621)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:288)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:251)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:331)
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err:    ... 19 more
2021-02-02 16:28:26.783 6182-6182/com.example.ipsemedicustest1 W/System.err: Caused by: android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.Linux.connect(Native Method)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.ForwardingOs.connect(ForwardingOs.java:95)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:136)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.ForwardingOs.connect(ForwardingOs.java:95)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connectErrno(IoBridge.java:157)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:135)
2021-02-02 16:28:26.784 6182-6182/com.example.ipsemedicustest1 W/System.err:    ... 28 more
2021-02-02 16:28:26.810 6182-6182/com.example.ipsemedicustest1 I/Choreographer: Skipped 446 frames!  The application may be doing too much work on its main thread.
2021-02-02 16:28:26.868 6182-6217/com.example.ipsemedicustest1 I/OpenGLRenderer: Davey! duration=7495ms; Flags=1, IntendedVsync=158535574851321, Vsync=158543008184357, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=158543013906986, AnimationStart=158543013972611, PerformTraversalsStart=158543014622923, DrawStart=158543053212146, SyncQueued=158543059002667, SyncStart=158543059390584, IssueDrawCommandsStart=158543059519490, SwapBuffers=158543069816887, FrameCompleted=158543071013398, DequeueBufferDuration=116000, QueueBufferDuration=575000, 
2021-02-02 16:28:26.875 6182-6217/com.example.ipsemedicustest1 I/OpenGLRenderer: Davey! duration=7503ms; Flags=1, IntendedVsync=158535574851321, Vsync=158543008184357, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=158543013906986, AnimationStart=158543013972611, PerformTraversalsStart=158543014622923, DrawStart=158543072334179, SyncQueued=158543073167877, SyncStart=158543073501054, IssueDrawCommandsStart=158543073591679, SwapBuffers=158543074732408, FrameCompleted=158543078368450, DequeueBufferDuration=145000, QueueBufferDuration=1850000, 
2021-02-02 16:28:26.905 6182-6217/com.example.ipsemedicustest1 D/OpenGLRenderer: endAllActiveAnimators on 0x7aed745d00 (RippleDrawable) with handle 0x7b441ed820
2021-02-02 16:32:23.391 6182-6182/com.example.ipsemedicustest1 D/succes: knop ingedrukt
2021-02-02 16:32:23.391 6182-6182/com.example.ipsemedicustest1 D/mislukt: knop ingedrukt
2021-02-02 16:32:23.406 6182-6182/com.example.ipsemedicustest1 D/mislukt: naar pagina
2021-02-02 16:32:23.423 6182-6182/com.example.ipsemedicustest1 W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@388132
2021-02-02 16:33:14.165 6182-6182/com.example.ipsemedicustest1 D/succes: knop ingedrukt
2021-02-02 16:33:14.179 6182-6182/com.example.ipsemedicustest1 D/succes: naar Thuisarts
2021-02-02 16:33:14.188 6182-6182/com.example.ipsemedicustest1 W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@22c4719
2021-02-02 16:33:14.248 6182-6182/com.example.ipsemedicustest1 D/succes: internettoestemming toegestaan
2021-02-02 16:33:14.248 6182-6182/com.example.ipsemedicustest1 D/succes: Threadpolicy
2021-02-02 16:33:14.248 6182-6182/com.example.ipsemedicustest1 D/succes: zoeken voor verbinding
2021-02-02 16:33:21.385 6182-6182/com.example.ipsemedicustest1 D/mislukt: SQLERROR
2021-02-02 16:33:21.385 6182-6182/com.example.ipsemedicustest1 W/System.err: java.sql.SQLException: Network error IOException: failed to connect to /192.168.178.24 (port 1433) from /:: (port 40974): connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:436)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.sql.DriverManager.getConnection(DriverManager.java:580)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.sql.DriverManager.getConnection(DriverManager.java:218)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.example.ipsemedicustest1.ThuisartsActivity.onCreate(ThuisartsActivity.java:55)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Activity.performCreate(Activity.java:7822)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Activity.performCreate(Activity.java:7811)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1328)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3430)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3598)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
2021-02-02 16:33:21.386 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2164)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:107)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.os.Looper.loop(Looper.java:241)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7582)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err: Caused by: java.net.ConnectException: failed to connect to /192.168.178.24 (port 1433) from /:: (port 40974): connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:143)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
2021-02-02 16:33:21.387 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at java.net.Socket.connect(Socket.java:621)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSocket.java:288)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:251)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:331)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:    ... 19 more
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err: Caused by: android.system.ErrnoException: connect failed: ETIMEDOUT (Connection timed out)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.Linux.connect(Native Method)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.ForwardingOs.connect(ForwardingOs.java:95)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:136)
2021-02-02 16:33:21.388 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.ForwardingOs.connect(ForwardingOs.java:95)
2021-02-02 16:33:21.389 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connectErrno(IoBridge.java:157)
2021-02-02 16:33:21.389 6182-6182/com.example.ipsemedicustest1 W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:135)
2021-02-02 16:33:21.389 6182-6182/com.example.ipsemedicustest1 W/System.err:    ... 28 more
2021-02-02 16:33:21.412 6182-6182/com.example.ipsemedicustest1 I/Choreographer: Skipped 433 frames!  The application may be doing too much work on its main thread.
2021-02-02 16:33:21.454 6182-6217/com.example.ipsemedicustest1 I/OpenGLRenderer: Davey! duration=7264ms; Flags=1, IntendedVsync=158830392856556, Vsync=158837609522934, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=158837615888834, AnimationStart=158837615956125, PerformTraversalsStart=158837616267323, DrawStart=158837647559931, SyncQueued=158837653362744, SyncStart=158837653690869, IssueDrawCommandsStart=158837653800296, SwapBuffers=158837656434359, FrameCompleted=158837657286702, DequeueBufferDuration=96000, QueueBufferDuration=408000, 

It all goes well until after the Log.d("succes", "zoeken voor verbinding"); (see below). Looks like it's unable to set up a connection, right? I copied the code from this video: https://www.youtube.com/watch?v=MnmEXqfV5BU.

ps. the checkbox-part between /* */ is not tested yet. I intent to filter my database on the boxes the user has checked. First I need to solve described problem (also in order to test this part), but if you have any recommendations in advance, they're more than welcome. I hid my ip address, but I used the correct one.

public class ThuisartsActivity extends AppCompatActivity {

    private TextView textView;

    private static String ip = "";
    private static String port = "1433";
    private static String Classes = "net.sourceforge.jtds.jdbc.Driver";
    private static String database = "database";
    private static String username = "testentesten";
    private static String password = "testentesten";
    private static String url = "jdbc:jtds:sqlserver://"+ip+":"+port+"/"+database;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_thuisarts);
        getSupportActionBar().setTitle("Thuisarts zelftest");

        ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.INTERNET}, PackageManager.PERMISSION_GRANTED);
        Log.d("succes", "internettoestemming toegestaan");

        textView = (TextView)findViewById(R.id.textView);

        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
        Log.d("succes", "Threadpolicy");

            try {
                Class.forName(Classes);
                Log.d("succes", "zoeken voor verbinding");
                Connection connection = DriverManager.getConnection(url, username, password);
                Log.d("succes", "verbinding");
                textView.setText("Succes");
                Log.d("succes", "ingelogd server");
            } catch (ClassNotFoundException e) {
                Log.d("mislukt", "ERROR");
                e.printStackTrace();
                textView.setText("ERROR");
            } catch (SQLException throwables) {
                Log.d("mislukt", "SQLERROR");
                throwables.printStackTrace();
                textView.setText("SQLERROR");
            }


    }
   public void sqlButton(View view) {
        Log.d("succes", "knop ingedrukt");
        Connection connection = null;
        if (connection != null) {
            Log.d("succes", "connection !=null");
            try {
                Statement statement = connection.createStatement();
/* final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox);
if (checkBox.isChecked()) {
String name = ((CheckBox) view).getText().toString();
*/
                    ResultSet resultSet = statement.executeQuery("SELECT TOP(1) aandoening FROM dbo.dbim WHERE" + name + " = 1");
                    while (resultSet.next()) {
                        textView.setText(resultSet.getString(1));
                    }
                }

            } catch (SQLException throwables) {
                throwables.printStackTrace();

            }

        } else {
            Log.d("mislukt", "knop ingedrukt");
            Intent g = new Intent(this, MainActivity.class);
            Log.d("mislukt", "naar pagina");
            textView.setText("Geen verbinding");
        }
    }
}
java
android
database
android-studio
asked on Stack Overflow Jan 17, 2021 by raphael krichel • edited Feb 2, 2021 by raphael krichel

1 Answer

0

EDIT: You forgot to place (TextView) before findviewbyid, thats what gives the nullpointer exception at line 66.

Change textView = findViewById(R.id.textView); to textView = (TextView) findViewById(R.id.textView);

After you've done this and there still is an error post the stacktrace again.

answered on Stack Overflow Jan 18, 2021 by Niels Mulier • edited Jan 19, 2021 by Niels Mulier

User contributions licensed under CC BY-SA 3.0