Enterprise Java for Linux HOWTO 
insert into test (col1) values ( Hello, from Sybase! )  
go 
You should see no error messages. 
Finally, confirm that the row is there by typing: 
select col1 from test  
go 
You should see the row you just created. 
You can exit isql by typing "exit". 
For more assistance on working with Sybase, review the documentation that can be downloaded with Sybase. 
You will need to add the appropriate JAR to your CLASSPATH. 
export CLASSPATH=$CLASSPATH:/usr/local/sybase/jConnect-5_2/classes/jconn2.jar  
You may need to substitute the path depending you where jConnect is installed on your system. 
Confirming Your Installation 
You are now ready to compile and run a simple JDBC application that uses Sybase.  Create the following
program. 
import java.sql.*;  
class SybaseTest { 
  public static void main (String[] args) { 
    try { 
      Driver driver = (Driver) 
        Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance(); 
      DriverManager.registerDriver(driver); 
      String     host = "127.0.0.1"; 
      String     port = "4100"; 
      String     url = "jdbc:sybase:Tds:" + host + ":" + port; 
      Connection con = DriverManager.getConnection(url, "javatest", "javatest"); 
      Statement  stm = con.createStatement(); 
      stm.setQueryTimeout(10); 
      ResultSet  rs  = stm.executeQuery("select col1 from test"); 
      rs.next(); 
      System.out.println(rs.getString(1)); 
    } catch (SQLException e) { 
      System.out.println("Exception!"); 
      System.out.println(e.toString()); 
  } 
} 
Confirming Your Installation 
25






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved