How to update users in TomEE JDBCRealm? - mysql

I am using JDBCRealm in TomEE 1.7.0 connecting to MySQL with this configuration
<Realm className="org.apache.catalina.realm.JDBCRealm"
digest="MD5"
driverName="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/database"
connectionName="admin"
connectionPassword="pass"
userTable="USUARIO"
userNameCol="USUARIO"
userCredCol="PASSWORD"
userRoleTable="USUARIOROL"
roleNameCol="ROL" />
It works fine, but an external application inserts new users into database, so I cannot log in to my application with these new users, unless I restart TomEE but I want to avoid it... What can I do?
Apache Tomcat documentation says
Because the lookup is done each time that it is required, changes to the database will be immediately reflected in the information used to authenticate new logins.
... but I can't get the changes in database to log in with new users
I'm using form-based authentication with primefaces and JSF

Did you check you use this realm? Can it be a lockoutrealm side effect? This just does a request so either the db is not well inserting data or you dont use what you think

Related

How do I connect my Android Application to a MySQL database stored in a server?

Background on the MySQL database: it was created from a Wordpress website. As far as I know, it can only be accessed through PuTTy with the ff credentials given to me by my client who I’m making the app for:
hostname
port
my username to get into server
my password to
get into server
mysql username
mysql password
It says from multiple sites that this is the PHP syntax to connect Android to MySQL
// Connecting to mysql database
$con = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD) or die(mysql_error());
It does not work and when checked for the connection error, it shows the error “Connection timed out.” when I put credentials needed (hostname, mysql
username and password). I’m assuming it’s because I need to get into the server first (with credentials #3 and #4).
Is there a workaround to this?
EDIT:
This is only based on the assumption that I am supposed to create a PHP file (that I will place inside a Jave file in Android Studio) to connect to their database. Are there other ways to connect to a private server?
Welcome Ateshi!
It sounds like you want an android app to directly access the mysql database that holds the content of a wordpress website.
The MySQL database server is most likely not publicly available on the internet for good reasons (security), as per this answer
You have posted some PHP code. PHP usually runs on the server alongside mysql, it not usually run on android.
Here is how you usually set up something like this:
Your android app makes a web request to http://yourexampleserver.com/example.php
Inside that example.php which is on the server, you have the PHP code that then does:
connects to mysql (with local credentials)
perhaps writes to the database
perhaps queries the database
formats the results into a useful format like JSON
The results are returned to java on your android which then usually shows them in the UI etc
This whole process is usually described as building a "webservice" for the app to use.
If however, you want the database contents to be stored offline and locally on android, then you probably need to connect to the server manually, export the database and download it, and then include it in your android project.

Sql login failed in dotnetnuke(dnn)

I am trying to install dotnetnuke in my localhost but not able to installing dnn and below connection string used in webconfig file.
<add name="SiteSqlServer" connectionString="Server=(local);Database=d1;uid=;pwd=;" providerName="System.Data.SqlClient" />
Below error getting:
I am installing dnn in local host, please help to out this headache installation.
Integrated will attempted to use Windows Authentication for the database connection.
You either need to create a SQL authentication account and choose the "User Defined" option, or you need to add the user for your app pool to SQL to give it access to the D1 database.
I prefer to just use SQL Auth accounts, always ends up easier in my opinion.

use of universal providers and mysql

I created an asp.net mvc 4 application, and added universal providers, because I need to create a custom membership provider that read users data from a my sql database.
When I work on the developer workstation it's all ok, but when I deploy on the server, where there is not Sql Server installed i receive an error. trying to open DefaultConnection.
In the InitializeSimpleMembershipAttribute that is created from the wizard, I have this:
WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: false);
this call initialize the db connection, do nothing, and is not used by the custom membership provider, but must be done at startup.
the connection string is:
add name="DefaultConnection" connectionString="Data Source=...;Initial Catalog=...;User id=...;Password=..." providerName="System.Data.SqlClient" />
the problem is that I don't know how to configure to use a mysql db and pass this control in the startup of the application.
If I have to install it in a server with Sql server installed, I configure it properly, and after the initial call the mysql membership provider works without problem, but i have problems when i cannot use this workaround, and exception is raised at the call to InitializeDatabaseConnection.
How can I fix this problem?

CloverETL mySQL Database SSL secure connection & Parameters

I am trying to make the connection to a remote mysql database in CloverETL Designer (Community Version)
Documentation with examples on this subject seem fragmented so I have tried to piece the bits together but I'm not use if they are correct. I would be grateful for any suggestions or further clarification on this subject.
Here is what I have so far:
The SSL Certificate
As an alternative VPN connection the server guys passed me the raw CA certificate, which I saved as a .crt file in the conn folder of the CloverETL workspace.
CloverETL Connections
I created a new DB connection and tested it was working without SSL
In the graph window I created a simple graph
Switching to Source View I added the parameter attribute to the connection code like this:
<Connection database="MYSQL" dbURL="jdbc:mysql://hostname/database_name" id="JDBC0" jdbcSpecific="MYSQL" name="CPM" parameters="ssl=${WORKSPACE}/conn/mysql_cpm_cert.crt" password="password" type="JDBC" user="username"/>
Then I tested the connection to the database by creating new metadata from a DB table
The problem is that I don't know if the connect is now secure or not.
Here's the list of resources that I used to piece together the information:
components:bulkloaders:mysql_data_writer [CloverETL wiki]
MySQL :: MySQL 5.0 Reference Manual :: 6.3.6.3 SSL Command Options
Thanks
CPM
Your setup almost certainly does not use ssl. Both links you posted are not usable - first describes bulk loader and second connection via command line client. But what you need is to configure JDBC. So I would use http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html section "Security."
I would set:
useSSL=true
requireSSL=true
You will do that by adding items in table (Custom JDBC properties) on second tab (Advanced) of Connection Wizard. In source it should appear like "jdbc.useSSL=true jdbc.requireSSL=true" not "parameters=".
Then connection should fail, because in your default java key store is missing your certificate. It can be imported via http://docs.oracle.com/javase/1.4.2/docs/tooldocs/windows/keytool.html section "Importing Certificates"
I hope this helps.

MySql database deployment in cloudfoundry

I've developed an application using JSP, Spring Security, MySql. I deployed it on Cloudfoundry. But just war file and I binded mysql service. But I also have to configure MySQL database that consists of two tables, new user and it all in my own database. While i tested my application on localhost i prepared the database running manual scripts in MySQL command window.
Question: How can I make the same configurations in CloudFoundry? can I the same way run all commands and scripts manually or export the database somehow? if yes, how to do this. And what to write here now instead of localhost?
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/security_filter" />
thank you
Caldecott (vmc tunnel) is the correct way to access your cloudoundry database (for me it works and i am using ruby 1.8): http://docs.cloudfoundry.com/tools/vmc/caldecott.html
If that does not work for you you will have to do something manually (much harder):
Create a sample jsp/servlet application that connects to a mysql database (retrieving connection string, username and password as input from user). Then it will just run the sql statement against the database ( sql statement will be also input from user)
Bundle this application in your war
Now you have to retrieve database connection string/username and password. You can retrieve them from the enviromental variable VCAP_SERVICES. Just log log it in a startup listener (eg ServletContextListener)
Deploy your war and get logs from server (vmc logs ApplicationName). Get connection string, username and password
Logon to your application and use your database application to access the database using the db info you collected in the previous step
Just note that this is very dangerous approach. Just be sure to secure this database application or after the initial import remove it from your war and redeploy the application
As a final note you can check if such a database console application already exists so that you dont have to create your own (for example grails has a nice application for this http://grails.org/plugin/dbconsole. Maybe something exists for jsp/servlets)
Hope it helps if you have no luck with the ruby problem
You would need to create a mysqldump of your database.
Once you have the mysqldump file, you then use caldecott and perform vmc tunnel to your MySQL service. After you have establish a connection with your MySQL service on Cloud Foundry, you then need to use the mysql command to manually import the mysqldump file into your service.
For how to use vmc tunnel, visit the documentation site at: http://docs.cloudfoundry.com/tools/vmc/caldecott.html