问题
I just successfully connected my android app with a database running on azure cloud services to run simple queries.
The connection string provided by azure already specifies which database I want to connect to, but when it is trying to execute a select query in that database the table cannot be found because the query is being executed on Master database.
jdbc:jtds:sqlserver://{servername}:1433;database=BDassistance;user={username};password={password};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;";
BDassistance
is the database I want to connect to and run queries, but its tables cannot be found and when running
SELECT DB_NAME()
it returns "Master".
What is going on here? Did I forget a parameter in my connection?
来源:https://stackoverflow.com/questions/53070013/can-only-connect-to-master-database-with-jdbc-sql-server