r/DatabaseHelp • • May 26 '17

Figuring out SQL database name.

I am writing a C# program that I want to be able to query and add things to a SQL database as an assignment. Online I found that you can use the code block

SqlConnection myConnection = new SqlConnection("user id=username;" + 
                                   "password=password;server=serverurl;" + 
                                   "Trusted_Connection=yes;" + 
                                   "database=database; " + 
                                   "connection timeout=30");

I know my user ID and password and the server url as I have my own login. But I'm wondering how I find out the database name so I can add it to the string.

I don't think I have admin rights as I can't create new databases,I get the error

SQL> CREATE DATABASE assignment3;
CREATE DATABASE assignment3
*
ERROR at line 1:
ORA-01501: CREATE DATABASE failed
ORA-01100: database already mounted

I can however create tables, and if I use the "SHOW DATABASES;" command it doesn't return an error, but it does however return a blank line. Any help would be greatly appreciated.

Thanks!

1 Upvotes

4 comments sorted by

View all comments

Show parent comment

2

u/Phill544 May 26 '17

Thank you very much. All the info you've given me has been a great help!

I'm looking into this stuff now, I think you've put me on the right track :)