|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.
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
Mar. 23, 2017 04:00 PM EDT Reads: 1,088
The taxi industry never saw Uber coming. Startups are a threat to incumbents like never before, and a major enabler for startups is that they are instantly “cloud ready.” If innovation moves at the pace of IT, then your company is in trouble. Why? Because your data center will not keep up with frenetic pace AWS, Microsoft and Google are rolling out new capabilities In his session at 20th Cloud Expo, Don Browning, VP of Cloud Architecture at Turner, will posit that disruption is inevitable for c...
Mar. 23, 2017 03:45 PM EDT Reads: 1,641
SYS-CON Events announced today that Loom Systems will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Founded in 2015, Loom Systems delivers an advanced AI solution to predict and prevent problems in the digital business. Loom stands alone in the industry as an AI analysis platform requiring no prior math knowledge from operators, leveraging the existing staff to succeed in the digital era. With offices in S...
Mar. 23, 2017 03:45 PM EDT Reads: 443
SYS-CON Events announced today that Ocean9will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Ocean9 provides cloud services for Backup, Disaster Recovery (DRaaS) and instant Innovation, and redefines enterprise infrastructure with its cloud native subscription offerings for mission critical SAP workloads.
Mar. 23, 2017 03:30 PM EDT Reads: 1,489
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 20th International Cloud Expo, which will take place on June 6–8, 2017, at the Javits Center in New York City, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
Mar. 23, 2017 03:30 PM EDT Reads: 1,588
SYS-CON Events announced today that Cloudistics, an on-premises cloud computing company, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Cloudistics delivers a complete public cloud experience with composable on-premises infrastructures to medium and large enterprises. Its software-defined technology natively converges network, storage, compute, virtualization, and management into a ...
Mar. 23, 2017 02:30 PM EDT Reads: 1,336
SYS-CON Events announced today that CA Technologies has been named “Platinum Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. CA Technologies helps customers succeed in a future where every business – from apparel to energy – is being rewritten by software. From ...
Mar. 23, 2017 02:15 PM EDT Reads: 1,071
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
Mar. 23, 2017 12:45 PM EDT Reads: 1,578
SYS-CON Events announced today that Addteq will exhibit at SYS-CON's DevOps Summit at Cloud Expo, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Addteq specializes in creating innovative solutions to solve business processes through the use of DevOps automation. Addteq was founded on the firm belief that automation is essential for successful software releases. Addteq's products and services are centered around the fundamental approach of understanding the pr...
Mar. 23, 2017 12:30 PM EDT Reads: 2,638
Keeping pace with advancements in software delivery processes and tooling is taxing even for the most proficient organizations. Point tools, platforms, open source and the increasing adoption of private and public cloud services requires strong engineering rigor - all in the face of developer demands to use the tools of choice. As Agile has settled in as a mainstream practice, now DevOps has emerged as the next wave to improve software delivery speed and output. To make DevOps work, organization...
Mar. 23, 2017 12:30 PM EDT Reads: 1,041
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Mar. 23, 2017 12:30 PM EDT Reads: 928
SYS-CON Events announced today that Infranics will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Since 2000, Infranics has developed SysMaster Suite, which is required for the stable and efficient management of ICT infrastructure. The ICT management solution developed and provided by Infranics continues to add intelligence to the ICT infrastructure through the IMC (Infra Management Cycle) based on mathemat...
Mar. 23, 2017 09:30 AM EDT Reads: 2,445
"I think that everyone recognizes that for IoT to really realize its full potential and value that it is about creating ecosystems and marketplaces and that no single vendor is able to support what is required," explained Esmeralda Swartz, VP, Marketing Enterprise and Cloud at Ericsson, in this SYS-CON.tv interview at @ThingsExpo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Mar. 23, 2017 08:00 AM EDT Reads: 3,697
The buzz continues for cloud, data analytics and the Internet of Things (IoT) and their collective impact across all industries. But a new conversation is emerging - how do companies use industry disruption and technology enablers to lead in markets undergoing change, uncertainty and ambiguity? Organizations of all sizes need to evolve and transform, often under massive pressure, as industry lines blur and merge and traditional business models are assaulted and turned upside down. In this new da...
Mar. 23, 2017 08:00 AM EDT Reads: 3,250
Web Real-Time Communication APIs have quickly revolutionized what browsers are capable of. In addition to video and audio streams, we can now bi-directionally send arbitrary data over WebRTC's PeerConnection Data Channels. With the advent of Progressive Web Apps and new hardware APIs such as WebBluetooh and WebUSB, we can finally enable users to stitch together the Internet of Things directly from their browsers while communicating privately and securely in a decentralized way.
Mar. 23, 2017 03:00 AM EDT Reads: 5,414
SYS-CON Events announced today that HTBase will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. HTBase (Gartner 2016 Cool Vendor) delivers a Composable IT infrastructure solution architected for agility and increased efficiency. It turns compute, storage, and fabric into fluid pools of resources that are easily composed and re-composed to meet each application’s needs. With HTBase, companies can quickly prov...
Mar. 23, 2017 02:15 AM EDT Reads: 2,377
SYS-CON Events announced today that Outlyer, a monitoring service for DevOps and operations teams, has been named “Bronze Sponsor” of SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Outlyer is a monitoring service for DevOps and Operations teams running Cloud, SaaS, Microservices and IoT deployments. Designed for today's dynamic environments that need beyond cloud-scale monitoring, we make monitoring effortless so you ...
Mar. 23, 2017 02:00 AM EDT Reads: 3,759
SYS-CON Events announced today that MobiDev, a client-oriented software development company, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place June 6-8, 2017, at the Javits Center in New York City, NY, and the 21st International Cloud Expo®, which will take place October 31-November 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MobiDev is a software company that develops and delivers turn-key mobile apps, websites, web services, and complex softw...
Mar. 23, 2017 01:15 AM EDT Reads: 3,388
In his General Session at 17th Cloud Expo, Bruce Swann, Senior Product Marketing Manager for Adobe Campaign, explored the key ingredients of cross-channel marketing in a digital world. Learn how the Adobe Marketing Cloud can help marketers embrace opportunities for personalized, relevant and real-time customer engagement across offline (direct mail, point of sale, call center) and digital (email, website, SMS, mobile apps, social networks, connected objects).
Mar. 22, 2017 11:00 PM EDT Reads: 3,030
SYS-CON Events announced today that Hitrons Solutions will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Hitrons Solutions Inc. is distributor in the North American market for unique products and services of small and medium-size businesses, including cloud services and solutions, SEO marketing platforms, and mobile applications.
Mar. 22, 2017 10:15 PM EDT Reads: 3,329