Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connection = DriverManager.getConnection("jdbc:informix-sqli://"+ip+
- /"+sid+":INFORMIXSERVER="+server+";user="+user+";password="+pass+"");
- C->S (4)
- SQ_VERSION
- SQ_EOT
- S->C (14)
- SQ_VERSION
- "7.31.TD6" [8]
- SQ_EOT
- C->S (66)
- SQ_INFO
- INFO_ENV
- Name Length = 12
- Value Length = 8
- "DBTIME"="%d/%M/%Y"
- "DBTEMP"="/tmp"
- "SUBQCACHESZ"="10"
- INFO_DONE
- SQ_EOT
- S->C (2)
- SQ_EOT
- C->S (16)
- SQ_DBOPEN
- "database" [8]
- NOT EXCLUSIVE
- SQ_EOT
- S->C (28)
- SQ_DONE
- Warning..: 0x15
- # rows...: 0
- rowid....: 0
- serial id: 0
- SQ_COST
- estimated #rows: 1
- estimated I/O..: 1
- SQ_EOT
- C->S (78)
- SQ_PREPARE
- # values: 0
- CMD.....: "select site from informix.systables where tabname = ' GL_COLLATE'" [65]
- SQ_NDESCRIBE
- SQ_WANTDONE
- SQ_EOT
- trying com.informix.jdbc.IfxDriver
- SQLWarning: reason(Database selected) SQLState(01I04)
- SQLWarning: reason(Float to decimal conversion has been used) SQLState(01I05)
- SQLWarning: reason(Database has transactions) SQLState(01I01)
- SQLWarning: reason(Database selected) SQLState(01I04)
- SQLWarning: reason(Database has transactions) SQLState(01I01)
- SQLWarning: reason(Database selected) SQLState(01I04)
- import java.io.FileWriter;
- import java.io.PrintWriter;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import java.sql.Statement;
- class informix_trace
- {
- public static void main(String[] args)
- {
- try
- {
- Class.forName("com.informix.jdbc.IfxDriver");
- FileWriter fwTrace = new FileWriter("c:\JDBCTrace.log");
- PrintWriter pwTrace = new PrintWriter(fwTrace);
- DriverManager.setLogWriter(pwTrace);
- String debug_url = "SQLIDEBUG=C:\sqlidebug.trace";
- 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
- Connection connection = DriverManager.getConnection(url, "user", "passwd");
- Statement statement = connection.createStatement();
- ResultSet resultSet = statement.executeQuery("SELECT FIRST 1 DBINFO('version','full') FROM systables;");
- while (resultSet.next())
- System.out.println(resultSet.getObject(1));
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
- } // class informix_trace
- c:>sqliprt sqlidebug.trace1391758523500.0
- SQLIDBG Version 1
- ...
- S->C (12)
- SQ_ERR
- SQL error..........: -329
- ISAM/RSAM error....: -111
- Offset in statement: 0
- Error message......: "" [0]
- SQ_EOT
- SQLState(IX000) vendor code(-111)
- java.sql.SQLException: ISAM error: no record found.
- at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:413)
- at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3412)
- at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2324)
- ....
- at java.sql.DriverManager.getConnection(Unknown Source)
- at informix_trace.main(informix_trace.java:20)
- getConnection failed: java.sql.SQLException: No database found or wrong system privileges.
- 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)
- ip.addr == 169.0.5.10
- c:>netstat -an | grep 9088
- TCP 169.0.1.126:4295 169.0.5.10:9088 TIME_WAIT
- c:>netstat -an | grep 9089
- TCP 169.0.1.126:4398 169.0.5.10:9089 SYN_SENT
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import com.informix.*;
- public class DBConnect {
- static String url="jdbc:informix-sqli://host_name:port/database_name:INFORMIXSERVER=server;user=username;password=password";
- public static void main(String [] args){
- try {
- Class.forName("com.informix.jdbc.IfxDriver");
- }catch (Exception e){
- System.out.println("ERROR: failed to load Informix JDBC driver.");
- e.printStackTrace();
- return;
- }
- try{
- DriverManager.registerDriver((com.informix.jdbc.IfxDriver)Class.forName("com.informix.jdbc.IfxDriver").newInstance());
- }catch(Exception ex){
- System.out.println("Driver is not Registered");
- }
- try{
- Connection conn = DriverManager.getConnection(url);
- System.out.println("Connection Successful");
- }catch (SQLException e){
- System.out.println("ERROR: failed to connect!");
- System.out.println("ERROR: " + e.getMessage());
- e.printStackTrace();
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement