I build a Sybase-IQ 16.0 on red-hat 7 server.
I try to use dbisql for bulk load data in Sybase.
And I already successful by command in Sybase server:
dbisql -nogui -c "UID=DBA;PWD=sql;DWN=iqtry;host=172.16.50.137:2643;" -onerror continue READ /EXT_LOAD/Load_Test_Data.SQL
But I need to do this in java program from project requirement, so my program as below:
import java.io.*;
import java.sql.*;
import java.util.*;
import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Test {
public static void main(String[] args) throws SQLException {
String dburl = "dbisql -nogui -c 'UID=DBA;PWD=sql;DWN=iqtry;host=172.16.50.137:2643;' -onerror continue READ /sybase/IQ_LOAD/load_DBA.atest.sql";
// Connect to Sybase Database
Connection con = DriverManager.getConnection(dburl);
Statement statement = con.createStatement();
}}
And I can compile in Syabse Server, but when I run this class, I got following error:
Exception in thread "main" java.sql.SQLException: No suitable driver found for
jdbc:sqlanywhere:uid=DBA;pwd=sql;eng=iqtry;database=atest;links=tcpip(host=172.
16.50.137,2643)
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at Test.main(ConnectIQ.java:30)
From my problem, I have try to set classpath in my current path
set classpath = ./sybase/IQ-16_0/java/sajdbc4.jar
set classpath = ./sybase/IQ-16_0/java/jconn4.jar
But all is can't work.
CLASSPATH
might not be used at all (that is actually the case for most ways Java applications are run). BTW Note that the code shown and the exception do not match (as the exception shows a different value for dburl than shown in your code). – Mark Rotteveel