|
|
|
Re: BIRT and MSSQL: No suitable driver found for jdbc: [message #847084 is a reply to message #843973] |
Mon, 16 April 2012 21:46   |
Eclipse User |
|
|
|
Jason,
Thanks for your attention to my problem. Yes, I downloaded the allinone and ran the report from there. The result is pretty much the same in the long run. Here is new observation that I was able to make - this only started to happen after I ran the report through the fresh allinone bundle. The same effect persists in old version of birt and the new allinone.
The report now can execute as expected,....but only if a freshly loaded BIRT is used. In other words: I would have to shut down eclipse and re-load eclipse/birt, then the report will get generated fine. If however, I try to have birt generate report anew in the same instance of BIRT, then the old error persists.
This leads me to a question:
--Do you think BIRT is holding the instance of the JDBC driver resource open and as such when the next request comes it, the JDBC resource is unavailable since it is held up open?
Let me know if you have ran across this error in the past,
Thank you,
Andrew
update (few hours later...)
Jason,
As a follow up to the above, I decided to go ahead and connect to the database directly from BIRT via the following code:
//=====================================
importPackage(Packages.java.util);
importPackage(Packages.java.sql);
importPackage(Packages.java.lang);
importPackage(Packages.java.text);
connection = DriverManager.getConnection("jdbc:sqlserver://one.myDB.com; databaseName=orange; integratedSecurity=true;");
But the above line makes BIRT generate the following error.
Error evaluating Javascript expression. Script engine error: Wrapped java.sql.SQLException: No suitable driver found for jdbc:sqlserver://one.myDB.com; databaseName=orange; integratedSecurity=true; (/report/data-sets/script-data-set[@id="329"]/method[@name="fetch"]#9)
Just thought I'd let you know about that too as well.
thanks,
Andrew
[Updated on: Tue, 17 April 2012 02:04] by Moderator
|
|
|
Re: BIRT and MSSQL: No suitable driver found for jdbc: [message #847705 is a reply to message #847084] |
Tue, 17 April 2012 11:12   |
Eclipse User |
|
|
|
I ran mine multiple times with no issues. Here is my code:
public class MySqlClassic
{
public static PreparedStatement stmt=null;
public static Connection con=null;
public Vector init() throws Exception {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con =
DriverManager.getConnection("jdbc:mysql://localhost/mydb?user=root&password=root");
String sql = "SELECT * From orderdetails";
stmt = con.prepareStatement(sql);
Vector rtn = new Vector();
Statement s = null;
try {
s = con.createStatement();
} catch (SQLException se) {
System.out.println("We got an exception while creating a
statement:" +
"that probably means we're no longer
connected.");
se.printStackTrace();
System.exit(1);
}
ResultSet rs = null;
try {
rs = s.executeQuery("SELECT * FROM orderdetails");
} catch (SQLException se) {
System.out.println("We got an exception while executing our
query:" +
"that probably means our SQL is invalid");
se.printStackTrace();
System.exit(1);
}
int index = 0;
try {
while (rs.next()) {
System.out.println("Here's the result of row " + index++
+ ":");
System.out.println(rs.getString(1));
rtn.add(rs.getString(1));
}
} catch (SQLException se) {
System.out.println("We got an exception while getting a
result:this " +
"shouldn't happen: we've done something
really bad.");
se.printStackTrace();
System.exit(1);
}
return rtn;
}
public void close(){
try{
stmt.close();
con.close();
}catch( Exception e){
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception {
MySqlClassic ms = new MySqlClassic();
Vector r = ms.init();
System.out.println(r.size() );
ms.close();
}
}
Then in the report
Here is my code for the scripted dataset:
//open
importPackage(Packages.test.my.sql);
mySql = new MySqlClassic();
myVec = mySql.init();
i=0;
//fetch
if( i < myVec.size() ){
row["col1"] = myVec.get(i);
i++
return true;
}else{
return false;
}
//close
mySql.close();
Jason
On 4/16/2012 9:46 PM, andrew smith wrote:
> Jason,
> Thanks for your attention to my problem. Yes, I downloaded the allinone
> and ran the report from there. The result is pretty much the same in the
> long run. Here is new observation that I was able to make - this only
> started to happen after I ran the report through the fresh allinone
> bundle. The same effect persists in old version of birt and the new
> allinone.
> The report now can execute as expected,....but only if a freshly loaded
> BIRT is used. In other words: I would have to shut down eclipse and
> re-load eclipse/birt, then the report will get generated fine. If
> however, I try to have birt generate report anew in the same instance of
> BIRT, then the old error persists.
> This leads me to a question:
> --Do you think BIRT is holding the instance of the JDBC driver resource
> open and as such when the next request comes it, the JDBC resource is
> unavailable since it is held up open?
> Let me know if you have ran across this error in the past,
>
> Thank you,
> Andrew
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03779 seconds