1

I am trying to query a NonStop SQL/MX database using JDBC. I have the correct driver and I manage to connect to the database and to initialize a statement with the following lines of code (which i found here):

Class.forName("com.tandem.t4jdbc.SQLMXDriver");
Connection con = DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();

However, I fail to execute the query...

ResultSet rs = stmt.executeQuery("SELECT * FROM Table1");

... because of some inexistent catalog NONSTOP_SYSTEM_NSK. What does that mean? I never have to specify any catalog when viewing the same database in a GUI (e.g., DB Visualizer).

The resulting stack trace looks something like this:

java.sql.SQLException: *** ERROR[1002] Catalog NONSTOP_SYSTEM_NSK does
    not exist or has not been registered on node \NSK01.
    at com.tandem.t4jdbc.SQLMXMessages.throwSQLException(SQLMXMessages.java:71)
    at com.tandem.t4jdbc.InterfaceStatement.executeDirect(InterfaceStatement.java:545)
    at com.tandem.t4jdbc.SQLMXStatement.executeQuery(SQLMXStatement.java:226)
dokaspar
  • 8,186
  • 14
  • 70
  • 98
  • Can you please help me by providing the URL used for connecting to nonstop sql database, I am supposed to do some data migration from this database to MSSQL – Tushar Mahajan Jun 26 '20 at 09:11

2 Answers2

0

If you already have a working Connection con, you can set the catalog using con.setCatalog(). In general, you access a database table in a given catalog and schema as follows:

ResultSet rs = stmt.executeQuery("SELECT * FROM <CATALOG>.<SCHEMA>.<TABLE>");
dokaspar
  • 8,186
  • 14
  • 70
  • 98
0

How do you define the url for the connection, we are trying to connecto to a remote non stop db from an external java application and we are having trouble in how define the connection server ip.