0

I am new to Android Studio and I don't have that much experience in Java.

I installed the latest Android Studio version on a MacBook and everything worked fine (I also ran simple apps and worked flawlessly) until I had to use the class DriverManager to connect to a mysql database. When the program tries to call the DriverManager.getConnection() it pauses endlessly without throwing exceptions.

So I opened the class DriverManager and found out it had errors. In particular it's trying to do these two imports:

import dalvik.system.VMStack;
import sun.reflect.CallerSensitive;

but both classes do not exist in the specified path nor anywhere else.

I tried re-installing Android Studio and downloading many different versions of the SDK from the SDK manager but nothing solves the problem and I cannot find anything on the web. I only read somewhere around that VMStack is deprecated.

What am I doing wrong? Thanks.

Here's also a screenshot of the issue

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

1

First off- you should never connect directly to a db from a phone app. Doing so means your password is at best in RAM, at worst in your actual app, which means your db is compromised. Always use a webservice to abstract away db access.

Second- you aren't compiling Driver manager, so any errors you see in the IDE are invalid. It isn't working with the full source.

Third- to debug what your actual problem is, we'd need code. But like I said in 1, you shouldn't ever be doing this anyway.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Could be a local database. – Tom Hawtin - tackline Nov 28 '18 at 20:36
  • @TomHawtin-tackline On Android? So they'd be circumventing the entirte android os and installing a db directly on the underlying linux OS, and managing it that way? Extremely unlikely. And if you're talking about something like a SQLite or similar db, there's better ways to access it than JDBC. Also it wouldn't work at all as a standalong playstore app, because there's no real way to bundle a separate db executable like that. Yeah, unlikely enough that I'm going to ignore the possibility. – Gabe Sechan Nov 28 '18 at 20:38
  • Thank you. At the moment I'll be doing tests on a local database but in the future this is supposed to work on a remote db, so I'd definitely go for another option. – clafalc Nov 28 '18 at 22:52