NHibernate - Two SessionFactories Accessing The Same Database?
Jan 4, 2011
This is related to a previous question I asked, regarding splitting a asp.net mvc web application into two apps - one public, and one admin. Both of them would be sharing the same database of course.
With two web apps I'll have two host applications and so two seperate Nihbernate session factories. My concern is that their seperate data caches will cause all sorts of problems.
While posting this, I looked at this question, which covers a similar problem (for a different reason). I really don't want to have to set up some kind of distributed cache just for a low use admin application.
How can this be resolved? Is separating the admin section into it's own application not possible with NHibernate without drastic measures?
View 2 Replies
Similar Messages:
Apr 16, 2010
I have two databases. One from Oracle 10g. Another from Mysql. I have configured my web application with Nhibernate for Oracle and now I am in need of using the MySQL database. So how can i configure the hibernate.cfg.xml so that i can use both of the database at the same application?
My current hibernate.cfg.xml is:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>[code]......
View 1 Replies
Aug 2, 2010
I am building an object from multiple datasources. Does anyone know whether this is possible in NHibernate and how. I should mention that one source is SQL the other ORACLE.
View 1 Replies
Sep 24, 2010
here's the situation:
You're using NHibernate with Fluent NHibernate for mappings.
You have an application in production with a database with live data You're adding a new feature in development and it requires a new database column.
The new column cannot be blank. For example, I recently had to a DateCreated column to a table and the app now uses that date. As the only time the data will be missing is now, it seems unnecessary to add code to check for errors.
In my application I have an updater which can execute a SchemaUpdate to add the new database column - however, the application will starting crashing as it is expecting a value in the new column.
I need to get some sensible default data into that column. In this case I manually ran an Update to set the date to the current date (good enough for the situation). In this particular case I believe that you cannot set the column default to getdate() using fluent mappings.
Keep a schema version number in a config file In the updater that runs SchemaUpdate start adding upgrade methods for each version. These methods would run updates to add default data (or other required actions).
After the schema update has been run, call all methods required for a version greater than the current version (i.e. those that haven't previously been run). So if the app is now version 4 and version 2 is installed, methods 3 and 4 would be run.
View 3 Replies
Jul 6, 2010
How can I write a unit test for CRUD using in memory database with fluent nhibernate
View 2 Replies
Oct 13, 2010
I am currently learning JQuery by reading ebooks. I don't think by reading ebooks is good enough. So can I build a shopping cart website using both JQuery and ASP.NET 4.0 ? I plan to use ASP.NET 4.0 only for accessing the database only.
View 3 Replies
Feb 28, 2010
I have a website that writes and reads data from a database.It will help me to read and write to the same database from a separate website.Do I have a problem with "collisions" or are the calls to the database completely separate ?
View 4 Replies
Apr 6, 2010
I have a ASP.NET MVC application which is build up as an assembly that queries the database and a asp.net frontend that references this assembly and this assembly abstracts the underlying database. This means that my Assembly contains a app.config file that contains the connectionstring to the database (Linq to Sql data model). How do I go about making this more flexible? Should i make a "initialize()" method somewhere in my assembly which takes the connection string from the asp.net mvc application and then that controls which database to use? or how is this done?
View 1 Replies
Jun 27, 2012
I have a web app that is trying to open a SQL Server Database and it's not working. The error that I am receiving is below:
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections."
What needs to be done regarding the highlighted line in the error message?
View 2 Replies
Jul 2, 2010
I know this is a beginner question but I am struggling to find any clear tutorials etc on how I can create new records in a database table based on information added into text boxes on a page. Also what is the best way to do this LINQ, dynamic data website etc etc?
View 1 Replies
Sep 21, 2010
I made a website, 1 database; We have 4 cumputers, the 4 are using the same website and saving datas at the SAME TIME.
The problem that i have is that when 2 people click in the save button at the same time, only onces is in the database, but the others get lost.
Visual Studio 2010, Framework 3.5, MS-SQL 2008, C#.
The conecction is in c#, everthing is in c#.
View 1 Replies
Dec 1, 2010
I am working on a website where when the user logs in, I select their database based on their username. Currently I have a list of all databases in the web.config and I select the Database ID from the username and then read the database string from web.config. What is the most optimal way to implement this scenario?
currently I:
- store the Database ID in the session object
- the Session object expires after like 5 minutes so i have to read the Database ID from the online database based on the username and regenerate the Session["DatabaseID"] again.
- there are some security issues with the Session ID, so I started clearing the Session in !(Page.IsPostBack) and I generate the Database string again.
Where shall I store the DatabaseID and the database connection string so I can easily reuse it once the user has logged in?
View 8 Replies
Apr 12, 2010
I have created an access database and i have shared (permision is full for everyone) the folder to get access to it. It works fine from the same domain from any pc i am able to access it.
but was not able to access it from a different domain. is there anyway i can make it happen???
basically all are under same company but different location hence different domain i am able to access anything that is shared
from any location
from other domain just by typing \ and the computername or IP address to get me the shared folder
see the connection string i have used
[Code]....
View 3 Replies
Aug 2, 2010
To give some background details, I have created a website for a friend that has a few pages that require a database in the background. I've used Visual Studio templates for most of it, so there's the standard ASPNETDB.MDF file that's created for users and groups, a login page and a page to view and manage those users etc etc. The login page uses the standard controls for logging in, retrieving lost passwords and so on. Being standard controls, by default they get the connection string from the web.config file. Upon attempting to upload the site to my host (1and1.co.uk in case anyone else has any dealings with them) I discovered that storing the connectionstring doesn't work. 1and1 support say that the sql databases can only be accessed using scripts like this (this is an example of theirs):
<html>
<title>Queries from the MS-SQL database with ASP</title>
<body bgcolor="FFFFFF">
<h2>Query from table <b>products</b> with ASP</h2>
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATA SOURCE=mssqxxx.1and1.com;UID=dboxxxxxxxxx;PWD=xxxxxxxx;DATABASE=dbxxxxxxxxx"
'This code block will create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from products"
rs.open SQL, conn
'will iterate to display the records got from the database
While Not rs.EOF
response.write(rs("id") & " " & rs("price"))
rs.MoveNext
Wend
'closes the connection
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing
%>
</body>
</html>
So my question, is it possible to get the standard asp.net controls to access a database through a script like this?
View 8 Replies
Jun 1, 2010
I need to do an insert into a database table (SQL Server). I want to compute value of 1 column based on the existing data and then do an insert. How do I prevent another user from getting access to the database in the middle of this process?
View 2 Replies
Sep 28, 2010
I wish to acces my database using MSSMS at the same time that I am running my web application. When I tried to access my database with MSSMS I get the following error:Failed to retrieve data for this request (Microsoft.SqlServer. Management.SDk.Sfc)Additional Information:Unable to open the physical file "C:inetpubwwwrootmyappApp_Dataaspnetdb.mdf".Operationg system error 32: "32(The process cannot access the file because it is being used by another process)". (Microsoft SQL Server, Error:5120).What can I do to being able to view my database with MSSMS at the same time?
View 5 Replies
Mar 25, 2010
I need to make a webservice in .net (I know how this works) but then I need to get data out of a database. But my company wants to make it in a way that you can use the system with multiple databases.
So my option was make multiple abstract classes which contains the folowing code (depending on the database type, this would be a SQL database)
public abstract class AbstractDAO<T, Tid>
View 5 Replies
Aug 25, 2010
I have a datalist and I am filling it using a dataadapter, dataset. So in my .ascx page, I have
<asp:datalist runat="server" id="dlProducts" repeatcolumns="2" repeatdirection="horizontal">
<itemtemplate>
<table border="0">
<tr><td><%# Eval("Item_Name") %></td></tr>
<tr><td>I have to add a picture here</td><td><%# Eval("First_Name") %></td></tr>
</table>
</itemtemplate>
</asp:datalist>
In the area where I have put a statement like "I have to add a picture here", I have write a big case statement. Like:
Case: 6 // show a picture from file1
case: 7 // show a picture from file2
Case 8: //show a picture from file3
So How do I do this here? Because I dont know how to access the datalist values from code behind.
Here is my code behind:
SQLString = "SELECT First_Name, Picture, item_name, item_id from table1 where item_id = " + request.querystring["iid"];
dataadapter daItems = new dataadapter(SQLString, "connection_name");
dataset dsItems = new dataset();
daItems.fill(dsItems);
dlProducts.datasource = dsItems();
//So at this point how do I populate the picture in the <TD> tag I mentioned earlier?
View 2 Replies
Jan 13, 2010
I am attempting to write my very first ASP.NET application, it will simply display the contents of an SQL server database table in a Gridview. This is just a first step, my eventual intention is rewrite a set of VB6 applications I wrote some years ago. But I need to walk before I can run.
I have already created an SQL Server database containing all the tables used by the VB6 applications.
How do I link this database to my ASP.NET application. Previously (on another computer) I have simply opened "My Computer" and then navigated to the .mdf file (e.g. northwnd.mdf) and then dragged and dropped it into App_Data in Visual Studio. However when I try that on my own machine, with my own data, I get an "Access Denied" message.
How can I not have access to my own data on my own computer? What am doing wrong?
I am running Visual Studio 2008 on a Windows 7 Ultimate machine, with SQL Server 2005 Compact Edition (or which ever one installs with VS 2008).
View 13 Replies
Mar 8, 2011
I am developing web application using asp.net. Here i need to access two databases in which one is present on other server. I am able to connect to database present in same server but not with database present in other server.
I am using MS-access. I dont know the changes to be done and syntax for database connection.
View 3 Replies
Jan 6, 2010
I'm currectly tryin to access a specific value in my database in a specific column. I'm tryin to use the primary key of the table to access the actual value in the row of that ID.
The current code:
[Code]....
Just iterates through the table and looking for any row with the boolean 'checkin' value is True, then it takes the 'id' value of that row and stores it into an array. Is there a way that I can access a another entry, and only that entry, in the table with the 'id' stored in the array?
Like if my data base contained and int, primarykey, `id` value, a boolean, `checkedin` value, and a `time` value, is there a way to access, lets say, the row with `id` equalling 3 and and the checkIn value from that row?
View 2 Replies
Mar 16, 2011
Okay, I have developed VB.NET winforms applications and I understand that working with ASP.NET would be similar. However, this seems way complicated then I thought. Basically, i am working on accessing one table data from a database and populating data in a datagrid. I have few text boxes on the display page and if a user clicks on submit button i want a new set of data with new select statement based on user input.
I don't quite understand how the textbox value can be passed on the same page and a new select statement is generated, which then populates the datagrid.
View 2 Replies
Dec 10, 2010
I built an ASP.NET 4.0 Web Site. It works perfectly on my development computer. However, when I deploy the web site to theProduction Server, which is a Win2003 Small Business with Sql Server 2000, the site can't connect to the database.
These are the different tests I've made:
I tried using Integrated Windows authentication and this connection string: Data Source=myServerAddress;Initial Catalog=myDataBase;Integratedsecurity=true; and the error I got was that NT Authority/Network Service couldn't open the database. So I added that account to my database users list and gave it the appropiate permissions. Nothing.I tried using Sql Server authentication, so I created a new database user with a password and changed my connection string toData Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;. Nothing. I still got the same NT Authority user message.I deleted the used I created in step 2 and used the same connection string, to see if this time I got an error saying something about my user, and indeed it happened. I got an exception saying that user myUsername couldn't log on. I then created the user again, ang got the NT Authority user message one more time.I created a console application that used the same connection string from steps 2 and 3, and it connected to the database witouth any problem, which made me think that my problem's got something to do with my Web.config.I tried enabling impersonation on my Web.config, and thos time I got the same error message, only referring to the user I logged in to Windows, instead of NT Authority/Network service. What else could I check? My Web.config is this in case it helps (I havn't really put anything into it other than what VS puts):
[Code]....
View 10 Replies
Aug 27, 2010
I want to use NHibernate with Asp.net 3.5 but i don't know how to use it.I search on Google but couldn't find the complete explanation about why to use NHibernate,Advantages of using it and integration with Asp.net projects.
View 4 Replies
Aug 12, 2010
I am about to give up on this pos...unless somebody here simply gives me the right code to fix my problem. I'm tired of running in circles, and scouring the internet with no progress at all.
Problem: not updating collections with FK's.
Example:
Forum forum = new Forum("Sample");
category.AddForum(forum);
categoryRepository.Update(category); <- fails with transient object error for forum with no CategoryId.
Mapped right using References<Category> and HasMany<Forum>. Conventions are as follows.
Ref:
instance.Column(instance.Property.Name + "Id");
HasMany:
instance.Key.Column(instance.EntityType.Name + "Id");
instance.Cascade.All();
instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.None);
Now, I've tried every possible setting for inverse, all the different cascades, on both sides. Nothing works. It just flat fails, telling me it can't insert NULL for Forum.CategoryId (field, not entity prop).
View 8 Replies