how to access datasource in geronimo via jndi by remote client application - jndi

I have created a datasource in geronimo server.
I'm able to connect it via admin console.
Can anyone let me know how to connect to this datasource by external standalone application via jndi.
Specifically i'm not sure about these following values :
java.naming.factory.initial=TO_BE_CHANGED_BY_USER
java.naming.factory.object=TO_BE_CHANGED_BY_USER
java.naming.factory.state=TO_BE_CHANGED_BY_USER
java.naming.factory.control=TO_BE_CHANGED_BY_USER
java.naming.factory.url.pkgs=TO_BE_CHANGED_BY_USER
java.naming.provider.url=TO_BE_CHANGED_BY_USER
java.naming.dns.url=TO_BE_CHANGED_BY_USER
And also which jar should be included for this to work ??

It's answered here .
http://apache-geronimo.328035.n3.nabble.com/jndi-properties-for-datasource-tp3987125p3987127.html
Geronimo datasources/database pools are designed to only be accessed in the same VM as they are deployed in. You cannot look up a database pool deployed in geronimo from another VM no matter how you configure the remote jndi. One reason for this is that we don't have a distributed transaction manager and certainly couldn't come up with a correctly configured transaction manager in the remote vm through a jndi lookup.

Related

EJB remote invokation from Wildfly to Jboss5.x server

Enviornment - Source server#Wildlfy_9.0.2.Final,Destination_Server#Jboss5.x, EJB3.0,BuildingTool#ant
1.Wildfly to Wildfly EJB client without remote-outbound-connections
2.https://docs.jboss.org/author/display/WFLY9/Developer+Guide#DeveloperGuide-EJBinvocationsfromaremoteserver
From above two link i have successfully remote EJB lookup for Wildfly_9.0.2.Final to Wildfly_9.0.2.Final server. After this i want to replace destination server to Jboss 5.x server. I have spent hours looking for tutorials on Google. However I cannot seem to find anything that holds the hand. Can anyone direct me to some link?
You have to add an extension for this as the JNDI lokup has changed between AS5 (jnp) and WildFly. I don't know what is thge current status of https://github.com/jboss-set/jboss-as-legacy but this was the goal of this extension.

how to connect UNC-located database to embedded server?

I have next specific situation. I have an application using Firebird embedded server. The files: application executive, database, fbembed.dll are located in the same folder. Everything is good and working good.
Now my client says so:
I would like to place all your application file on a server and run it via local network from all workstations.
So as I see I start application on the server and it starts. But database connection string looks now like:
//SERVER/share/db.fdb
Yes, I know conventions about allowed firebird paths from here: FAQ: What's a connection string?
I do not understand what should I use with embedded server? Is it possible at all?
If you want to access a Firebird database over the network, then you need to install Firebird server and connect through the server. You can't (at least not by default) access a database from a network path, and you really shouldn't (although there is a config option to allow it), as it can lead to database corruption due to insufficient or incorrect filelocking support over the network.
So: Don't use Firebird embedded, but install Firebird server and configure the clients to connect to Firebird server.

Trying to call svn.exe from batch file called by .NET webpage - odd results

The situation: I have a mvc.net web page which, when called, runs a batch file on my server using System.Diagnostics.Process.Start and cmd.exe. The batch file contains a line that runs "svn.exe update myfilepath" and should therefore update the files on the server.
What's happening?
- the batch file is running, but the call to svn.exe does nothing, nor produces any error messages.
- if I run the batch file by double clicking, the svn command DOES run successfully.
I guess this is a security issue, but I'm no expert on this and I cannot make any headway.
The site is hosted on Windows Server 2008 R2 and the app pool is using the ApplicationPoolIdentity system. I have tried running the app pool as Network Service and also adding Network Service as a user that can Read/Execute to svn.exe.
Please help!
This could be proxy related. It's possible that you access the Internet via a proxy, but that the user profile for the app pool identity isn't configured like this. You may need to use a domain account that you can log on as in order to create a suitable user profile. You will also need to make sure IIS is loading the profile by ticking the appropriate option.
(Another possibility is that the working directory for the process you are starting is not set correctly to the root of your Subversion working copy. We've established this wasn't the problem in your case.)

Connection between windows service and sql database

I am trying to establishing a connection between a Windows service written in C# and a SQL Server Express database. But when connection.open is called I get this exception
System.data.sqlClient.sqlexception:
{"Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be
closed."}
But the same code works fine when I run it as console application.Can someone please help me with this??
_connection = new SqlConnection("Data Source=.\\MSSQLSERVER1;AttachDbFilename=D:\\vinay\\project\\LightHistorian\\LH_DB.MDF‌​;Integrated Security=True;User Instance=True;");
i gave same credentials as local system.It works a times and doesnt at some other time.But when ever this exception happens,If i restart the machine it works.Wonder what the problem is??
I have used same connection for both windows service and console application
When you execute your console application, the EXE runs under your user credentials.
When you execute your service, which are user credentials? Is your service running under Locl Service Account? Or System? Or what?
Try to manually set the credentials your service must run with (in Windows services panel, check your service properties) and try to execute it with the same user/pwd you run your console app with.
UPDATE taken from here:
Using an User Instance on a local SQL Server Express instance
The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer.
I could think that your service credentials are not granted to create a new SQL server instance, so try to remove that part.
Anyway, set user credentials on service properties and see what happens.

How can I create a local user profile for the anonymous user of an ASP.Net MVC application under IIS 7?

I've been experimenting with ASP.Net MVC, and have come across a problem that is probably not specifically MVC related. But I cannot get the authentication in the default MVC application (the one created by the wizard when you create a new MVC project) to work properly under IIS 7 on Windows 7.
If I run under the Visual Studio environment, it works, but if I switch the settings to run under IIS instead, I get the following exception trying to submit the login or registration:
Failed to generate a user instance of
SQL Server due to failure in
retrieving the user's local
application data path. Please make
sure the user has a local user profile
on the computer. The connection will
be closed.
I believe that this is because the website runs under my own account in Visual Studio, but under the IUSR account in IIS. Google searches on the exception message have been unhelpful so far.
So, can one create a local user profile for the IUSR account? If so, how? Is there something else I should be doing to get the SQLExpress engine to work under the anonymous account in IIS 7?
I also tried configuring the IIS website to use my account, but since this is my home machine, my account doesn't have a password, and it appears that IIS won't let a website be configured to use an account without a password. Or, since this is my first experience with IIS 7, and configuration feels very different than IIS 5/6, I am just missing the right setting that will let me configure the account to use for anonymous access.
EDIT: Some additional information. If I empty the App_Data folder and try again from IIS, SQLExpress attempts to create my database and fails, but the exception message has further information with the following suggestions.
SQLExpress database file auto-creation
error:
The connection string specifies a
local Sql Server Express instance
using a database location within the
applications App_Data directory. The
provider attempted to automatically
create the application services
database because the provider
determined that the database does not
exist. The following configuration
requirements are necessary to
successfully check for existence of
the application services database and
automatically create the application
services database:
If the applications App_Data directory does not already exist, the
web server account must have read and
write access to the applications
directory. This is necessary because
the web server account will
automatically create the App_Data
directory if it does not already
exist.
If the applications App_Data directory already exists, the web
server account only requires read and
write access to the applications
App_Data directory. This is necessary
because the web server account will
attempt to verify that the Sql Server
Express database already exists within
the applications App_Data directory.
Revoking read access on the App_Data
directory from the web server account
will prevent the provider from
correctly determining if the Sql
Server Express database already
exists. This will cause an error when
the provider attempts to create a
duplicate of an already existing
database. Write access is required
because the web server accounts
credentials are used when creating the
new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user
profile. See the readme document for
details on how to create a local user
profile for both machine and domain
accounts.
I've pretty extensively confirmed that the first three suggestions have been satisfied. The fourth seems to be the cause of my problems, but I can't figure out how to do that. And although the suggestion claims there is a readme document that describes it, I have not been able to find that document.
I got this problem as well running under medium trust. The process that creates the database requires at least High trust. You can check this by looking in your Web.Config for
<trust level="TrustLevel" />
If there is no trust specified in your Web.Config, try adding it and set it to either Full or High. If this doesn't work, there is a machine.config in your IIS which you would need to modify.
That being said, the best route I have found to solve this is to just use aspnet_regsql.exe to create the necessary tables and then change the connection string in your Web.Config to look at it directly.
I solved "The directory 'LocalApplicationData' does not exist." error when running an SSIS package through an SQL Job by ensuring the SQL SSIS service and SQL Server Agent service were running under the same account as the swql job was set to use!
This in my case was a domain account.
Solution: Try UNINSTALLING any updates before you started experiencing the issue. I spent countless hours - wasted hours that I will never get back in my life - reading and following every solution possible without success. I uninstalled all SQL Server updates and now everything works fine.

Resources