   Web Applications?
  Hi, I was wondering on how to get started building web applications. I'm in my third and final CS core language (Java) class and the professor told us about the Juicy Ideas contest.Some classmates and I are interested in building a web app. We just briefly talked about it today.I know how to write applets and such, the thing I'm wondering is how to access public databases, extract that information and have it displayed in the application.I guess I'm not sure what exactly is meant by database. My only understanding of it is a file that contains binary or text information, most of the time binary. So I guess my questions are:1. What is a database in the context of using it for the development of a web application?2. How do you access a public database? I've heard of things like MySQL and know they have something to do with databases but I'm not 100% clear of what it is.3. What kind of format is the information inside a database stored? Binary? Text?4. How is the information extracted? From my knowledge I can only guess through lines of code like: obj = inputFile.readObject();   
  1) Often a SQL-based RDBMS, such as Oracle, MySQL or SQL Server. There other types; databases are effectively collections of data and can exist in simple formats, such as text, csv, xml, etc. The SQL-based database systems are most likely in a web context - at least as a backend data storage system.2) Public databases are likely to be accessed via some web service api (maybe using JSON or XML). You're unlikely to be able to connect directly and query using SQL directly.3) SQL databases are often composed of tables, which are defined by columns - columns define the structure of the table and how the data is stored. For example, you may have int, bit, varchar, char, xml - all depends on the database you're using. If you're using a public database via a web service, you'll probably get back XML which is defined by an XML schema, or there will be a reference document for you to follow that tells you how to structure/parse the data.4) Depends; if you're accessing a SQL database then you'll open a connection using your favourite language and pass SQL to the database engine to return a recordset. If you're using a webservice - you need to read up on how you'd pass data back and forth. Some use SOAP over HTTP, others systems such as Twitter have their own API and let you fire off custom XML/JSON messages over HTTP to return data in that form back. It's pretty much dependent on the database/system you're accessing.Have you identified a public service that you're trying to access? My guess is that it's a database system behind some kind of web service. It's likely that you'll be accessing the service directly and won't have anything to do with the underlying database itself. If this is true, you're likely to be dealing with XML or JSON and HTTP. In this way, you'll be firing off a request, waiting for a response, then parsing the response in a way that's suitable for your application.;  Thanks for the reply. Some questions...What is a web service? I seem to be equating web service with website. Are they the same or different? Does web service just mean the sites API to access the database? For example, if this person (see link) stored bathroom location information inside a database and was publicly available, how would I access it? http://www.thebathroomdiaries.com/usa/washington/seattle.htmlOne thing that's unclear: I see that databases might use a variety of formats such as XML, JSON, SOAP to access information in the database. However, in the building of the application you would use a full programming language (turing complete), right? I'm guessing that the program itself would process the information from the database? For example somehow grabbing the age of an offender and storing that number into the primitive type of the language you're using?   ;  What is a web service? -- Any service provided on the web. Your program is going to depend on other programs and systems that provide service. Let's say for example, you are working through census data of some sort. Then there might exist a system that provides this information. All it means with a web service is that this service is on another machine. Your machine and that service machine or on a network (like the internet), and you want your machine to use the service provided by that other machine. So a web service has to specify information like how to make requests of that service (and what requests you can make) and how it will respond in what format. And so on. Have you tried reading the wikipedia page, the first Google result for "web service"? If you have tried, then you should point specifically to what confuses you in the description.I seem to be equating web service with website. Are they the same or different? -- From the above explanation, what do you think?Does web service just mean the sites API to access the database? -- It means some API to do something. What it gets you is defined by the service.For example, if this person (see link) stored bathroom location information inside a database and was publicly available, how would I access it? -- Depends on how the API is defined. You have to find out from each and every service you want to use.I see that databases might use a variety of formats such as XML, JSON, SOAP to access information in the database. -- No. XML and JSON are data interchange formats. SOAP is a protocol that some web services use. Databases store data however way they like.However, in the building of the application you would use a full programming language (turing complete), right == As opposed to what?I'm guessing that the program itself would process the information from the database? -- It would have to do something with that information. That's the point of your program. You want to manipulate data in a certain manner, and you build a program to do just that.For example somehow grabbing the age of an offender and storing that number into the primitive type of the language you're using? -- You'll do a number of manipulations. Depending on what the data is, the libraries and APIs you use in your language, etc., and what end form you want data to be in, you'll have to do some different set of transformations. It's up in the air until you start facing concrete issues, like what the actual APIs are.   ;Quote:Original post by ICUPWhat is a web service? I seem to be equating web service with website.There no strictly defined difference between them. For instance, you could consider http://www.gamedev.net/community/forums/profile.asp to be a web service: You provide it with a few parameters (viewmode and user id) and it will return a user's profile. This data (HTML source) is a bit messy though, it was never intended to be read by another application (other than a browser). What is referred to as a web services usually returns something more manageable, like plain text or XML.Quote:One thing that's unclear: I see that databases might use a variety of formats such as XML, JSON, SOAP to access information in the database. However, in the building of the application you would use a full programming language (turing complete), right? I'm guessing that the program itself would process the information from the database? For example somehow grabbing the age of an offender and storing that number into the primitive type of the language you're using?Yes. In pseudo code:/* load xml from a third party web service (HTTP GET to keep things simple) */XmlDocument xmlDocumentxmlDocument.Load("http://some.webservice/getoffender?name=john&city=chicago")/* now we have some XML loaded into our document (assume it only returned one result):<xml>  <offender>    <name>John</name>    <city>John</city>    <age>30</age>    <email>john@yahoo.com</email>  </offender></xml>*//* We can now use whatever methods XmlDocument provides to extract the information, let say: */var age = xmlDocument.getRootElement().getFirstChild("offender").getFirstChild("age")In reality, things are a little more involved (handling errors, authentication, different protocols), but that's basically it.   