Advertisement
Guest User

Untitled

a guest
Feb 24th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. connection = DriverManager.getConnection("jdbc:informix-sqli://"+ip+
  2. /"+sid+":INFORMIXSERVER="+server+";user="+user+";password="+pass+"");
  3.  
  4. C->S (4)
  5. SQ_VERSION
  6. SQ_EOT
  7.  
  8. S->C (14)
  9. SQ_VERSION
  10. "7.31.TD6" [8]
  11. SQ_EOT
  12.  
  13. C->S (66)
  14. SQ_INFO
  15. INFO_ENV
  16. Name Length = 12
  17. Value Length = 8
  18. "DBTIME"="%d/%M/%Y"
  19. "DBTEMP"="/tmp"
  20. "SUBQCACHESZ"="10"
  21. INFO_DONE
  22. SQ_EOT
  23.  
  24. S->C (2)
  25. SQ_EOT
  26.  
  27. C->S (16)
  28. SQ_DBOPEN
  29. "database" [8]
  30. NOT EXCLUSIVE
  31. SQ_EOT
  32.  
  33. S->C (28)
  34. SQ_DONE
  35. Warning..: 0x15
  36. # rows...: 0
  37. rowid....: 0
  38. serial id: 0
  39. SQ_COST
  40. estimated #rows: 1
  41. estimated I/O..: 1
  42. SQ_EOT
  43.  
  44. C->S (78)
  45. SQ_PREPARE
  46. # values: 0
  47. CMD.....: "select site from informix.systables where tabname = ' GL_COLLATE'" [65]
  48. SQ_NDESCRIBE
  49. SQ_WANTDONE
  50. SQ_EOT
  51.  
  52. trying com.informix.jdbc.IfxDriver
  53. SQLWarning: reason(Database selected) SQLState(01I04)
  54. SQLWarning: reason(Float to decimal conversion has been used) SQLState(01I05)
  55. SQLWarning: reason(Database has transactions) SQLState(01I01)
  56. SQLWarning: reason(Database selected) SQLState(01I04)
  57. SQLWarning: reason(Database has transactions) SQLState(01I01)
  58. SQLWarning: reason(Database selected) SQLState(01I04)
  59.  
  60. import java.io.FileWriter;
  61. import java.io.PrintWriter;
  62. import java.sql.Connection;
  63. import java.sql.DriverManager;
  64. import java.sql.ResultSet;
  65. import java.sql.Statement;
  66.  
  67. class informix_trace
  68. {
  69. public static void main(String[] args)
  70. {
  71. try
  72. {
  73. Class.forName("com.informix.jdbc.IfxDriver");
  74. FileWriter fwTrace = new FileWriter("c:\JDBCTrace.log");
  75. PrintWriter pwTrace = new PrintWriter(fwTrace);
  76. DriverManager.setLogWriter(pwTrace);
  77. String debug_url = "SQLIDEBUG=C:\sqlidebug.trace";
  78. String url = "jdbc:informix-sqli://1.2.3.4:9088/test_db:informixserver=ol_testifx;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250;" + debug_url
  79. Connection connection = DriverManager.getConnection(url, "user", "passwd");
  80. Statement statement = connection.createStatement();
  81. ResultSet resultSet = statement.executeQuery("SELECT FIRST 1 DBINFO('version','full') FROM systables;");
  82. while (resultSet.next())
  83. System.out.println(resultSet.getObject(1));
  84. }
  85. catch (Exception e)
  86. {
  87. e.printStackTrace();
  88. }
  89. }
  90.  
  91. } // class informix_trace
  92.  
  93. c:>sqliprt sqlidebug.trace1391758523500.0
  94. SQLIDBG Version 1
  95. ...
  96. S->C (12)
  97. SQ_ERR
  98. SQL error..........: -329
  99. ISAM/RSAM error....: -111
  100. Offset in statement: 0
  101. Error message......: "" [0]
  102. SQ_EOT
  103.  
  104. SQLState(IX000) vendor code(-111)
  105. java.sql.SQLException: ISAM error: no record found.
  106. at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
  107. at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3412)
  108. at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2324)
  109. ....
  110. at java.sql.DriverManager.getConnection(Unknown Source)
  111. at informix_trace.main(informix_trace.java:20)
  112. getConnection failed: java.sql.SQLException: No database found or wrong system privileges.
  113.  
  114. getConnection("jdbc:informix-sqli://169.0.5.10:9088/test_db:informixserver=ol_test;DB_LOCALE=pl_PL.CP1250;CLIENT_LOCALE=pl_PL.CP1250;charSet=CP1250", username, password)
  115.  
  116. ip.addr == 169.0.5.10
  117.  
  118. c:>netstat -an | grep 9088
  119. TCP 169.0.1.126:4295 169.0.5.10:9088 TIME_WAIT
  120.  
  121. c:>netstat -an | grep 9089
  122. TCP 169.0.1.126:4398 169.0.5.10:9089 SYN_SENT
  123.  
  124. import java.sql.Connection;
  125. import java.sql.DriverManager;
  126. import java.sql.SQLException;
  127. import com.informix.*;
  128. public class DBConnect {
  129. static String url="jdbc:informix-sqli://host_name:port/database_name:INFORMIXSERVER=server;user=username;password=password";
  130.  
  131. public static void main(String [] args){
  132. try {
  133. Class.forName("com.informix.jdbc.IfxDriver");
  134. }catch (Exception e){
  135. System.out.println("ERROR: failed to load Informix JDBC driver.");
  136. e.printStackTrace();
  137. return;
  138. }
  139. try{
  140.  
  141. DriverManager.registerDriver((com.informix.jdbc.IfxDriver)Class.forName("com.informix.jdbc.IfxDriver").newInstance());
  142.  
  143. }catch(Exception ex){
  144. System.out.println("Driver is not Registered");
  145. }
  146. try{
  147.  
  148. Connection conn = DriverManager.getConnection(url);
  149. System.out.println("Connection Successful");
  150. }catch (SQLException e){
  151. System.out.println("ERROR: failed to connect!");
  152. System.out.println("ERROR: " + e.getMessage());
  153. e.printStackTrace();
  154. return;
  155. }
  156. }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement