虽然主要是做TT的维保,但是由于TT使用的人相对少,很少相关的资料,就两java如何连接TT都很难找到,这里从官方文档中摘抄一段,做下记录备查。
##Write the below program in a file MyConnectionTest.java using vi or your favorite text editor.
#MyConnectionTest.java
import java.sql.*;
class MyConnectionTest {
/* This is DSN that we specify in odbc.ini file */
static String dsnname = "myjdbctest";
/* URL to connect to the datastore, that contains the standard prefix and dsnname */
static String url = "jdbc:timesten:direct:" + dsnname;
public static void main (String args[])
{
/* Try to load the driver first */
try {
Class.forName("com.timesten.jdbc.TimesTenDriver");
} catch (ClassNotFoundException ex) {
System.out.println ("Failed to load the driver");
ex.printStackTrace();
}
/* Try to get the connecction to TimesTen datastore and close it*/
try {
Connection con = DriverManager.getConnection(url);
System.out.println ("Connection Success");
con.close();
} catch (SQLException ex) {
System.out.println ("Failed to connect/disconnect to TimesTen datastore");
ex.printStackTrace();
}
}
编译:
javac MyConnectionTest.java
执行:
java MyConnectionTest
----------------------------End-------------------------------------------------
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24930246/viewspace-1064596/,如需转载,请注明出处,否则将追究法律责任。