Oracele Timesten connects to DSN to create a user, oraceletimesten

Source: Internet
Author: User

Oracele Timesten connects to DSN to create a user, oraceletimesten

1. Enable startup

[Tt @ host2 info] $ ttDaemonAdmin-start-force

/Home/tt/TimesTen/tt1122/info/timestend. pid file exists, attempt start due to-force option.

TimesTen Daemon startup OK.

2. Add the test DSN: test_1122

Vi Info/sys. odbc. ini

Test_1122 = TimesTen 11.2.2 Driver

[Test_1122]

Driver =/home/tt/TimesTen/tt1122/lib/libtten. so

DataStore =/home/tt/TimesTen/tt1122/info/DemoDataStore/test_1122

PermSize = 40

TempSize = 32

PLSQL = 1

DatabaseCharacterSet = US7ASCII

3. Connect to test_1122

[Tt @ host2 info] $ ttIsql test_1122

 

Copyright (c) 1996,201 4, Oracle and/or its affiliates. All rights reserved.

Type? Or "help" for help, type "exit" to quit ttIsql.

4. Create a user

Command> create user scott identified by tiger;

 

User created.

 

Command> grant create table to scott;

Command> grant connect to scott;

Command> grant create view to scott;

Command> grant dba to scott;

15111: Invalid privilege: DBA. Roles are not supported.

The command failed.

5. Manage the permissions of the cache group

Command> grant create session, admin, cache_manager to scott;

15140: GRANT failed: User SCOTT already has system privilege CREATE SESSION

The command failed.

Command> grant admin, cache_manager to scott;

Connect "DSN = test_1122 ";

Connection successful: DSN = test_1122; UID = tt; DataStore =/home/tt/TimesTen/tt1122/info/DemoDataStore/test_1122; DatabaseCharacterSet = US7ASCII; ConnectionCharacterSet = US7ASCII; DRIVER =/home/tt/TimesTen/tt1122/lib/libtten. so; PermSize = 40; TempSize = 32; TypeMode = 0;

(Default setting AutoCommit = 1)


How can oracle SQL developer not connect to TimesTen?

Select the direct driver for the connection type, unless you have enabled the server function on the server.
At the same time, determine that the DSN configured in ODBC can be connected.

Java remote connection timesten

Then access through the following program code

Import java. SQL .*;
Import javax. SQL .*;
Public class Tttest {
Public static void main (String args [])
{
// Url required for remote connection. The program and TT are not on the same server. You need to define the DSN in advance according to the method described in the previous section.
String URL = "jdbc: timesten: client: dsn = wzyCS_tt70 ";
// The url required for local connection. The program and TT are on the same server.
// String URL = "jdbc: timesten: direct: dsn = wzy_tt70 ";

Connection con = null;
Try {
// Load the TT driver
Class. forName ("com. timesten. jdbc. TimesTenDriver ");
} Catch (ClassNotFoundException ex) {ex. printStackTrace ();
}
Try
{
// Obtain the connection
Con = DriverManager. getConnection (URL );
System. out. println ("connected ");
// Create a jdbc Statement
Java. SQL. Statement st = con. createStatement ();
// Execute the SQL query operation
Java. SQL. ResultSet rs=st.exe cuteQuery ("select * from test ");
While (rs. next ())
{
// Retrieve the result set
System. out. println (rs. getString ("id "));
}

// Close the connection
Con. close ();
// Handle any errors
} Catch (SQLException ex ){
Ex. printStackTrace ();}
}
}

If TT works normally and the DSN definition is normal, we can see the output result of the java program.
In addition to the original url and driver, the others are standard jdbc syntaxes, which are very simple and powerful.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.