Are there any ways to retrieve the database connection string where my ruby is connected? what i would like to get is the:
1) Database name where the ruby is connected 2) The username of the SQL Server 3) Password of the SQL Server 4) Server name
I want to store it in session variables.
(I'am using MS SQL Server.)
Please help! thanks!
Right-click on your connection and select "Properties". You will get the Properties window for your connection. Find the "Connection String" property and select the "connection string". So now your connection string is in your hands; you can use it anywhere you want.
Open Visual Studio.Go to view => Server Explorer. Right click on Data Connections and select Add Connection (or) click on Connect to Database icon. You will get add connection window. Provide Server name.
I would go with ActiveRecord::Base.connection_config
which returns hash with options for ActiveRecord 3.
You can access all of the properties described in your database.yaml like this:
ActiveRecord::Base.configurations["development"] =>
{"encoding"=>"utf8", "username"=>"foo", "adapter"=>"mysql", "database"=>"bar_development", "host"=>"localhost", "password"=> "baz"}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With