Home » Archived » BIRT » BIRT and MSSQL: No suitable driver found for jdbc:
BIRT and MSSQL: No suitable driver found for jdbc: [message #840299] |
Mon, 09 April 2012 19:24  |
Eclipse User |
|
|
|
Hello, all:
Could someone help me with best way to have BIRT see the JDBC drivers...
I wrote a java class that connects to the msSQL, performs calculations and returns some numbers. This class has been tested in pure java and matlab. In both cases the code works without the glitch. For clarity let's call the class "ZZZ" and the package "com.mypackage"
I load the .jar file that contains the class via the "external jar" option and then use the ZZZ class from within BIRT via importPackage(Packages.com.mypackage) command.
Intantiation goes smoothly ie
var aaa = new ZZZ();
executes without problems.
when I call the methods, something like:
aaa.doDBthings();
I get the following error message:
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://myServer;databaseName = wines;integratedSecurity=true;
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
....etc....etc....
Couple questions come to my mind.
1) Why does BIRT not see the jdbc drivers?
2) what should I do so that BIRT can see the suitable JDBC driver?
3) how can I set up my path if I do not have administator rights on a computer?
4) do I need to place sqljdbc4.jar (MSSQL jdbc driver) into a certain directory?
5) is this a BIRT problem or is this an ECLIPSE problem?
Thank you in advance,
Andrew
[Updated on: Mon, 09 April 2012 19:57] by Moderator
|
|
| | |
Re: BIRT and MSSQL: No suitable driver found for jdbc: [message #841631 is a reply to message #841085] |
Wed, 11 April 2012 11:15   |
Eclipse User |
|
|
|
Do you have the driver in more than one place? When you use the manage
drivers button it copies the driver to the drivers directory of the jdbc
plugin.
Jason
On 4/10/2012 6:17 PM, andrew smith wrote:
> Jason,
> Thank for your response. The sql drivers jar are already defined in the
> BIRT driver manager. I do not deploy the report per se, I click on the
> preview tab and then the error ('No suitable driver') in the console
> window of the eclipse(eclipsec.exe) pops up. I
> The error in the BIRT RCP in the 'Problem' window is:
>
> org.eclipse.birt.report.engine.api.EngineException: There are errors
> evaluating script "
>
> // ---IMPORT PACKAGES
> //importPackage(Packages.java.sql);
> importPackage(Packages.com.myServer.research.Portfolio);
> //importPackage(Packages.com.microsoft.sqlserver.jdbc);
> //importPackage(Packages.java.io);
> //System.out.println("================================");
>
> // ---IMPORT PACKAGES
>
> // --- DEFINE THE STRATEGY PROGRAM IDS
> var ProgID_StatisticalArbitrage = "2456, 3456";
> // --- DEFINE THE STRATEGY PROGRAM IDS
>
> // --- INSTANTIATE THE PORTFOLIO OBJECTS FOR DIFFERENT CATEGORIES
> var jj = new Portfolio(ProgID_StatisticalArbitrage);
> jj.makeEqualWeigthPortfolio();
> //var pp = jj.resultVector.get(0);
> jj.showResultVector;
> //for(int i=0, i<pp.size,i++){
> //print(pp.get(i));
> //}
> //print(jj.resultVector.get(1));
> // --- INSTANTIATE THE PORTFOLIO OBJECTS FOR DIFFERENT CATEGORIES
>
>
> // --- CALCULATE THE PORTFOLIO MONTHLY RETURNS
>
> // --- CALCULATE THE PORTFOLIO MONTHLY RETURNS
>
> ":
> Wrapped java.lang.NullPointerException
> (/report/method[@name="initialize"]#23) (Element ID:1)
>
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:244)
>
>
> at
> org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleInitialize(ReportScriptExecutor.java:93)
>
>
> at
> org.eclipse.birt.report.engine.api.impl.EngineTask.loadDesign(EngineTask.java:1847)
>
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:98)
>
>
> at
> org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:77)
>
>
> at
> org.eclipse.birt.report.service.ReportEngineService.runAndRenderReport(ReportEngineService.java:929)
>
>
> at
> org.eclipse.birt.report.service.BirtViewerReportService.runAndRenderReport(BirtViewerReportService.java:973)
>
>
> at
> org.eclipse.birt.report.service.actionhandler.BirtGetPageAllActionHandler.__execute(BirtGetPageAllActionHandler.java:131)
>
>
> at
> org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
>
>
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
>
>
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
>
>
> at
> org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPageAll(BirtDocumentProcessor.java:183)
>
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at
> org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
>
>
> at
> org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
>
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at
> org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
>
>
> at
> org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
>
>
> at
> org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
>
> at
> org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>
>
> at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>
> at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>
> at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
>
> at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>
> at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>
> at
> org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
>
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>
> at
> org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>
> at
> org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
>
>
> at
> org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
>
>
> at
> org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
>
>
> at
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
>
>
> at
> org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
>
>
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>
> at
> org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
>
>
> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
>
> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
>
> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
>
> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>
> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>
> at org.mortbay.jetty.Server.handle(Server.java:326)
>
> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
>
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
>
>
> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
>
> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
>
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>
> at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>
>
> at
> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
>
>
> Caused by: org.eclipse.birt.core.exception.CoreException: There are
> errors evaluating script "
>
>
> // ---IMPORT PACKAGES
> //importPackage(Packages.java.sql);
> importPackage(Packages.com.myServer.research.Portfolio);
> //importPackage(Packages.com.microsoft.sqlserver.jdbc);
> //importPackage(Packages.java.io);
> //System.out.println("================================");
>
> // ---IMPORT PACKAGES
>
> // --- DEFINE THE STRATEGY PROGRAM IDS
> var ProgID_StatisticalArbitrage = "2456, 3456";
> // --- DEFINE THE STRATEGY PROGRAM IDS
>
> // --- INSTANTIATE THE PORTFOLIO OBJECTS FOR DIFFERENT CATEGORIES
> var jj = new Portfolio(ProgID_StatisticalArbitrage);
> jj.makeEqualWeigthPortfolio();
> //var pp = jj.resultVector.get(0);
> jj.showResultVector;
> //for(int i=0, i<pp.size,i++){
> //print(pp.get(i));
> //}
> //print(jj.resultVector.get(1));
> // --- INSTANTIATE THE PORTFOLIO OBJECTS FOR DIFFERENT CATEGORIES
>
>
> // --- CALCULATE THE PORTFOLIO MONTHLY RETURNS
>
> // --- CALCULATE THE PORTFOLIO MONTHLY RETURNS
>
> ":
> Wrapped java.lang.NullPointerException
> (/report/method[@name="initialize"]#23)
>
> at
> org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:295)
>
>
> at
> org.eclipse.birt.core.script.ScriptContext.evaluate(ScriptContext.java:154)
>
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:781)
>
>
> at
> org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:710)
>
>
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScriptInternal(ScriptExecutor.java:117)
>
>
> at
> org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleScript(ScriptExecutor.java:104)
>
>
> at
> org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleInitialize(ReportScriptExecutor.java:84)
>
>
> ... 53 more
>
> Caused by: org.mozilla.javascript.WrappedException: Wrapped
> java.lang.NullPointerException (/report/method[@name="initialize"]#23)
>
> at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1773)
>
> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183)
>
> at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
>
> at
> org.mozilla.javascript.optimizer.OptRuntime.callProp0(OptRuntime.java:119)
>
> at org.mozilla.javascript.gen.c7._c0(/report/method[@name="initialize"]:23)
>
> at org.mozilla.javascript.gen.c7.call(/report/method[@name="initialize"])
>
> at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
>
> at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
>
> at org.mozilla.javascript.gen.c7.call(/report/method[@name="initialize"])
>
> at org.mozilla.javascript.gen.c7.exec(/report/method[@name="initialize"])
>
> at
> org.eclipse.birt.report.engine.javascript.JavascriptEngine.evaluate(JavascriptEngine.java:290)
>
>
> ... 59 more
>
> Caused by: java.lang.NullPointerException
>
> at
> com.myServer.research.Portfolio.Portfolio.makeEqualWeigthPortfolio(Portfolio.java:81)
>
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
> at java.lang.reflect.Method.invoke(Unknown Source)
>
> at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
>
> ... 68 more
>
>
>
>
> Thanks for your help. Edgar
>
|
|
| | | | |
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
|
|
| | | | | |
Goto Forum:
Current Time: Sat May 03 14:09:13 EDT 2025
Powered by FUDForum. Page generated in 1.09251 seconds
|