Connect MS access database in JSP pages - database

I would like to ask you how can I connect a MS access database in JSP pages?Do you know any ready class which I can use?I am using Netbeans to create JSP pages!

Ancient question, but I shall answer anyway. Had to Google around a bit when the same question flummoxed me. Here goes (concise version of stuff found here):
Administratively Register Database
Use MS Access to create a blank database in some directory. (eg. Database1.mdb.) Make sure to close the data base after it is created.
Go to: Control panel -> Admin tool -> ODBC
Under the System DSN tab (for Tomcat version 5 or later – User DSN for earlier
versions), un-highlight any previously selected name and then click on the Add
button.
On the window that then opens up, highlight MS Access Driver & click Finish.
On the ODBC Setup window that then opens, fill in the data source name. This
is the name that you will use to refer to the data base in your Java program – like
arc. This name does not have to match the file name.
.
Then click Select and navigate to the already created database in directory.
Suppose the file name is Database1.mdb. After highlighting the named file,
click OKs all the way back to the original window.
Connect a JSP page to an Access Database
<%# page import="java.sql.*" %>
<%
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=null;
conn = DriverManager.getConnection("jdbc:odbc:arc", "", "");
out.println ("Database Connected.");
%>

Now that the JDBC-ODBC Bridge has been removed from Java 8, the UCanAccess JDBC driver may be a more relevant option for future users. For details, see the related Stack Overflow question
Manipulating an Access database from Java without ODBC

Related

power view with Sharepoint 2016

I am trying to publish sharepoint2016 website including Power View reports which created by SQL server services service (SSRS). there is top level site and bi center as sub-site; both are working fine but problem is that when I try to view the report it said the error:
"the web application at [url] could not be found. verify that you have typed the url correctly. if the url should be serving existing content, the system administrator may need to add a new request url mapping to the intended application."I search about the error but It does not reach my target.
https://forums.asp.net/t/1970799.aspx?SQL+Reporting+Service+Runtime+Error+The+item+reports+Report1+cannot+be+found+rsItemNotFound+
note that the whole site is working fine in domain.
Please help...
Thanks...
Sorry for late guys...
i found that Power shell of SP cannot execute any command related to SSRS
it just need to reinstall SSRS service compatible with SP2016. then every thing is fine.

Setuping DB Navigator(SQLite) for PyCharm

I have not been having luck setting up a connection to SQLite3 through DB Navigator. I have read over the documentation, but it seems to be out of date and doesn't explain how to actually set up a connection. My set up screen doesn't even look like what is pictured in the docs. The built int help doc just errors and says it can't find the document.
When I try to test the connection, I get the error "Database information incomplete or invalid (host, port, database, file)". I have tried host = localhost, port=22(default). There is the option to enable 'Use SSH' but disabling doesn't change the result. There are fields for Username, and Password. I'm not sure what they want in there. Currently I have 'system' and a random password.
Database file(a single field) is the path to the dir that the database is in. The field 'main' I have the name of the database file itself. Driver Source is the default of built-in library.
What fields am I missing or have in wrong? I can connect to this through VS with both SQLite and SQL server, but not PyCharm.
EDIT:
Finally figured it out. Single SQLite has no username or password capability, I needed to leave all of that disabled. In the database field I browsed and navigated to the file and selected the whole file instead of just the dir. The Main field was left empty.
I figured out that the plugin has a bug.
Step 1 - To connect to the databases you need to enable Auto-Commit and Connect Automatically in DB Navigator.
Step 2 - In DB Navigator > Settings > Database files, you need to add the database file's name, to click in the green add button and then press Enter.
If you still get the error but the connection was succesfully, don't worry, it's just a bug.
But if you get the error and you database connection it's not working, you must follow the Step 2 again, but now change the database file's name path, without include the name of the file and press Enter. Open DB Navigator > Settings > Database files again and now put the database file's name, to click in the green add button and then press Enter.
I've read about this problem in 2014, but nowadays this problem is still alive. Maybe, when you put the paths, there's no refresh in the database file's path and the connection can not be established.
I just solved this issue saving the database file in a different folder, it seems like the problem are the space characters (and maybe other special characters) on the path.
For example something like C:\Users\Wile E Coyote\Acme Files\MyDataBase doesn't work, but something like C:\Users\RoadRunner\Beep\MyDataBase works.

Cannot login to Oracle Enterprise Manager Express

I have downloaded Oracle Developer Days Database 12c virtualbox image. I can boot it and access the desktop. When I try to log in to Enterprise Manager (EM) Express using the URL http://127.0.0.1:8888/em I am asked to install Adobe Flash. I install it and get to the login screen.
If I try to login as SYSTEM I get the following error:
But when I try to log in as user SYS I get a strange error: Security token does not match. You must login again..
To me it looks like the credentials for SYS are OK, but there is something wrong with the user in the database. Is this correct and if so how can I fix it? Or is EM Express just not setup on the image?
This document from Oracles Metalink solves it. The solution contains 3 steps:
Make sure that XDB_WALLET is recreated successfully.
Make sure XDB is installed successfully and the appropriate roles, EM_EXPRESS_BASIC/ALL is applied.
Use IE 11.0.9600.16476 with compatibility view.
Mark Stewart's answer covers step 2.
The first two steps are not strictly necessary. It looks like they have already been applied to the image in my case. All I had to do was use a different browser. Opera, Chrome, and IE all worked, but Firefox didn't.
The fact that Oracle installs a browser that doesn't work with EM Express and that Adobe Flash is not installed when it's required is very strange.
Set up a personal user ID, grant DBA to it, and try granting EM_EXPRESS_ALL role to your user ID.
After making sure that a desired account has EM_EXPRESS_ALL granted I just accessed Enterprise Manager using New Private Window in Firefox.
In Microsoft Edge, no problem accessing Oracle 12c EM
In Microsoft IE 11, no problem accessing Oracle 12c EM
In Firefox : Security Token does not match
Found a solution for Firefox on Is there a way to make Firefox ignore invalid ssl-certificates?
Go to Tools > Options > Advanced "Tab"(?) > Encryption Tab
Click the "Validation" button, and uncheck the checkbox for checking validity
Be advised though that this is pretty unsecure as it leaves you wide open to accept any invalid certificate. I'd only do this if using the browser on an Intranet where the validity of the cert isn't a concern to you, or you aren't concerned in general.
I faced this because of the cookie data stored by Adobe Flash. Browsing on Private mode or Incognito did not help. Here are the steps to remove the stored data and start using EM on Chrome:
Go to Settings>Advanced>Content Settings>Cookies
Coose See all cookies and site data
In the cookies search box, key in the hostname used to access EM. I run EM on my localhost and hence filtered by localhost:
You can see Flash data being listed
Click on the item to expand and delete the item related to EM:
The same error still exists in 2019 on EM with Chrome Version 76.0.3809.87. My solution is to add EM URL to the "Allow" section in the Cookies section.
Use internet explorer to login to EM .
The other browser are not compatible with enterprise manager

Sitecore Analytics error

I can't make Sitecore Analytics working. I have Sitecore 6.6.0 (rev. 121015) and installed Sitecore DMS.
1) when i go to Sitecore->Marketing Center i get error XML Parsing Error: no element found
2) when i go to Sitecore->Content Editor, choose element and press Analyze->Reports I get error You do not have permission to see any item reports
3) In Content Editor when press Analyze->Goals get Cannot use Analytics with a database that has no definition items error
4) in logs I see following:
"Exception: System.InvalidOperationException
Message: Cannot use Analytics with a database that has no settings"
5) If I change url that i get trying to open Marketing Center (changing Marketing%20Center.aspx to Marketing%20Center/default.aspx) I get Cannot use Analytics with a database that has no definition items error
6) I have in my Sitecore.Analytics.config this tag:
<setting name="Analytics.DefaultDefinitionDatabase" value="web" />
I tried to give access to analytics database from SQL Management Studio, but didn't help.
What could be the reason of this error, and how to solve it?
Your errors seem to suggest that the database is missing data. Did you use the database provided on this page, http://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%206/Update/6_6_0_rev_121015.aspx ?
Go to the link above, scroll down to Download DMS 6.6.0 rev. 121015 for Sitecore CMS 6.6.0 rev.121015 and click the Download DMS 6.6.0 rev.121015 under SQL Server. Attach this database to your server and try again.
I haven't seen these errors, but it sounds to me like Sitecore is not able to access the Analytics database at all. You do have a connection string in ConnectionStrings.config named "analytics"? Try using the sa account just to make sure it's not a permissions issue. Don't forget to change it back from sa either way.
(caveat: I haven't used DMS yet, just OMS... it's possible I am way behind the times)
Publish your site (to web). You might be trying to analyze data that isn't live.
I just erased my previous answer as that was a consequence of what was wrong, but not the actual cause...
In the Analytics code, the Marketing Center node is requested from the current database. If it cannot find that item (which IS in the master database), you get the error.
But the code will NOT find the marketing center item if the security settings prevent the anonymous user read access...
That is where the error occured for me, when I was an anonymous user... And effectively, when looking at the security settings for the Marketing Center Item I found that inheritance had been blocked, hence preventing read access for the anonymous user...
Another reason this error sometimes occurs is when you have a production environment where there is no access to the master database.
Since the Analytics code uses the "master" database as the default definition database unless otherwise specified in the config settings, you could add the following to analytics.config:
<setting name="Analytics.DefaultDefinitionDatabase" value="web" />
That way, it will fallback to the web database in case of a production environment without master database.
Hope this helps...
Erwin
The issue is due to Sitecore not being able to read the definition items in the master/web database (depending on the Analytics.DefaultDefinitionDatabase setting).
The items it is looking for are:
/sitecore/system/Marketing Control Panel
/sitecore/system/Settings/Analytics
When the request is running, the user is default\Anonymous. Using Access Viewer, make sure there are no security settings disabling read access to these items. This includes parent items that would have a trickle-down effect.

How to create web service using Database adapter in OSB Console?

I have a requirement to use OSB with DB Adapter as for given task, I believe BPEL Process will not be better performer than OSB. I have gone through some sites but all of them are demonstrating OEPE not OSB Console. Any response will be appreciated.
I have similar requirement in my project and I was wondering here and there. Here is final solution of the problem. I documented for you guys.
Steps in JDeveloper
1. Create DB Connection in JDeveloper.
2. Create a Generic Project.
3. Create Project as SOA project and use Empty Composite.
Steps to create DB Adaptor
Go to Composite Palette and choose AD Adaptor.
Drag and drop the DB Adaptor in the External Reference section (right side of Composite view).
It will open a wizard for selecting the connection and Other DB related process.
Give name to service that you want to create
Choose the DB Connection you have created already.
Move one with selecting your desired choice of Stored Procedure or Table (insert/Select) functionality that you want your web service to perform.
If you choose Table insert/Select then you can also choose the relation between tables as optional step.
Try to keep all steps default if you do not want any special features.
Once you finish all steps in wizard, then it will generate whole lot of files under your Project.
Look for 4 main files .jca, xsd/.xsd, *.mapping.xml, *.wsdl
If you see all these files generated well in your project then you are all set and we can move ahead. If not then look for the issue.
Steps in WLS Console
Create Data Source
1.Go to Left panel and choose Data Source.
2. Select New -- Generic Data Source
3. Give Name as you wish but for JNDI Name you have to use the connection name from the *.JCA file that you already have. Open the jca file and search for the ‘UIConnectionName’. This value will be used as JNDI name in data source creation.
4. Choose Driver as oracle.jdbc.xa.client.OracleXADataSource
5. Use the host and Port and other details that you had selected during DB Connection (in JDeveloper). This is obvious step.
6. Choose target AdminServer.
7. If you finish everything correctly. You are all set here and you can choose to test the connection and should be Test Success.
Configure the DB Adaptor
Go to Deployment on left hand panel.
In Deployed services. Search for DbAdaptor.
Click on the name DbAdaptor.
Select Configuration tab. And under it choose Outbound Connection Pool.
Here you will see (javax.resource.cci.ConnectionFactory)
Click on new.
Choose javax.resource.cci.ConnectionFactory
Next page will ask for JNDI Name. For this, you have to go to your *.jca file and choose the value which is already there for Connection-factory as Location (like connection-factory location=?). Use the value of Location as JNDI Name.
Transaction will be No Transaction. Choose this for now. This is need basis selection.
Leave other selection as is and then Finish.
Note : Once you finish. Go to Properties Tab again and look for a property name : xADataSourceName. Its value should be the same as UIConnectionName that you have in *.jca file. It should be populated. If not then you can set now as well. You have to double click on the value section and then write the name and press enter. Then Save it.
With above all steps we have set the DbAdaptor to point to same DB where we have our table/store procedure.
What we did above is:
• We Have JCA File and WSDL for our service. Along with DB Setting.
• We have a Data Source for our DB in WLS.
• We have the deployed DbAdaptor in WLS which is pointing to the same JNDI.
Steps in OSB Console
Create a Project.
Create 3 folders under Project. Like Resources, Proxy Service, Business Service.
Activate your project.
In Resources folder. We have to add JCA Mapping. Point it to the *.jca we already have from above steps (We had created it JDeveloper). Just give the path and Save. It may give you Error. Ignore for Now.
In Resources Folder. Add a WSDL and give the path of your *.wsdl. If it give Error. Then ignore for now.
In Resources Folder. Add a XSD and give path for the *.xsd we already have.
In Resources Folder. Add a XML and give path to the file *Mapping.xml.
Revisit resource WSDL again and click on its name. “Edit References”. Choose the XSD you already have and Save.
Revisit resource JCA and click on its name and edit reference and point it to the mapping.xml
By now you will see all errors gone.
Activate your project.
Go to Left hand side and select the Business Service and Create Business Service by selecting the wsdl project. On next page select Binding.
Then select JCA and give the ‘Location’ of IES (remember we have a value in connection-Factory in *.jca as Location. We had used it while creating DbAdaptor). Give that value here.
Move to next, next and next and finish.
Your business service is all set.
Now create a Proxy Service. Select Proxy Service and choose from B usiness Service option and do select the Business service you have create in above step.
Then click done
Activate your project.
That’s it we are all set. In proxy service you can click and see what is the End Point URl and keep it safe for your future reference. This is the url that we hav eto give on Client to call our service.
With this we all Done.
Call from Client.
Select SOAPUi for this purpose.
Create new project and give the end Point URL.
It will show all the services in it.
Select one service. Create Request.
Put the values in Request XML and Use the endpoint URL by appending your Localhost:port.
Click go and you will see the response back.
So, Finally : We are done with testing a OSB project with DB adaptor.
This looks long, but once you do it, its very easy for next services.
Thanks, Hope that will help.
The OSB Console does not support creation of the JCA DB Adapters, and neither does OEPE.
You need to create the DB Adapter in JDeveloper and then import it via OEPE/OSB Console. OEPE is easier ;-).
For a guide, see:
http://guidoschmutz.wordpress.com/2010/08/08/oracle-service-bus-11g-and-db-adapter-a-different-more-integrated-approach/
or
https://blogs.oracle.com/middleware/entry/using_jca_adapter_with_osb_11113

Resources