|By Paul Ananth||
|May 1, 1997 12:00 AM EDT||
In this article, we take a look at using JDBC to build applications. Internet technology is changing so rapidly that some of the methods used today will become obsolete tomorrow. We are taking an approach that combines Java network programming and JDBC programming. Programming in JDBC is taking a step backward when you have mature 4GL tools like Sybase Powerbuilder. Programming in JDBC is similar to programming in any low level database library like ODBC or Sybase CT-LIB.
There is more than one way to deploy applications and applets using JDBC. The first approach is by using the JDBC-ODBC bridge that is part of JDK 1.1. You have to install ODBC Drivers and set the ODBC datasource in each client. If you are willing to do this existing client server tools will do a better job than Java. The second approach is to use a JDBC driver that is 100 Percent Java compliant. For writing Java applications, this method will work fine, but not for Java applets. Applets can not make arbitrary connection to other servers. You have to run your database server in the same machine where the Web server is running. This article will help you write Java applets or applications using JDBC without any of the above mentioned restrictions.
What are the Advantages?
This implementation follows a 3-tier client-server model. JDBC Client sends a request to JDBC server which processes the request, communicates to the database server and sends back the reply. Compatible with all Java enabled browsers. It's secure because the database server is not exposed. You can configure number of concurrent users allowed at any point of time. With little modification you can dynamically increase and decrease number of JDBC server listening for request or totally redirect the request to a different web server. You can also attach your own encryption and decryption routine before communicating with a remote client. JDBC server runs on the server side so you have total freedom to use any JDK, any ODBC driver and Java native methods. You can batch your request or can have real-time connection like any other client-server application.
There are some limitations in this implementation. If you want to have multiple connection you have to initialize multiple driver's in the client side. It will not handle blob or image data type even though it's very easy to implement one, by saving the image in the server and sending the filename back as URL. You can use the same method to transfer the whole ResultSet.
There are three different functional pieces. Port allocator (PA) is a Java based server that listens on a predefined port. JDBC server listens for connection from client. JDBC client which makes the request. When client makes a request to Port Allocator it will send back a JDBC server port that is currently free. From that point onwards, JDBC client talks only to the JDBC server. Client sends a single byte command to server and waits for reply. The server sends back a status code and byte or string value. Commands can have arguments usually a byte or a string. While processing clients request, if server encounters an exception it converts the exception to a string and sends back an error code and the string to the client.
Let us look into the details. There are four client side classes RDriver, RConnection, Rstatement, RResultSet for connecting and fetching data. These are very similar to JDBC interfaces Driver, Connection, Statement, ResultSet. It does not implement these interfaces. JDBC client initializes the RDriver then creates a TCP socket to port allocator (PA) and gets a port to communicate to a JDBC server. It also sends command to initialize DriverManager in the server if everything is successful. This enables the client to connect directly to the JDBC server using RDriver.connect(username, password) and create a database connection. You only need username and password to create a database connection hiding all server details in the JDBC server code. You can call createStatement() method to create a RStatement() after successfully establishing a database connection. Send the SQL string to server using executeQuery function. It will create a ResultSet in the server and RResultSet in the client. Use executeUpdate() function for update and insert SQL statements. Access the ResultSet values using next() and getString() or getInt().
One of the advantages of this architecture is that all conversation between client and server happens as bytes and strings. If the client dies for some reason Driver.detach() will cleanup the connection, but if an exception occurs you have to take care of it. Rdriver has an overloaded finalize method which calls Driver.detach().
The example here shows how to connect to a Sybase SQL server using beta version of Jconnect. Before running the examples you may need to change hostname, port and any other parameters it may need in your environment.
Table 1 shows the commands, arguments and return code.
JDBC Protocol Implementation
JDBC Protocol is a layer above the Java socket layer. It hides the Java socket layer, but you have to still catch exceptions from this layer. Protocol structure follows the same structure as any other standard protocols (FTP, TELNET). JDBC protocol does session control by sending acknowledgment or negative acknowledgment after each request from client. Java takes care of presentation of data. This protocol fits in the top layers of OSI model. Like most other protocols this protocol has series of commands and expected return values. Most importantly these commands are not part of any standards. One other difference is it has only one path to the server, unlike FTP which uses a command port (21) and a data port (20).
All commands are single byte followed by a byte or string. In special cases it is more than one string. For each command sent from client JDBC server replies with a return status of SUCCESS or FAIL. If the return status from the server is SUCCESS it returns either string, byte or no value depending on type of command. If an error occurs in the server the return status is FAIL server then sends a SQLExeption string to the client.
Table 2 explains the protocol implementation.
WebRTC is bringing significant change to the communications landscape that will bridge the worlds of web and telephony, making the Internet the new standard for communications. Cloud9 took the road less traveled and used WebRTC to create a downloadable enterprise-grade communications platform that is changing the communication dynamic in the financial sector. In his session at @ThingsExpo, Leo Papadopoulos, CTO of Cloud9, will discuss the importance of WebRTC and how it enables companies to fo...
May. 30, 2016 04:30 PM EDT Reads: 2,633
The IoT is changing the way enterprises conduct business. In his session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, discuss how businesses can gain an edge over competitors by empowering consumers to take control through IoT. We'll cite examples such as a Washington, D.C.-based sports club that leveraged IoT and the cloud to develop a comprehensive booking system. He'll also highlight how IoT can revitalize and restore outdated business models, making them profitable...
May. 30, 2016 02:00 PM EDT Reads: 3,071
SYS-CON Events announced today that MangoApps will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. MangoApps provides modern company intranets and team collaboration software, allowing workers to stay connected and productive from anywhere in the world and from any device. For more information, please visit https://www.mangoapps.com/.
May. 30, 2016 01:30 PM EDT Reads: 1,137
SYS-CON Events announced today the How to Create Angular 2 Clients for the Cloud Workshop, being held June 7, 2016, in conjunction with 18th Cloud Expo | @ThingsExpo, at the Javits Center in New York, NY. Angular 2 is a complete re-write of the popular framework AngularJS. Programming in Angular 2 is greatly simplified. Now it’s a component-based well-performing framework. The immersive one-day workshop led by Yakov Fain, a Java Champion and a co-founder of the IT consultancy Farata Systems and...
May. 30, 2016 12:00 PM EDT Reads: 4,120
What a difference a year makes. Organizations aren’t just talking about IoT possibilities, it is now baked into their core business strategy. With IoT, billions of devices generating data from different companies on different networks around the globe need to interact. From efficiency to better customer insights to completely new business models, IoT will turn traditional business models upside down. In the new customer-centric age, the key to success is delivering critical services and apps wit...
May. 30, 2016 11:15 AM EDT Reads: 1,352
Join us at Cloud Expo | @ThingsExpo 2016 – June 7-9 at the Javits Center in New York City and November 1-3 at the Santa Clara Convention Center in Santa Clara, CA – and deliver your unique message in a way that is striking and unforgettable by taking advantage of SYS-CON's unmatched high-impact, result-driven event / media packages.
May. 30, 2016 11:00 AM EDT Reads: 2,584
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, will provide an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life ...
May. 30, 2016 10:45 AM EDT Reads: 2,074
SYS-CON Events announced today that BMC Software has been named "Siver Sponsor" of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2015 at the Javits Center in New York, New York. BMC is a global leader in innovative software solutions that help businesses transform into digital enterprises for the ultimate competitive advantage. BMC Digital Enterprise Management is a set of innovative IT solutions designed to make digital business fast, seamless, and optimized from mainframe to mo...
May. 30, 2016 09:15 AM EDT Reads: 2,395
SYS-CON Events announced today that MobiDev will exhibit at SYS-CON's 18th International Cloud Expo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, NY. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex software systems for startups and enterprises. Since 2009 it has grown from a small group of passionate engineers and business managers to a full-scale mobile software company with over 200 develope...
May. 30, 2016 09:15 AM EDT Reads: 2,856
As cloud and storage projections continue to rise, the number of organizations moving to the cloud is escalating and it is clear cloud storage is here to stay. However, is it secure? Data is the lifeblood for government entities, countries, cloud service providers and enterprises alike and losing or exposing that data can have disastrous results. There are new concepts for data storage on the horizon that will deliver secure solutions for storing and moving sensitive data around the world. ...
May. 30, 2016 09:00 AM EDT Reads: 1,460
SoftLayer operates a global cloud infrastructure platform built for Internet scale. With a global footprint of data centers and network points of presence, SoftLayer provides infrastructure as a service to leading-edge customers ranging from Web startups to global enterprises. SoftLayer's modular architecture, full-featured API, and sophisticated automation provide unparalleled performance and control. Its flexible unified platform seamlessly spans physical and virtual devices linked via a world...
May. 30, 2016 08:00 AM EDT Reads: 2,407
SYS-CON Events announced today that ContentMX, the marketing technology and services company with a singular mission to increase engagement and drive more conversations for enterprise, channel and SMB technology marketers, has been named “Sponsor & Exhibitor Lounge Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York City, New York. “CloudExpo is a great opportunity to start a conversation with new prospects, but what happens after the...
May. 30, 2016 07:15 AM EDT Reads: 1,430
Companies can harness IoT and predictive analytics to sustain business continuity; predict and manage site performance during emergencies; minimize expensive reactive maintenance; and forecast equipment and maintenance budgets and expenditures. Providing cost-effective, uninterrupted service is challenging, particularly for organizations with geographically dispersed operations.
May. 30, 2016 07:00 AM EDT Reads: 2,287
The IoTs will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, will demonstrate how to move beyond today's coding paradigm and share the must-have mindsets for removing complexity from the development proc...
May. 30, 2016 06:00 AM EDT Reads: 2,020
SYS-CON Events announced today TechTarget has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. TechTarget is the Web’s leading destination for serious technology buyers researching and making enterprise technology decisions. Its extensive global networ...
May. 30, 2016 05:30 AM EDT Reads: 3,319
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management...
May. 30, 2016 04:45 AM EDT Reads: 3,346
The essence of data analysis involves setting up data pipelines that consist of several operations that are chained together – starting from data collection, data quality checks, data integration, data analysis and data visualization (including the setting up of interaction paths in that visualization). In our opinion, the challenges stem from the technology diversity at each stage of the data pipeline as well as the lack of process around the analysis.
May. 30, 2016 03:15 AM EDT Reads: 1,552
Designing IoT applications is complex, but deploying them in a scalable fashion is even more complex. A scalable, API first IaaS cloud is a good start, but in order to understand the various components specific to deploying IoT applications, one needs to understand the architecture of these applications and figure out how to scale these components independently. In his session at @ThingsExpo, Nara Rajagopalan is CEO of Accelerite, will discuss the fundamental architecture of IoT applications, ...
May. 30, 2016 03:00 AM EDT Reads: 1,407
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
May. 30, 2016 03:00 AM EDT Reads: 2,102
SYS-CON Events announced today that Tintri Inc., a leading producer of VM-aware storage (VAS) for virtualization and cloud environments, will exhibit at the 18th International CloudExpo®, which will take place on June 7-9, 2016, at the Javits Center in New York City, New York, and the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
May. 30, 2016 02:45 AM EDT Reads: 2,553