|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.
With IoT exploding, massive data will transform businesses with opportunities to monetize almost anything that can be measured. In this C-Level Roundtable Discussion at @ThingsExpo, Brendan O’Brien, Aria Systems Co-founder and Chief Evangelist, will lead an expert panel of consultants, thought leaders and practitioners who will look at these new monetization trends, discuss the implications, and detail lessons learned from their collective experience. Finally, the panel will point the way forward for enterprises who wish to leverage the resulting complex recurring revenue models, adding valu...
Apr. 19, 2015 05:00 PM EDT Reads: 1,433
Health care systems across the globe are under enormous strain, as facilities reach capacity and costs continue to rise. M2M and the Internet of Things have the potential to transform the industry through connected health solutions that can make care more efficient while reducing costs. In fact, Vodafone's annual M2M Barometer Report forecasts M2M applications rising to 57 percent in health care and life sciences by 2016. Lively is one of Vodafone's health care partners, whose solutions enable older adults to live independent lives while staying connected to loved ones. M2M will continue to gr...
Apr. 19, 2015 05:00 PM EDT Reads: 578
How is unified communications transforming the way businesses operate? In his session at WebRTC Summit, Arvind Rangarajan, Director of Product Marketing at BroadSoft, will discuss how to extend unified communications experience outside the enterprise through WebRTC. He will also review use cases across different industry verticals. Arvind Rangarajan is Director, Product Marketing at BroadSoft. He has over 19 years of experience in the telecommunications industry in various roles such as Software Development, Product Management and Product Marketing, applied across Wireless, Unified Communic...
Apr. 19, 2015 04:00 PM EDT Reads: 1,600
Dave will share his insights on how Internet of Things for Enterprises are transforming and making more productive and efficient operations and maintenance (O&M) procedures in the cleantech industry and beyond. Speaker Bio: Dave Landa is chief operating officer of Cybozu Corp (kintone US). Based in the San Francisco Bay Area, Dave has been on the forefront of the Cloud revolution driving strategic business development on the executive teams of multiple leading Software as a Services (SaaS) application providers dating back to 2004. Cybozu's kintone.com is a leading global BYOA (Build Your O...
Apr. 19, 2015 03:30 PM EDT Reads: 634
SYS-CON Events announced today that Vicom Computer Services, Inc., a provider of technology and service solutions, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. They are located at booth #427. Vicom Computer Services, Inc. is a progressive leader in the technology industry for over 30 years. Headquartered in the NY Metropolitan area. Vicom provides products and services based on today’s requirements around Unified Networks, Cloud Computing strategies, Virtualization around Software defined Data Ce...
Apr. 19, 2015 02:00 PM EDT Reads: 1,427
What exactly is a cognitive application? In her session at 16th Cloud Expo, Ashley Hathaway, Product Manager at IBM Watson, will look at the services being offered by the IBM Watson Developer Cloud and what that means for developers and Big Data. She'll explore how IBM Watson and its partnerships will continue to grow and help define what it means to be a cognitive service, as well as take a look at the offerings on Bluemix. She will also check out how Watson and the Alchemy API team up to offer disruptive APIs to developers.
Apr. 19, 2015 12:00 PM EDT Reads: 1,492
The IoT Bootcamp is coming to Cloud Expo | @ThingsExpo on June 9-10 at the Javits Center in New York. Instructor. Registration is now available at http://iotbootcamp.sys-con.com/ Instructor Janakiram MSV previously taught the famously successful Multi-Cloud Bootcamp at Cloud Expo | @ThingsExpo in November in Santa Clara. Now he is expanding the focus to Janakiram is the founder and CTO of Get Cloud Ready Consulting, a niche Cloud Migration and Cloud Operations firm that recently got acquired by Aditi Technologies. He is a Microsoft Regional Director for Hyderabad, India, and one of the f...
Apr. 19, 2015 12:00 PM EDT Reads: 1,109
The 17th International Cloud Expo has announced that its Call for Papers is open. 17th International Cloud Expo, to be held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, APM, APIs, Microservices, Security, Big Data, Internet of Things, DevOps and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal today!
Apr. 19, 2015 12:00 PM EDT Reads: 2,087
SYS-CON Events announced today that SoftLayer, an IBM company, has been named “Gold Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place June 9-11, 2015 at the Javits Center in New York City, NY, and the 17th International Cloud Expo®, which will take place November 3–5, 2015 at the Santa Clara Convention Center in Santa Clara, CA. 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 ...
Apr. 19, 2015 08:45 AM EDT Reads: 2,416
SYS-CON Events announced today that Cisco, the worldwide leader in IT that transforms how people connect, communicate and collaborate, has been named “Gold Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. Cisco makes amazing things happen by connecting the unconnected. Cisco has shaped the future of the Internet by becoming the worldwide leader in transforming how people connect, communicate and collaborate. Cisco and our partners are building the platform for the Internet of Everything by connecting the...
Apr. 19, 2015 08:30 AM EDT Reads: 5,633
SYS-CON Events announced today that Liaison Technologies, a leading provider of data management and integration cloud services and solutions, has been named "Silver Sponsor" of SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York, NY. Liaison Technologies is a recognized market leader in providing cloud-enabled data integration and data management solutions to break down complex information barriers, enabling enterprises to make smarter decisions, faster.
Apr. 19, 2015 08:15 AM EDT Reads: 3,715
SYS-CON Events announced today that Windstream, a leading provider of advanced network and cloud communications, has been named “Silver Sponsor” of SYS-CON's 16th International Cloud Expo®, which will take place on June 9–11, 2015, at the Javits Center in New York, NY. Windstream (Nasdaq: WIN), a FORTUNE 500 and S&P 500 company, is a leading provider of advanced network communications, including cloud computing and managed services, to businesses nationwide. The company also offers broadband, phone and digital TV services to consumers primarily in rural areas.
Apr. 19, 2015 08:00 AM EDT Reads: 4,894
SYS-CON Events announced today that Ciqada will exhibit at SYS-CON's @ThingsExpo, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. Ciqada™ makes it easy to connect your products to the Internet. By integrating key components - hardware, servers, dashboards, and mobile apps - into an easy-to-use, configurable system, your products can quickly and securely join the internet of things. With remote monitoring, control, and alert messaging capability, you will meet your customers' needs of tomorrow - today! Ciqada. Let your products take flight. For more inform...
Apr. 19, 2015 08:00 AM EDT Reads: 1,637
SYS-CON Events announced today that ProfitBricks, the provider of painless cloud infrastructure, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY., and the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. ProfitBricks is the IaaS provider that offers a painless cloud experience for all IT users, with no learning curve. ProfitBricks boasts flexible cloud servers and networking, an integrated Data Center Designer tool f...
Apr. 19, 2015 07:30 AM EDT Reads: 1,508
SYS-CON Events announced today that GENBAND, a leading developer of real time communications software solutions, has been named “Silver Sponsor” of SYS-CON's WebRTC Summit, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. The GENBAND team will be on hand to demonstrate their newest product, Kandy. Kandy is a communications Platform-as-a-Service (PaaS) that enables companies to seamlessly integrate more human communications into their Web and mobile applications - creating more engaging experiences for their customers and boosting collaboration and productiv...
Apr. 19, 2015 07:00 AM EDT Reads: 2,304
SYS-CON Events announced today that Dyn, the worldwide leader in Internet Performance, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. Dyn is a cloud-based Internet Performance company. Dyn helps companies monitor, control, and optimize online infrastructure for an exceptional end-user experience. Through a world-class network and unrivaled, objective intelligence into Internet conditions, Dyn ensures traffic gets delivered faster, safer, and more reliably than ever.
Apr. 19, 2015 07:00 AM EDT Reads: 2,335
SYS-CON Events announced today that Open Data Centers (ODC), a carrier-neutral colocation provider, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place June 9-11, 2015, at the Javits Center in New York City, NY. Open Data Centers is a carrier-neutral data center operator in New Jersey and New York City offering alternative connectivity options for carriers, service providers and enterprise customers.
Apr. 19, 2015 06:45 AM EDT Reads: 2,551
SYS-CON Events announced today that BroadSoft, the leading global provider of Unified Communications and Collaboration (UCC) services to operators worldwide, has been named “Gold Sponsor” of SYS-CON's WebRTC Summit, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. BroadSoft is the leading provider of software and services that enable mobile, fixed-line and cable service providers to offer Unified Communications over their Internet Protocol networks. The Company’s core communications platform enables the delivery of a range of enterprise and consumer calling...
Apr. 19, 2015 06:30 AM EDT Reads: 2,211
SYS-CON Events announced today that On the Avenue Marketing Group, a sales and marketing firm that utilizes events to market and sell products to consumers, will exhibit at SYS-CON's 16th International Cloud Expo®, which will take place on June 9-11, 2015, at the Javits Center in New York City, NY. On the Avenue Marketing Group (OTA) is a sales and marketing firm that utilizes events to market and sell products to consumers. On behalf of our clients, we attend thousands of fairs, festivals, expos, concerts, conferences, and sporting events annually, helping them reach millions of individuals ...
Apr. 19, 2015 06:30 AM EDT Reads: 3,184
SYS-CON Events announced today that ActiveState, the leading independent Cloud Foundry and Docker-based PaaS provider, has been named “Silver Sponsor” of SYS-CON's DevOps Summit New York, which will take place June 9-11, 2015, at the Javits Center in New York City, NY. ActiveState believes that enterprises gain a competitive advantage when they are able to quickly create, deploy and efficiently manage software solutions that immediately create business value, but they face many challenges that prevent them from doing so. The Company is uniquely positioned to help address these challenges thro...
Apr. 19, 2015 06:15 AM EDT Reads: 2,799