patelakhil
16 years agoContributor
Getting java.lang.nullpointerexception error while trying to add new jdbc driver
Hi,
I want to use xlSql jdbc driver for excel file connectivity. For that first i have create sample java test and it is running fine. The code is attached at last here.
Now same driver string and database string i have created in soapui in jdbc connections list but it is giving java.lang.nullpointer exception.
The connection I have added is as below:
MainDataSource com.nilostep.xlsql.jdbc.xlDriver jdbc:nilostep:excel:D:\Study\javatest\xlsqltest
The jdbc configuration I have created is:
xlSQL_Y8/com.nilostep.xlsql.jdbc.xlDriver jdbc:nilostep:excel:
So please help me resolve this issue. Because it is must that I have to create connection for excel.
The java code which is working fine is as below:
String driver = "com.nilostep.xlsql.jdbc.xlDriver";
Driver d = (Driver) Class.forName(driver).newInstance();
String protocol = "jdbc:nilostep:excel";
String database = "D:\\Study\\javatest\\xlsqltest";
System.out.println(database);
String url = protocol + ":" + database;
Connection con = DriverManager.getConnection(url);
Statement stm = con.createStatement();
String sql = "";
sql = "select * from \"MainTestData.UsersToAddItemIntoCart\";";
you can suggest any other way as well for creating excel database connection at project level. Also i want to create it dynamic so i should be able to give Global property as db path.
Thanks,
Akhilumar Patel - Test Automation Architecture.
I want to use xlSql jdbc driver for excel file connectivity. For that first i have create sample java test and it is running fine. The code is attached at last here.
Now same driver string and database string i have created in soapui in jdbc connections list but it is giving java.lang.nullpointer exception.
The connection I have added is as below:
MainDataSource com.nilostep.xlsql.jdbc.xlDriver jdbc:nilostep:excel:D:\Study\javatest\xlsqltest
The jdbc configuration I have created is:
xlSQL_Y8/com.nilostep.xlsql.jdbc.xlDriver jdbc:nilostep:excel:
So please help me resolve this issue. Because it is must that I have to create connection for excel.
The java code which is working fine is as below:
String driver = "com.nilostep.xlsql.jdbc.xlDriver";
Driver d = (Driver) Class.forName(driver).newInstance();
String protocol = "jdbc:nilostep:excel";
String database = "D:\\Study\\javatest\\xlsqltest";
System.out.println(database);
String url = protocol + ":" + database;
Connection con = DriverManager.getConnection(url);
Statement stm = con.createStatement();
String sql = "";
sql = "select * from \"MainTestData.UsersToAddItemIntoCart\";";
you can suggest any other way as well for creating excel database connection at project level. Also i want to create it dynamic so i should be able to give Global property as db path.
Thanks,
Akhilumar Patel - Test Automation Architecture.