How do I get the CloudBees Database password - mysql

I want to access my CloudBees managed Database (MySQL) with a password from my app and client - how to I get it?

First, you will need to install the command line tools
Run
bees db:info -p youraccount/dbname
and this will show all the details you need.
(-p means to show the password on the terminal, it won't by default).
If you use "bees app:bind" - or a clickstart setup your DB binding for you - your app should already be wired up to connect to the database when it runs in cloudbees (you shouldn't need to ever see the password in this case).

Related

How to setup mysql develper for PCF mySQL database to manage it

I am trying to understand PCF concepts and thinking that once i am done with creating mysql services in PCF, how i can manage that database like creating tables and maintaining that table just like we do in pur traditional environment using mySqldeveoper. I came across one service like PivotalMySQLWeb and tried but didnt liked it much. So if somehow i can get connection details of mysql service , i can use that to connect using sql developer.
The links #khalid mentioned are definitely good.
http://docs.pivotal.io/p-mysql/2-0/use.html
https://github.com/andreasf/cf-mysql-plugin#usage
More generally, you can use an SSH tunnel to access any service, not just MySQL. This also allows you to use whatever tool you would like to access the service.
This is documented here, but if for some reason that goes away here are the steps.
Create your target service instance, if you don't have one already.
Push an app, any app. It really doesn't matter, it can be a hello world app. The app doesn't even need to use the service. We just need something to connect to.
Either Bind the service from #1 to the app in #2 or create a service key using the service from #1. If you bind to the app, run cf env <app> or if you use a service key run cf service-key MY-DB EXTERNAL-ACCESS-KEY and either one will give you your service credentials.
Run cf ssh -L 63306:us-cdbr-iron-east-01.p-mysql.net:3306 YOUR-HOST-APP, where 63306 is the local port you'll connect to on your machine and us-cdbr-iron-east-01.p-mysql.net:3306 are the host and port from the credentials in step #3.
The tunnel is now up, use whatever client you'd like to connect to your service. For example: mysql -u b5136e448be920 -h localhost -p -D ad_b2fca6t49704585d -P 63306, where b5136e448be920 and ad_b2fca6t49704585d are the username and database name from step #3 and 63306 is the local port you picked from step #4.
Additionally, if you want to connect aws-rds-mysql (instantiated from Pivotal Cloud Foundry) from IntelliJ, you can use the DB-Navigator Plugin (https://plugins.jetbrains.com/plugin/1800-database-navigator) inside IntelliJ, through which, database manipulation can be performed.
After creating the ssh tunnel $ cf ssh -L 63306:<DB_HOSTNAME>:3306 YOUR-HOST-APP (as also mentioned in https://docs.pivotal.io/pivotalcf/2-4/devguide/deploy-apps/ssh-services.html),
Go to DB Navigator plugin and click on custom under new connection.
Enter the URL as: jdbc:mysql://:password>#localhost:63306/<database_name>
The following thread might be helpful for you as well How do I connect to my MySQL service on Pivotal Cloud Foundry (PCF) via MySQL Workbench or CLI or MySQLWeb Database Management App?

Can't connect to MySQL database hosted in CloudBees

I have a free CloudBees account and created a free ClearDB database using their wizards. My trouble is when I use their connection information (whether I try to connect from my Java app, or an outside tool - SQLyog to be exact) I take the error: Access denied for user 'b51dbc5757d79f'#'%' to database 'mywiki.
The username provided by CloudBees does not contain those extra characters that the error message is displaying which seems like it would be a problem, but I'm not sure there is anything I can do about that since everything is configured for me. The username I am given is: b51dbc5757d79f - which I can delete and rebuild after sharing here :)
To diagnosis this best way is to be sure you use the right username and password when you connect through a MySQL client like MySQLWorkbench. For that you can use the CloudBees SDK and to use the db:info command.
bees db:info -p DATABASE_NAME
Be sure you don't have any firewall or proxy in the middle of the connection.

How to use aspnet_regsql.exe

I'm having problems Creating Users in a Silverlight Business Application that uses the Local IIS Web Server.
If I use the Visual Studio Development Server I have no problems, but once I check "Use Local IIS Web Server" in the properties page and run the application, whenever I try to create a new user using "login->Register now" I get an "Unable to connect to SQL Server" error.
I found a similar problem as mine and the solution was to use aspnet_regsql in the command prompt.
If I have to use this tool, then I don't know how to use it:
aspnet_regsql.exe -S DBServerName -U DBLogin -P DBPassword -A all -d DBName
What should I enter in these parameters:
DBServerName: I guess it's ".\sqlexpress"
DBLogin and DBPassword: Kind of a login and password for the database?
DBName: If I'm not using any particular database, then what?
Please, what should I do here?
Navigate to the wizard(C:\Windows\Microsoft.NET\Framework[framework version]\aspnet_regsql) and launch it , you will be able to see a form appear and you can enter details here rather than using the command prompt.
Also within VS , from top menu select WEBSITE -> ASP.Net Configuration you should be able to see all your user and role details (you can tst the connectivity as this will pull of data based on your web.config/app.config settings)

Jasperserver installation unable to access database

I am trying to install jasperserver(war) in a CentOS linux machine. It throws up error saying,
Message: [Access denied for user 'jasperdb'#'xx.xx.xx.xx' to database 'mysql']
However, when I access mysql via command prompt it works fine. I am able to access via the user jasperdb from same machine where I am trying to install jasperserver.
It is also weird why jasperserver tries to access the database with name 'mysql'? Any solutions?
The mysql database within mysql is the one where user info is stored. That is why it is trying to access the mysql database. I am assuming you have 'jasperdb'#'localhost' in your mysql.user table. Try making sure that localhost and any other computer names are in your /etc/hosts filled in for 127.0.0.1.
If you are not using the ".war file" installer, I recommend using that. It's a lot easier to troubleshoot than the installer that bundles in Tomcat and PostgreSQL.
If you are using that, then you should find the credentials that you have set in default_master.properties. That includes both the user name and the database name. Run ant clean-config to make sure you aren't picking up any old settings.

Unexpected error message from aspnet_regsql

I am trying to use the aspnet___regsql utility to install all the membership tables in a database on my local SQL Express 2008 instance. I can connect without problems in Management Studio, but when I try to list the databases in the aspnet_regsql interface i get an error message saying:
Failed to query a list of database names from the SQL Server.
Invalid object name 'sysdatabases'
What am I doing wrong? How do I fix this?
(Please tell me there's a smoother way than reinstalling the thing... :P)
I have solved the problem by bypassing the graphic interface and performing the same action directly in the command prompt, with flags specifying all options. They should look like this:
Connect using SQL Authentication
C:\>Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -S myHostingServer -A all -d myDatabase -U myUserID -P myPassword
Connect using Windows Authentication
C:\>Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe -S myHostingServer -A all -d myDatabase -E
The difference is at the end of the lines, where SQL Auth. has -U myUsername -P myPassword while Windows Auth. has -E (which flags for Trusted Connection).
If you want to use the graphical interface, you need to make sure the user you are logged in as has the default db in SQL set to 'master' so it can connect directly to the sysdatabases table.
Ensure that in SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for YOUR_SQL_SERVER_INSTANCE_NAME is enabled TCP/IP. NB. for applying this change need to restart YOUR_SQL_SERVER_INSTANCE_NAME
By default on Vista the current user on the machine is not a member of SysAdmin on SQL Server 2005/2008.
So here is the trick.
1-Open Sql Server Surface Area Configuration tool from C:\Program Files\Microsoft SQL Server 2005/2008.
2-When the screen pops up click on Add New Administrator.
-on top right make sure that User to provision=Username of the pc
-on your left (Available Privileges) select Member of SQL Server SysAdmin and click on the right arrow (>)
-click ok and you should be ready to go.
My name is Talley Ouro,Developer in Raleigh,NC
Blog: http://talleyblogs.blogspot.com/
Email:johnstalley#live.com
This issue is generally caused by leaving "Server" to be your machine name instead of the name of your SQL server instance. It's tricky to figure out because they autofill the text box to your machine name, which is needed but incomplete. This may lead you to think "Server" refers to the computer itself when they really mean SQL server instance. If you are connecting to your local machine you can generally append to their entry with the name of your SQL instance and everything will work as intended
IE LOCALHOST must become LOCALHOST\SQLEXPRESS or whatever you name your box\sqlserver