I created a web application through the NetBeans IDE running a glassfish server and a Java Database.
I want to now have this be standalone and run on the startup of my physical machine.
I am having trouble figuring out how to get the database set up on the server though.
On my server machine, I've got Glassfish running and I figured out where to put my war file so that it will run on the server. However I can't figure out how to get the database setup that the application needs to run.
I don't know if it has to do specifically with the glassfish server ?
Or do I need to have a separate database program along with the server ?
I believe glassfish comes with a JavaDB but i can't figure out how to actually create and configure a database. All I can do is create connection pools and resources...
According to Oracle's javadb page, it's an implementation of Apache Derby.
You should be able to download and run Derby directly on your machine. The connection strings may be different than what they were when using the embedded version, but once you figure that out it should work fine. Good luck!
Related
so i made a project with MYSQl database but because of the embedded facility of 'Derby' i switched to Derby database. I uesd Netbeans IDE in which my application is work perfectly (all operation are performed very well) but when i make a jar file of my application and run it then its stucked at a point where its need to fetch the data from database, I think that this jar file is unable to connect the database when i run it. my project is simple java project not maven proj.
I have no idea what to do and i am new to derby database please help me to complete my project!
I am mentioning some images
Connection Properties
Connection code
Derby libraries
I get the answer we need to add 3 jar file in libraries
Derby.jar
DerbyShared.jar
Derbytools.jar
These are Embedded database Drivers of Derby not for Server.
experiencing an odd issue I've yet to see on any of my other machines. This is a fresh laptop, so I have installed VS 2017, SQL Server 2017 express, then created a quick sample project using one of the stock .net core projects (with authentication stored "in-app"). This, of course, creates some basic entity migrations and DB context.
When I run I'm getting access denied errors. So, of course, I checked SQL service default user which is an admin. I then run basic migration commands and receive this
So, of course, my next step was to double check the default data locations of SQL since it appears to be trying to store it in C:\Users root?! I have never had to bother touching this during install, but worth a look. And of course, they are as I expected in their default locations of C:\Program Files\ etc
Rapidly running out of things to try at this point - and considering this is a fresh windows 10 install, with bare-bones vs 2017 and SQL express 2017 it feels a lot like a bug here. Everything is a default if you were to File -> New Project -> .NET Core Web Application with INdividual accounts.
Anyone have any thoughts or things worth trying? Why is it trying to store my DB in C:\Users? Connection string -
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-WebApplication3-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
Thanks!
-Marc
You are not using SQL Server Express.
The local string says (localdb), which is the SQL Server engine running in user space. This is a big difference. Usually SQL Server or SQL Server express runs as service. (localdb) is not an alias for localhost (loopback address). It's a special name for a minified version of SQL Server which runs in user space.
When SQL Server runs as a service, it needs to have read/write permissions to the folder it writes. This is usually NOT THE CASE when the file is located within the User folder.
LocalDB on the other side, is always started when you start debugging your application and runs with the permissions of the user. So if your file was created by an admin user or outside of a directory you have write permissions.
Also, when you mount a database to SQL Server (Express), then the file is protected from write access to other applications, so LocalDB can't open it neither.
LocalDB is made for development to offer most of the SQL Server features but without all the hard setup and permanently running service in the background.
Essentially you have two options:
Use the SQL Server connection string as #TanvirArjel suggested
Detach the database from SQL Server express, copy it to your user folder (C:\Users\<myusername>\) and then correct the path to it
Then it should just work.
Notice that LocalDB is not meant to run in production, so you will likely experience issues when trying to run it in IIS (IIS Express and Console applications and WPF work fine).
Reasons for LocalDb not working with IIS is because ASP.NET (Core) applications within IIS run with a special user, but LocalDbs are always created in the users profile folder. Now, the accounts used by IIS don't have a profile and can't create the database and can't access any database outside (since localDbs are stored in user folder only the user who created it has access to it).
Here some source on it and the reasons behind it.
Using LocalDb with IIS
Write the connection string as follows.Hope it will work...
"DefaultConnection": "Server=YourPcName\\SQLExpressInstanceName;Database=aspnet-WebApplication3-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true"
I have a small asp.net core website that I push to my server via jenkins. Jenkins does git checkout and then dotnet restore and dotnet run. It works for the website, but I added entity framework and I'm a little confused. How exactly do I move my local database to the server? Or should I create one on the server and then reference it?
I have one mssql database on (localdb)\MSSQLLocalDB, but when I run the server and try to go to a page which gets data from the database I get 500 Internal Server Error.
I would like to have one local db for testing and one on the server, but I just can't wrap my head around all of this.
Well in development, you should write a init script for your database. This will create all the required stuff your application needs.
So in linux...
Install the MySQL, get the users set up, and init the database.
In your application...
Provide the connection string for the DB installed in Linux.
I am not running my app in c# but this is similar to my node app. That is what I do. I develop in windows with Postgres. Then my prod is on a GoDaddy Linux cloud server and I have Postgres installed in that. When I do my git pull for the latest, I don't have to change much because of the .env file for my environment variables.
I am trying to do a Windows app and connect to an Oracle database. For now, this is all I am trying to do. When I test this from development server (Windows 2003 Server) it works fine. I copy the content of "output" folder (where the .exe file is in) to my local machine (Windows 7) and try to run the same app and get errors. Same thing happens when I copy the code to another server running Windows 2003. The error I get is:
"Could not load file or assembly 'Oracle.DataAccess, Version 2.112.3.0, culture=neutral, Public Key Token=89b483f429c47342' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Since there is no Oracle.DataAccess.DLL file on either my local machine or on the server where the test failed, I thought maybe I can copy the DLL to Windows application's output folder, add a reference to this DLL and compile. But that was not the solution.
Is there any way I can fix this without expecting every machine this application (eventually, a Windows Service) is running from to have Oracle.DataAccess.DLL in GAC? Do I have to install ODAC on all the machines this application will running from (something like couple of hundred servers)?
If you can get away with the System.Data.OracleClient connection, than you don't have to do anything special on the servers.
If you want to use the ODAC connector, you will need to install the client on each of the servers and include the TNS names. It is a bad design on Oracle's part.
Both System.Data.OracleClient and Oracle.DataAccess require you to install Oracle client software on to each server. As such, their portability leaves a lot to be desired.
A more portable way to deploy your Oracle software would be to use the managed Oracle library, Oracle.ManagedDataAccess, which is available via Nuget. It does not require an Oracle client installation.
Be aware that, since Oracle.ManagedDataAccess does not rely on the oracle client software, that you will have to adjust some configurations. You can either include the tnsnames.ora along with your deployed application, write the connection string as you would an entry in tnsnames.ora, or you can specify the exact hostname/port/oracle sid.
If you insist on using an unmanaged Oracle Client, consider the following:
System.Data.OracleClient (and System.Data.OleDb) are easier to deploy than Oracle.DataAccess since they are part of the .NET framework and are written for any CPU. However, they both have the same functionality and same limitations; System.Data.OracleClient is also a deprecated library.
On the other hand, Oracle.DataAccess offers more functionality but comes in both x64 and x86 flavours, which can make deployment a lot trickier (especially on IIS-hosted web applications).
I am a newbie with DotNetNuke and have been stumbling on how to deploy from the development server to the deployment server. For starters my development and deployment servers are one and the same machine. Here are the steps that I did:
DNN Setup
Downloaded DNN using WebMatrix.
Launched DNN and proceeded with the installation wizard, which is basically just testing the environment and then creating the DNN database.
After the wizard's installation launching DNN will now proceed to the Getting Started page
Added "localhost/dnn" in the site alias list
Moving to ISS
In IIS I added application (folder) DNN in the web root
I copied all the files from the original webmatrix path to the dnn folder in c:\inetpub\webroot making sure that the file/folder hierarchies are the same
Result:
When launching DNN using my browser I am directed to the installation wizard page instead of the Getting Started page. What am I missing?
Thanks!
Confirm that the permissions on the folder containing DNN are the same on your test server as they are on your development server. (I give Network Service read/write and IUsr Read/Execute)
Confirm that the application pool running your application has the proper identity (Network Service is suggested) and is running the proper .NET Framework version; based upon your question, I think you are set on this.
Gain access to your web.config file. You will see a ConnectionStrings section. You probably need to update the connection strings.
If your test server runs off of a different database than your dev server, figure out the connection string of your test server and update your connection string accordingly
You may be able to restore a .BAK file of your DB to your test server
If you do this, you will probably need to (in SSMS) edit your Portal Alias table to include the host name that you are using in your test server environment. Examples: Maybe you access the site via localhost/ on your dev environment, but you access to test site via test.Ronald.com? test.Ronald.com would be your PortalAlias
If your test server runs off the same database server as your dev server, it sounds like you need to open up access in firewalls so that your test server has connectivity to your dev database
A word of advice
Once you get it running, you will be making changes to each database separately (assuming your test site and dev site use different DB Servers). This sync issue can be a royal pain with DNN, as your page structures, module assignments, html module contents, installed modules/extensions will get out of sync. While restoring backups is nice, it is not a very good long-term solution. I recommend database-syncing tools
The problem is most likely a problem with DNN not being able to find the Database. If it can't find the database, it will run the wizard in order to create one.