We have to create a Java project on ATM Mechanism. We plan to connect it to a database also.
Could you please help me as to how I can connect an MS Access database to a Java applet which we have created using BlueJ?
Thank you.
Connecting the applet with MSAccess would be very complex, because of applet security limitations. An applet is not supposed to access local resources (files), so you would have to add all kinds of signatures to the applet for the browser to allow this (I did something like this about 12 years ago, and from my knowledge, the applet security limitations are still in place, or even worse).
But if you do manage to access the local filesystem, you can use some library like Jackcess or access the mdb file directly using jdbc/odbc driver as shown here.
Related
I have application developed by different apk/api, I have version java Desktop application and Android Application and Windows phone 8.1 Application , My problem that the three version use the same database to access it can modify and insert ..etc
how i create shared database between them to use the same database via internet because i enforce my user to access the internet to use the application. There is any way to do that ?
Sure! Host a WebService for sharing data amongst devices. Using a simple php script to insert and select will allow you to achieve this.
Something like this blog would help develop understanding of web services if you want a place to start.
You can create a an online database without having to implement your own backend using this website Parse and implement platform specific code to read/write data for different platforms using their SDKs.
Im trying to set up the JDBC driver to work with a Webapp. I did manage to make it work with my java class but it must be aside from the webapp. In a single project apart while compiling in Netbeans. I've to make it work with a webpp using Tomcat. Im in the part of validating user login info using the data stored in the Database. I send the user info to the server side (Java class) to validate as I'm in favor of not using scriplets in the JSPs so I dont want to re-code the same functions I have in my Java class. Where do I put the driver so that it can be used in the Java class in webapp? I tried in Tomcat/lib and Tomcat/common/lib. Im using LINUX Ubuntu.
In your webapp under WEB-INF/lib
Never mind, I found the folder. For future users in need, you must place your JDBC driver in:
**/usr/share/tomcat7/lib**
NOTE: This is in Linux Ubuntu.
I am trying to create an desktop application for shop. I can create create desktop app and database individually but I dont know how to connect them and how to execute query from desktop. May be for executing query I should use php but I dont know how. My database have been created in hosting site using cpanel.
You need some kind of APIs on the server side. First learn about RESTful APIs and build your server accordingly. Decide a PHP framework to do this with ease.
Next design your desktop application in JAVA which has
Ability to connect to your APIs ( Give Credentials use OAuth2 or something.)
Store data locally and Sync it whenever Internet Connectivity is available ( Resolve conflicts when syncing )
This will need lots of research and efforts. Happy Coding!
This is a broad question. If you are using php to build a desktop application (which appears to be), you must download WAMP server for executing php scripts locally. But I recommend you making a desktop application using java swing or any other popular GUI-based programming language. Please go through MySQL using Java's JDBC tutorial . Also Google as the question has a quite broad scope.
Your Question is Vague But here is a tutorial on creating a Java Connection to a database.
http://www.homeandlearn.co.uk/java/connect_to_a_database_using_java_code.html
I have prepared an application that is a small demo of Student information manipulation. I have stored information related to students in a MySQL DB. Now my application is working 100% on my computer. But I want that work everywhere without depending on Database! I mean I just want "WHEREVER MY .JAR FILE GOES, DATABASE SHOULD ALSO GO ALONG WITH THAT INSIDE .JAR FILE "
So anyone who is using my application or trying it, they can realize exact result of this application.
How can I make this possible? Please someone help me.
For that I have done the following things:
I have installed MySQL database on my computer.
I have created a database on that MySQL server
I have created some tables in the database with a lots of data.. this data is to be used in my whole application, even for login.
Now I want to deliver this application to various clients but my clients are not technical persons and I don't want to give instructions to each of my client to do the above four steps.
How can I integrate some functionality into my app so that they can use my database, Tables and Data automatically .
It would be much better if the code can install the MySQL database automatically from the setup file attached with the application.
How the applications available in the market manage information
Have you thought of using another database engine?
MySQL requires the server to be installed and configured, and it is a huge task to be done by an automatic installer.
What about using for example SQLite http://www.sqlite.org/ or Apache Derby http://db.apache.org/derby/. Both of them work by creating a file in your working dir, you could setup the database and populate data at install time
I have two suggestions for you:
A. Use SQLite instead of MySQL. SQLite is an embeddable database engine and does exactly what you need. You can simply copy the .sqlite file where all the information is stored and distribute it with your JAR file. Given that you've already written you app to use MySQL, this could mean making a few changes to your code.
There is a good SQLite jdbc driver at:
https://bitbucket.org/xerial/sqlite-jdbc
I've used it before, though not extensively.
B. Use a portable installation of MySQL. If you are using Windows these are available on the MYSQL page, look for the downloads marked "ZIP Archive" instead of "MSI Installer". These versions are portable in that they do not require an installation process, just unzip the file, and start the service. Your clients need to know how to start it up, of course. Perhaps you could create a shortcut for that.
Of course, the idea of MySQL being a network server is so that everyone in the enterprise works with the same data, by connecting to the same server. If your clients will use this application in various computers in the same company, you should consider having a single MySQL Server installed, and making the clients connect to that.
Hope this helps!
I've read some articles on the Internet that this is not possible. To communicate own SQL database that is located on other server from GWT application. Jetty doesn't allow it.
I found a way how to perform it but it's not very cosy. I have client and server part inside GWT. The server has to communicate with MySQL database on localhost. So I've written an ant script to build a war that I can launch on Apache Tomcat server. It works perfectly there but I'm not able to debug the code effectively.
Do you have some advices how to perform this task? I was thinking of writing the clienty only in GWT and find some waz how to communicate my own server written outside the GWT. I've found Apache Thrift for GWT but this edited library of thrift seem not to work properly.
Thank you very much for your answers:)
It is possible to communicate with a database from a GWT application. The client side has to call the methods of the server via GWT-RPC, which can communicate with any database.
Maybe Jetty does not support it (have not tested it personally) but you can develop your web application using Apache too. There you can access the database the same way as from any web application:
You will need the mysql-connector-java-5.1.20-bin.jar file (downloadable from: http://dev.mysql.com/downloads/connector/j/ ), and restart the server added to the $CATALINA_HOME/common/lib directory.
OR added to the WEB-INF/lib folder of your web application.
You can find tutorials online of how to develop an application using Tomcat instead of Jetty. For example: https://wiki.auckland.ac.nz/display/BeSTGRID/Deploying+GWT+to+Tomcat+in+Eclipse
Reshi, stop and think about how applications really work. Nobody provides web pages with javascript to read/write databases, that would be crazy and unsecure. Servers are always in themiddle of all communication in this case. You need to create services that run inside your server, one of these services will be a database layer.
Javascript cant create network connections and read/write binary data, thus it would be insane to attempt to get the gwt compiler to compile any jdbc drvier and more.
Jetty does NOT stop us from connecting to a database. All you have to do is to follow the MVP model way. Although MVP is better bet against all hurdles, at a minimal point, you would have to try not having SQL code on the client package.