vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello! I have trouble with setting up the connection pool for informix database in netbeans ide 6.0.1 I've found netbeans tutorial which explains how to set up the connection pool for mysql database. I followed the steps from tutorial,but it doesn't work for informix database. I have index.jsp page on which I have drop-down list which should be filled in with data dynamically. First error I've received was: javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for: com.informix.jdbc.IfxDataSource" I've solved this by adding the ifxjdbcx.jar to my project's library. But, the second error I don't know how to handle: javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: java.lang.StringIndexOutOfBoundsException cannot be cast to java.sql.SQLException" This is the part of web.xml file: <resource-ref> <description>jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01</description> <res-ref-name>jdbc/IfxDatabase</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> And this is the content of sun-resources.xml file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"> <resources> <jdbc-resource enabled="true" jndi-name="jdbc/IfxDatabase" object-type="user" pool-name="IfxDatabasePool"> <description/> </jdbc-resource> <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="com.informix.jdbcx.IfxDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="IfxDatabasePool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false"> <property name="URL" value="jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01"/> <property name="User" value="bpadmin"/> <property name="Password" value="pass"/> </jdbc-connection-pool> </resources> I can't find what is wrong. I would appreciate very much if someone could give me any advice. Thanks in advance. |
| |||
| try: jdbc:informix-sqli:// 192.168.242.131:9088:INFORMIXSERVER=ifx01;database =ifxdatabase Assume that your database is called ifxdatabase Superboer. On 14 mei, 13:10, La Farfalla <sjkoa2003MA...@yahoo.com.au> wrote: > Hello! > > I have trouble with setting up the connection pool for informix database > in netbeans ide 6.0.1 > I've found netbeans tutorial which explains how to set up the connection > pool for mysql database. I followed the steps from tutorial,but it > doesn't work for informix database. > > I have index.jsp page on which I have drop-down list which should be > filled in with data dynamically. > > First error I've received was: > javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable > to get connection, DataSource invalid: "java.sql.SQLException: Error in > allocating a connection. Cause: Class name is wrong or classpath is not > set for: com.informix.jdbc.IfxDataSource" > > I've solved this by adding the ifxjdbcx.jar to my project's library. > > But, the second error I don't know how to handle: > javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable > to get connection, DataSource invalid: "java.sql.SQLException: Error in > allocating a connection. Cause: > java.lang.StringIndexOutOfBoundsException cannot be cast to > java.sql.SQLException" > > This is the part of web.xml file: > > <resource-ref> > <description>jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01</description> > <res-ref-name>jdbc/IfxDatabase</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > <res-sharing-scope>Shareable</res-sharing-scope> > </resource-ref> > > And this is the content of sun-resources.xml file: > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application > Server 9.0 Resource Definitions //EN" > "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd"> > <resources> > <jdbc-resource enabled="true" jndi-name="jdbc/IfxDatabase" > object-type="user" pool-name="IfxDatabasePool"> > <description/> > </jdbc-resource> > <jdbc-connection-pool allow-non-component-callers="false" > associate-with-thread="false" connection-creation-retry-attempts="0" > connection-creation-retry-interval-in-seconds="10" > connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" > connection-validation-method="auto-commit" > datasource-classname="com.informix.jdbcx.IfxDataSource" > fail-all-connections="false" idle-timeout-in-seconds="300" > is-connection-validation-required="false" > is-isolation-level-guaranteed="true" lazy-connection-association="false" > lazy-connection-enlistment="false" match-connections="false" > max-connection-usage-count="0" max-pool-size="32" > max-wait-time-in-millis="60000" name="IfxDatabasePool" > non-transactional-connections="false" pool-resize-quantity="2" > res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" > steady-pool-size="8" validate-atmost-once-period-in-seconds="0" > wrap-jdbc-objects="false"> > <property name="URL" > value="jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01"/> > <property name="User" value="bpadmin"/> > <property name="Password" value="pass"/> > </jdbc-connection-pool> > </resources> > > I can't find what is wrong. I would appreciate very much if someone > could give me any advice. Thanks in advance. |
| |||
| Superboer wrote: > try: > > > jdbc:informix-sqli:// > 192.168.242.131:9088:INFORMIXSERVER=ifx01;database =ifxdatabase > > > Assume that your database is called ifxdatabase > > > Superboer. > > I've tryed jdbc:informix-sqli://192.168.242.131:9088:INFORMIXSERVER=ifx01;database =ifxdatabase, as you suggested, instead of jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01, but I'm still receiving the same error: javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Error in allocating a connection. Cause: java.lang.StringIndexOutOfBoundsException cannot be cast to java.sql.SQLException" Do you have any other suggestion? Thanks for trying to help me. |
| |||
| hmm not really assume that User" value="bpadmin" Password" value="pass" is correct, can you try this using dbaccess ->> connection--> user bpadmin -->passwd pass also did you check if your informix jdbc driver is in your path... you could goto the examples and see/test if you can get that to work.... hmmm may be when you try to a onstat -m you may see error 952 in the log meaning that the user/passwd is not correct. this: Cause: java.lang.StringIndexOutOfBoundsException cannot be cast to java.sql.SQLException" is very weird, sounds like maybe driver not in classpath??? Superboer. On 15 mei, 15:59, La Farfalla <sjkoa2003MA...@yahoo.com.au> wrote: > Superboer wrote: > > try: > > > jdbc:informix-sqli:// > > 192.168.242.131:9088:INFORMIXSERVER=ifx01;database =ifxdatabase > > > Assume that your database is called ifxdatabase > > > Superboer. > > I've tryed > jdbc:informix-sqli://192.168.242.131:9088:INFORMIXSERVER=ifx01;database =ifxdatabase, > as you suggested, instead of > jdbc:informix-sqli://192.168.242.131:9088/ifxdatabase:INFORMIXSERVER=ifx01, > but I'm still receiving the same error: > > javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable > to get connection, DataSource invalid: "java.sql.SQLException: Error in > allocating a connection. Cause: > java.lang.StringIndexOutOfBoundsException cannot be cast to > java.sql.SQLException" > > Do you have any other suggestion? > Thanks for trying to help me. |
| ||||
| The connection string is correct, I can connect to my database and I've checked if my informix jdbc driver is in the classpath. Everything is correct. My SQL query is also correct, so I guess I'm in the blind street. I really don't know what is wrong, I even don't have any idea what should I try next. |