I am doing a program of hibernate with Jersey using mysql.all configuration is correct as I had run the program through main.and got the desired output. but when I call the program as web application and hit the rest URL it gives connection
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
at com.util.EmpUtil.selecthql(EmpUtil.java:76) at
com.util.RestController.selectAll(RestController.java:47)
Caused by: java.sql.SQLException: No suitable driver found for
jdbc:mysql://127.0.0.1/test at
java.sql.DriverManager.getConnection(Unknown Source) at
java.sql.DriverManager.getConnection(Unknown Source) at
org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
I am getting session object and i have all jars attached.as program is running using main function.Is there any difference between running a program using main and as web application.
Related
I am having problems trying to connect from a Java application (Netbeans IDE 8.0.2) to a database in SQL EXPRESS 2010. I know that the connection parameters are correct since if I try to make the connection running the application from Netbeans it works fine, but If I try to make the connection running the aplication with the .jar, the try-catch shows me the following error:
Com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId: ad61b2cf-071d-4561-9416-c31f8e918a34
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2400)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:68)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3132)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:43)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3123)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2445)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1981)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1628)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1459)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:773)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(SQLServerDataSource.java:704)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(SQLServerDataSource.java:54)
at sqlserver.SqlServer.checkNewConnection(SqlServer.java:67)
at view.Dialogs.configConnection(Dialogs.java:269)
at demosocketserial.DemoSocketSerial.checkConnection(DemoSocketSerial.java:211)
at demosocketserial.DemoSocketSerial.main(DemoSocketSerial.java:41)
Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.microsoft.sqlserver.jdbc.AuthenticationJNI.<clinit>(AuthenticationJNI.java:41)
... 15 more
I already copied the sqljdbc_auth.dll file to the Windows System32 folder (that's how I made the connection successful from Netbeans) but I did not get the program to work from the .jar inside the "dist" folder.
Hi I am unable to connect to database from cmd, there is a problem in establishing a connection. I am using DB2 10.5 version client. Databse is on 10.5 server (Triend with db on 9.7 version server too).
I get the below excpetion :
com.ibm.db2.jcc.am.SqlException: [jcc][4038][12241][3.69.24] T2LUW exception: SQL1042C An unexpected system error occurred. SQLSTATE=58004
ERRORCODE=-1042, SQLSTATE=58004
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.am.gd.a(Unknown Source)
at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(Unknown Source)
at com.ibm.db2.jcc.uw.UWExceptionGenerator.a(Unknown Source)
at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
at com.ibm.db2.jcc.uw.f.b(Unknown Source)
at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
at com.ibm.db2.jcc.uw.UWConnection.a(Unknown Source)
at com.ibm.db2.jcc.uw.UWConnection.<init>(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at com.ibm.db2.jcc.DB2Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DBOperation.setConnection(DBOperation.java:38)
at DBOperation.<init>(DBOperation.java:11)
at VTLoadStandard.main(VTLoadStandard.java:237)
Please help on resolving the issue.
Have a look at the manual entry for this error message.
It may be that your database configuration needs to be upgraded.
Explanation
A system error occurred. Some possible reasons for this error are:
The database manager is not installed correctly or the environment is not set up correctly.
On UNIX-based systems, db2iupdt may need to be run in order to update the DB2 instance to enable acquisition of a new system
configuration or access to function associated with the installation
or removal of certain product options, FixPaks, or modification
levels.
You might get this message if you are not using the correct DB2 Administration Server password.
There is more information about the error at the page I linked above.
You should check the contents of the DB2 diagnostics log file (db2diag.log) on the server side. The JDBC driver itself usually does not raise errors of such type, so there must be something wrong on the server.
For me the following helped: make sure you set the driver type 4.
db2datasource.setDriverType(4);
// put driverType=4; into the jdbc url
I have moved my project into my webapps directory under the tomcat 6.0 directory and am running this under the updated url using port 8080.
Has anyone ever seen this error?
**java.lang.UnsatisfiedLinkError: Native Library D:\oracle\product\10.2.0\client_1\BIN\ocijdbc10.dll already loaded in another classloader**
java.lang.ClassLoader.loadLibrary0(Unknown Source)
java.lang.ClassLoader.loadLibrary(Unknown Source)
java.lang.Runtime.loadLibrary0(Unknown Source)
java.lang.System.loadLibrary(Unknown Source)
oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3147)
java.security.AccessController.doPrivileged(Native Method)
oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3143)
oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
I am curious to find out what the first line of this stack trace is.
What does this mean?
Please let me know if more information is required from my program.
Thank you in advance.
Sonny
As error saying - you can not load dll lirary from two separate class loaders. Most likely you have two separate Web Applications using connection to Oracle.
Please try to move oracle library jar to Tomcat shared/lib folder, so library will be loaded only once by Tomcat Common Class Loader.
Hello all I solved my own issue. I had to change the path of the oracle database to a jdbc thin client url as opposed to directly connecting to the oracle database.
originally I was using the statement: intfdb.JDBCOCIDRV=jdbc:oracle:oci:#GPSTRKPD.na.jnj.com
to connect which was causing the error.
I change my statement to: jdbc:oracle:thin:#psgtwp0.na.jnj.com:1531:gpstrkpd and it works fine now. Thanks for all of your input.
Sonny
I am trying to test a database connection in Mule Studio 3.4. I keep getting errors and I keep noticing this particular error in the error log. What is this trying to tell me? The connection to the database keeps failing and I am not sure what is wrong. I am new to mule and not that experienced with java and spring. Any help is appreciated.
Below is the stack trace for the error.
org.mule.common.MuleArtifactFactoryException: Error initializing
at org.mule.config.spring.SpringXmlConfigurationMuleArtifactFactory.doGetArtifact(SpringXmlConfigurationMuleArtifactFactory.java:149)
at org.mule.config.spring.SpringXmlConfigurationMuleArtifactFactory.getArtifact(SpringXmlConfigurationMuleArtifactFactory.java:49)
at org.mule.config.spring.SpringXmlConfigurationMuleArtifactFactory.getArtifact(SpringXmlConfigurationMuleArtifactFactory.java:39)
at org.mule.tooling.metadata.api.utils.ConnectionTester.internalTestConnection(ConnectionTester.java:58)
at org.mule.tooling.metadata.api.utils.ConnectionTester.testConnectionFor(ConnectionTester.java:92)
at org.mule.tooling.messageflow.action.TestConnectorConnectionFromMuleConfigAction$1$1.run(TestConnectorConnectionFromMuleConfigAction.java:65)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mule.retry.RetryPolicyExhaustedException: Error trying to load driver: ${osas-jdbc.classname} : ${osas-jdbc.classname} (java.sql.SQLException)
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:105)
at org.mule.transport.AbstractConnector.connect(AbstractConnector.java:1616)
at org.mule.transport.AbstractConnector.start(AbstractConnector.java:428)
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.mule.lifecycle.phases.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:225)
at org.mule.lifecycle.RegistryLifecycleManager$RegistryLifecycleCallback.onTransition(RegistryLifecycleManager.java:276)
at org.mule.lifecycle.RegistryLifecycleManager.invokePhase(RegistryLifecycleManager.java:155)
at org.mule.lifecycle.RegistryLifecycleManager.fireLifecycle(RegistryLifecycleManager.java:126)
at org.mule.registry.AbstractRegistryBroker.fireLifecycle(AbstractRegistryBroker.java:80)
at org.mule.registry.MuleRegistryHelper.fireLifecycle(MuleRegistryHelper.java:120)
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:94)
at org.mule.lifecycle.MuleContextLifecycleManager$MuleContextLifecycleCallback.onTransition(MuleContextLifecycleManager.java:90)
at org.mule.lifecycle.MuleContextLifecycleManager.invokePhase(MuleContextLifecycleManager.java:72)
at org.mule.lifecycle.MuleContextLifecycleManager.fireLifecycle(MuleContextLifecycleManager.java:64)
at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:255)
at org.mule.config.spring.SpringXmlConfigurationMuleArtifactFactory.doGetArtifact(SpringXmlConfigurationMuleArtifactFactory.java:130)
... 6 more
Caused by: org.mule.transport.ConnectException: Error trying to load driver: ${osas-jdbc.classname} : ${osas-jdbc.classname} (java.sql.SQLException)
at org.mule.transport.jdbc.JdbcConnector.getConnection(JdbcConnector.java:258)
at org.mule.transport.jdbc.JdbcConnector.doConnect(JdbcConnector.java:377)
at org.mule.transport.AbstractConnector$5.doWork(AbstractConnector.java:1556)
at org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:67)
... 24 more
Caused by: java.sql.SQLException: Error trying to load driver: ${osas-jdbc.classname} : ${osas-jdbc.classname}
at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:184)
at org.enhydra.jdbc.standard.StandardDataSource.getConnection(StandardDataSource.java:144)
at org.mule.transport.jdbc.JdbcConnector.getConnection(JdbcConnector.java:254)
... 27 more
It's as if you haven't provided a value for ${osas-jdbc.classname} either by using Mule's properties loading mechanism (i.e. a file named mule-app.properties at the root of the classpath) or by using Spring's context:property-placeholder.
While trying the create H2 database connection with the following URL,
Connection conn = DriverManager.getConnection("jdbc:h2:D:/HATBOX/Data;AUTO_SERVER=TRUE")
I get the following exception. Can anyone explain what i am missing here.
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Unsupported connection setting AUTO_SERVER [90113-73]
at org.h2.message.Message.getSQLException(Message.java:103)
at org.h2.message.Message.getSQLException(Message.java:114)
at org.h2.message.Message.getSQLException(Message.java:77)
at org.h2.engine.ConnectionInfo.readSettingsFromURL(ConnectionInfo.java:189)
at org.h2.engine.ConnectionInfo.<init>(ConnectionInfo.java:87)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:87)
at org.h2.Driver.connect(Driver.java:57)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.company.h2.TestInsert.main(TestInsert.java:16)
I need to use AUTO_SERVER=true as i am trying to configure HatBox with my application ,so that multiple processes can access the same database without having to start the server manually.
You are using a very old version of H2 (version 1.0.73 from 2008-05-31) where this option is not supported.
I suggest to upgrade to a recent version of H2.