I created database in SQL Server Management Studio. My connection with database is ok, but query I try to execute is causing problems. It throws me "Invalid object name 'tw__towar'". Even though the query is working fine when I execute it in SQL Server Management Studio.
Here is code fragment responsible for connection.
try {
Class.forName(ssmsDriver);
connection = DriverManager.getConnection(url, userName, userPassword);
Log.d(TAG, "onCreate: connected to the database");
} catch (ClassNotFoundException e) {
e.printStackTrace();
Log.e(TAG, "onCreate: class not found", e);
} catch (SQLException e) {
e.printStackTrace();
Log.e(TAG, "onCreate: sql exception", e);
}
And here is code responsible for executing query. Double underscore intended.
try {
statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT tw_nazwa FROM tw__towar" +
" WHERE tw_ean='5903206038608';");
mItemNameTextView.setText("SUCCESS"); // DELETE THIS LATER
} catch (SQLException e) {
e.printStackTrace();
mItemNameTextView.setText(e.getMessage()); // DELETE THIS LATER
}
Does anybody have any idea what may be causing problem?