CSE 315: DB TPS Hints

[Announcements] [Experiments] [Hints] [Home]


Important: When you are doing experiments, DO REMEMBER TO CLOSE THE CONNECTION EXPLICITLY. Or it will remain active. If there are too many connections the server will crash.

 

For JDBC: remember to close your connection using sth like: myconnection.close(); it should appear in your code paired with DriverManager.getConnection like ‘(‘ and ‘)’.

 

For JISQL: If you just close the window, your connection will remain active. Please disconnect before closing the window. Click on Connection/Close Connection.

----Read the textbook and the appropriate Sybase manuals carefully.  You can find Sybase documents here. Among them, Java in Adaptive Server Enterprise describes how to write Java programs that interact with Sybase.  Transact-SQL User's Guide describes the implemenation of SQL in Sybase, read Chapter 14 and 18, especially Chapter 18 that describes the implementation of transactions and their restrictions in Sybase.

----Here is some good JDBC Reference Sites:

Learning JDBC[tm] Programming

JDBC Short Course

Getting Started With JDBC

JDBC(TM) Database Access

Duke's Bakery - A JDBC TM Order Entry Prototype - Part I

---- (modified!) Visit the website of the Transaction Lab to get information about JDBC usage in the lab.  The following are the connection parameters that you should use:
            static String mysJDBCDriver = "com.sybase.jdbc2.jdbc.SybDriver";
            static String mysURL = "jdbc:sybase:Tds:rdb.translab.cs.sunysb.edu:5000";
            static String proxy=  "http://www.translab.cs.sunysb.edu/proxy/servlet/TDSTunnelServlet";
            static String mysUserID = "your Id";
            static String mysPassword = "your password";

---- (new!) Remember to do as instructed in http://www.translab.cs.sunysb.edu/jdbc.html:

Copy the com folder under c:\program files\sybase\jConnect-4_5\classes ( you can find in machines in translab), and include the directory which the com folder resides in into your CLASSPATH variable.

  Or, to make things easier, add driver jconn2.jar to CLASSPATH.

---- (new!) You will need for your experiment2! To run Transaction Processing Performance Tool (TPPT), you can download Tppt.jar, to execute, double click it.

---- (new!) A manual describing the Transaction Processing Performance Tool (TPPT) can be found here: TPPT Tutorial. ----For later experiments.

Experiment1:

1.      Remember to set single salary back to $500 after you finished executing one of the java program and set total salary near $100000. Or the next time you want to do the task, nothing will be done since total salary is already near $100000.

2.      For Chaining, pay attention that stored procedure created in unchained mode will be invalid in chained mode. In order to use stored procedure in chained mode, you need to first drop the stored procedure created in unchained mode, and create it again in chained mode. If you do so, remember to drop it again and create it again in unchained mode to make the DB back to the state in unchained mode.

1.      (new!) Q: I understand that there is not supposed to be any transaction control inside the stored procedure but can we use transaction keywords executed from the java program?

A: Yes, you can.

2.      (new!) Q: Why can’t I log in Sybase server?

A: Maybe you forget to register your DB first. Look at the translab webpage, and look for Database Register procedure.

3.      (new!) Q: For the Homework hand in, how do I give you the final result of each transaction model, put it on a word document, or print the result in the java code?

A: You’d better do both. Include the results in your report, and write some code to print the result in the java program. Thank you!

4.       

 



Last updated on Feb 07, 2007 by Alok Vadgaonkar