i have an embedded derby database "end_user" and i want to pre-populate the table "user" with a few records before accessing it via a struts2 application. For this, i need to set the url of the database, but i don't know what url to set. the struts application is deployed as a war in apache-tomcat/webapps.
I have currently tried this:
jdbc:derby:1527/
But this does not seem to help in any way. I even tried hardcoding the path of the db i created (ie. C:\apache-tomcat\end_user) and even that did not help
what to do?
Related
I'm creating a simple ASP.net MVC login form using individual user accounts. I created the project following this tutorial: https://learn.microsoft.com/en-us/aspnet/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on
At what point do I connect it to my SQL Server database? In the tutorial, it seems as though the database tables are created automatically, though I've never seen an option to enter my database credentials.
Thanks!
The default template generates you a local database that is stored in the project directory. If I recall correctly, it does not require authentication. You can examine the Web.config file to see the connection string. It will not contain a username and password because it does not require them for that local database.
I have an asp.net mvc 5 website using EF, LocalDB and Code First Migrations. Requirements have now dictated that I need a need to add a console application into the mix to do some scheduled work. However this console app must call into the database functionality exposed in the web application. Also of note is that we are using LocalDB for development, but will switch to a 'proper' remote DB for production.
As such I have created a new console application within the project and added a reference to the web application so that I can call its repository functions. I know this probably isn't the best way to handle things.
For whatever reason though, when calling Save Changes on the database context from within the console application, nothing is saved to the LocalDB database. The Save function returns a number indicating that a number of rows were inserted.
I get the feeling I am making a schoolboy error somewhere. What could it be?
i`v used this in the past:
<add name="DefaultConnection"
connectionString="Server=(localdb)\v11.0;Database=WebPortalDb" providerName="System.Data.SqlClient"/>
If you want to use the functionality/database from one Project to another project then use the following::
1) Include the 'ConsoleProjectName.dll' file into your 'MVC' project's reference
2) Use that Dll into the namespace of your file.
(eg. using System.Data.Entity)
in the same way you have to use the DLL into your namespace.
3) make an object of the 'console' application's class and use the methods & other properties defined in that class.
May be this much information will be helpful for you.
This we are doing for n-tired architecture, where there are different layers (i.e. projects) in a solution to be linked with each other.
SETUP
I have a grails 2.0 app with the following grails spring security pluggins
spring-security-core 2.0-RC2
spring-security-ldap 2.0-RC2
spring-security-ui 1.0-RC1
I am using the the database based approach to secure urls via Requestmap approach
PROBLEM
I have an application in production that does not seem to be picking up the latest url configs that I have put in the Requestmap table. For example:
I had the following url mapping /home set to IS_AUTHENTICATED_FULLY to allow everybody to go to home. I have deleted that database entry and if I run the app locally (pointing against prod db) and when trying to go to home I get an access denied which is good, exactly what I wanted. Additionally, if I go to /securityInfo/mappings that url is not displayed because it no longer exists in the database.
But if I go to the prodcution application which is pointing to the same database and go to /home I am still alowed to access it !!! even though that rule is no longer on the db. Also if I look at /securityInfo/mappings that url mapping /home it's still displaying but yet if I go to requestmap/search and look for it, it's not found.
To me it seems like the permissions work not based on Requestmap but based on what securityConfig/mappings states.
QUESTION
My question is how come the data in securityInfo/mappings does not match what's on the Requestmap table?
Thanks in advance.
I have an unusual circumstance where our web server inserts a folder into the url path before loading the page. Let me give you an example:
The app is called equipment and if I were to run it on a normal server setup, it would look like:
www.site.com\equipment\home\index
BUT when I run it on our server, it inserts "idn" in the url:
www.site.com\idn\equipment\home\index
The messes up my relative references. The MVC functions want to redirect to use "\equipment\" instead of "\idn\equipment\". This happens with Scripts.Render(), Return View(), etc.
Also, I can't hardcode the "idn" into my urls b/c then it is no longer relative and it won't work on my dev box or test servers b/c they don't have a "idn" subfolder in localhost.
I also tried functions such as Request.ApplicationPath and what not but none of them return the "idn" in the result.
Is there way to MVC to know that this "idn" was inserted into the url and account for it?
Thanks!
Create your application on the test/production server in the idn folder, then it all works.
Currently I have a web service, which loads up any plugins located within its /plugins folder. Now the problem is that each plugin has its own set of configuration data, currently hardcoded and isolated into a single class, but I want to move this out into a myplugin.config file.
Normally the web service loads up its own web.config file, but I am not sure if I can get the plugins to use their own ones. As if you imagine the main web service uses NHibernate and does CRUD stuff with some arbitrary data, but one of the plugins adds a caching layer using MongoDB and has its own connection string details. So the MVC web service shouldn't really care about these settings, it should just be the MyPlugin which would need to read them.
Is there any way to do this? As I just want to get away from having the connection string ingrained within the code.
I have sorted this problem now, I was able to do it without much work really once I found out how config files could be loaded in.
I made sure my config file was named after the assembly loaded via MEF, so if my assembly was:
some-custom-plugin.dll
You would make a config file named:
some-custom-plugin.dll.config
then you would call:
var config = ConfigurationManager.OpenExeConfiguration("some-custom-plugin.dll");
var someValue = config.AppSettings["some-app-setting"];
So hope this helps someone as it took me a while to find this simple thing out.