Server DB usage - mysql

I've been trying to create 2 proof of concept applications with gwt and vaadin.
I started with gwt:
I was astonished by the idea off me debugging the client side in eclipse :)
The same reason I couldn't open a connection in mysql. in my gwt project (its client side DUH?!)
When I started working with vaadin I saw the following weirdness:
I could open a connection of mysql and inject the results into the containers.
Now that's weird?! how can I do mysql connection in the client? and how come I don't need an rpc for the db info to be transferred to the client?
I'm sure im missing something here. any help?

Vaadin is basically gwt with server-side business logic.
The containers work on server side, the results are then displayed with gut components.

Related

Can I access a mySQL DB created in phpMyAdmin with a web app that runs with the IDE's tomcat?

I hope I don't make it very confusing. So, for a school project I need to make a Spring MVC webapp that runs with a simple tomcat and connects to a DB. I downloaded xampp and made a DB with phpMyAdmin, but also run my app with an embedded tomcat server. I'm not exactly sure why but this seems problematic as I cannot access localhost. Is there a way to connect my app to the phpMyAdmin DB? If not, what would be an easy way to create and access a DB (I need only a really simple schema of one table)?? Any advice would help a ton!
If the web app is for long run i would suggest use of Hibernate ORM, you need to config and with few lines of code it will be live and runing, for just for trial or learning, H2 is a good options as #zlaval said in comments. And you can use any Database with Hibernate ORM, with one or two hours of research and studying you can achieve the task you searching for easily.
If you need to go for hibernate there there is some explained and easy steps to do so with hibernate ORM.
https://www.codejava.net/frameworks/hibernate/getting-started-with-hibernate-annotations

connecting an ios app to send information to a mysql database

Im doing my final project which is a taxi booking service. i intend to make an ios app for the customer so that they can book a taxi. the request will then be sent to the mysql database (held at the taxi base). i want to no how can i send the information from the app to the datatbase; and the datatbase to send a confirmation message back to the app confirming the taxi has been booked!>>>>>
i have read a lot about web servers but am very confused. can i use an web server e.g. windows home server 2008? any help would be appreciated.
I am not familiar with Windows home server 2008, but I'm pretty much sure that you can use it for your project.
If you want to keep things simple,
Just install XAMPP server which comes with all the components you need to work on this project including PHP and MySQL. It is one of the easiest servers to work with and most of all, its free and open source. http://www.apachefriends.org/en/xampp-windows.html
Then write the business logics inside your Web App using whatever the programming language you want to (for this one PHP would be enough, or choose Java if you want to have a more complex scalable solution). Writing data to a MySQL database using PHP is very easy and you can find ton of tutorials and sample source codes in the internet.
Now your web app is all set, the next step is to expose these services using REST where an iPhone can communicate with your services. Use JSON for interacting with your Web server from iPhone. Again, there are tones of tutorials on how to write a JSON RESTful service using PHP.
Finally in your iPhone app, you can access the service exposed from the server for saving data as well as to retrieve anything from it through JSON. For making this, use a good Objective-C framework such as AFNetworking. It comes with the JSON parser as well. Ref. http://afnetworking.com
Good luck with your project !
RESTful web services are going to be your best friend here.
Create a server side program in django or python or whstever. Connect it to a database (mysql).
You can host it on Amazon Web Services. I think they have windows 2008 instances. I would personally use the amazon linux ami.
Use afnetworking to invoke a get or a post on the server app and you are off to the races.
take a look at this open source taxi project
its work with RESTful web services but its better to forget about Microsoft Windows its better to use Linux hosting for your web service.

SQL Component Connection issue in IDE

Good evening guys.
I'm currently trying to get started on development of a project to make my own life a little easier. Essentially, i want to connect to a MySQL database running on a remote server, and then go from there with a few various options for usage. The database in question is used for a Joomla! installation, and my focus will primarily be managing articles from a desktop application (as opposed to using the administrator backend on the website).
I've allowed my own host access to the remote servers (via the CPanel web interface used by my hosting provider), and ensured that LIBMYSQL.dll is inside the RAD Studio\9.0\bin folder and again inside my executables folder (so as to avoid any of the issues related to being unable to init. the driver). I've connected to the server successfully by using MySQL Workbench and can freely query the table. Now, onto the problem.
This is my first database application so please understand that a simplified or excessive explanation may be needed
I'm having issues setting some of the component properties at design time. I've got a TSQLConnection component, a TSQLDataSet component, and a TSQLTable component. I've set up the server properties in TSQLConnection to work with my server.
However, if i try to retrieve anything from the database inside the Delphi XE2 IDE (i.e. the login prompt appears) such as changing Active property to true, i get a Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (10061) error (where 'x' relates to part of my servers IP).
If i run the application itself though, and then click on the "connect" button i've got on the interface, it connects fine with no errors. I added ShowMessage routines to the AfterConnect, AfterDisconnect, and OnLogin events of TSQLConnection to verify it was actually going through, and all of them functioned as i'd expect when successful. As i've not coded for it to do anything outside of that (due to still learning the basics), there's no data visible on the interface for me to work with, but the connection at least appears to be there.
To clarify, i can connect from the application i developed (as well as from MySQL Workbench, but not from within the Delphi IDE itself.
So, where am i going wrong with this?
I'm guessing it's probably some oversight by myself due to my lack of knowledge on the subject of databases, but i'm very keen to expand out of the desktop environment and start working with some more areas of the IT world (without losing the development side of things that i enjoy so much).
As #SertacAkyuz pointed out in the original comments, it was indeed an issue related to my connection, specifically Firewall settings. I had assumed that "Connection Refused" was related to the connection attempt being made, but being actively refused by the remote server. The more you know.

Integrating a Swing App With Tomcat

I recently created a web application with GWT. Then re-used most of the code to create a Swing version of the application that accesses a local database in offline mode. I am now implementing the 'online' mode of the application and want to access the same data as my GWT application.
Any ideas? Considered connecting directly to the MySQL server via SSL, but that's not working and doesn't seem as scalable. Should I use REST?
Any suggestions would be helpful.
To solve this problem in the past, we've used Jersey to create REST Web services which returns protocol buffers. The Swing app would then interact with the protocol buffers. The GWT app would ask for content type 'json' and receive protostuff objects in return. It worked quite well. That way, both apps can communicate with the server in the exact way.
Edit:
To allow your swing app to communicate with GWT-RPC, look at this blog article.

A rails web app, quickbooks, and mysql

I've gotta use the inventory from quickbooks in my rails web app...it would be nice if I could get quickbooks to use mysql, as that way I could just use mysql between the app and quickbooks, which would make things easy.
Does anyone know how to get quickbooks to use mysql? Or will I be forced to have my app communicate directly with quickbooks, which I wanna avoid :P
There are a few ways of integrating with QuickBooks, but if it's a web application, your best bet is to use the QuickBooks Web Connector, or to use a commercial package for SQL access.
The Web Connector is the only Intuit-supported solution to integrating with QuickBooks from a web application. Basically, you build a SOAP server / Web Service which speaks a specific set of methods. The Web Connector then is installed on the machine running QuickBooks, and polls your web service asking "Hey, got anything for me to do?" Your web service can then respond with qbXML requests (examples of qbXML here: QuickBooks qbXML Examples) which tell the Web Connector "Add this customer: ..." or "Send me invoices which match: ..." or etc. etc. etc. The Web Connector then relays those requests to QuickBooks, QuickBooks processes them, and the response is relayed back to your web service. Your web service might then process the response somehow, and then send the next request over to the Web Connector. This can continue in a loop for as long as you like, continuing to send requests to QuickBooks and receiving the responses.
You might also look into AccessBooks and QODBC. Both are commercial wrappers around the QuickBooks qbXML SDK which allow direct SQL access to QuickBooks.
Here is some additional information on my QuickBooks Integration Wiki about how to integrate applications with QuickBooks.
You might also want to search around on Google. I know there were some QuickBooks Rails packages/gems out there somewhere, but last I looked it did not support the QuickBooks Web Connector. Instead, the Rails application had to be installed on the same machine as QuickBooks, and it communicated via COM.
Pretty sure you will have to interface with Quickbooks directly. The other problem is going to be that because Quickbooks is a client-side application you will need to have an app on the client that pushes the data to the server. It's definitely doable.
Alternatively, you could just use the export functions of Quickbooks to periodically export the inventory as CSV.
http://behindlogic.com provides a Rubygem (for sale) that will deal with all of the pains of QBXML for you, and an HTTP Connector for QuickBooks that allows you to send/receive messages with QuickBooks through HTTP, which opens the door for connecting from another computer. The gem has an adapter built to use the Connector as well, so you can very quickly get up and running with QuickBooks on Windows and your Rails app on Linux or on your development Mac.
EDIT: Unfortunately, the maintainer of Behind Logic and the gem mentioned above has passed away. I hate bringing this up, however it took me a while to figure out why the GitHub repo was inactive and the site had gone down.
We have been using the Web connector for a while now, and let me tell you its been pretty smooth so far. Though the Intuit Quickbooks SDK doesn't let you do wt exactly QB UI would let you. Problems occur especially when you want to enter group items to QB using the SDK. Use a webservice and let it build requests and process responses and push the required data to your database which can simply be anything from a SQL server to MySql/Oracle etc etc. Using this approach good amount of error handling can also be done.