Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Using MySQL as a JDBC database on Linux The following command must be typed in each terminal you wish to access your database from. This next command configures how to access the MySQL JDBC driver setenv CLASSPATH .:/usr/local/share/app/MySQL/mm.mysql.jdbc-1.2c The next command provides a short-cut, just type the command mysqli, to look at any information in the database, such as tables etc, from the command-line. alias mysqli �mysql �h mysql �p� Setting up your environment via the .cshrc file N.B. make sure there is a return after each line including the last line and check for typing mistakes before saving) setenv CLASSPATH .:/usr/local/share/app/MySQL/mm.mysql.jdbc-1.2c alias mysqli �mysql �h mysql �p� Modify your JDBC application to access this data source Modify this sample to use your username and password. Compile and execute the database application If you say any compilation errors here such as driver errors, it probably means your classpath is wrong.
Run it 'java TestMySQLJDBC' to create the empty database table COFFFE2 in the database (called your username) with several columns but no actual rows. N.B. the MySQL database server is running on PC2, log on any other Linux box other than PC2 to run your database application. Use MySQL in interactive mode to view your database tables N.B. the �;� is very important in interactive mode to complete the command. If you forget it, you will see a �->�prompt. Type �;� on a line by itself to terminate the command for typing a new one. Here is a sample interactive session. Further information about the interactive session commands are found here .
Further work
Replies: |
Sponsored Links
|