r/DatabaseHelp • u/Phill544 • 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 mountedI 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!
View all comments
Show parent comment
2
u/Phill544 May 26 '17
Thanks, although I admittedly don't understand 100% what the link is saying, I do see how I'm wrong with what I'm asking for help with. I do still have questions about interacting with the tables through C#, but I'm not sure if that is out of the scope of this subreddit...
I know that I have been able to edit the tables in the past using php and the "oci_connect()" function. I was hoping that C# had something similar as for the php all you needed was your login info and password. But I guess that was because the web server was being hosted at the university.
Although from home I can use the program teraterm and can access and change my SQL tables, so I don't see why I couldn't do that with C#.