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.
Related
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.
i keep on getting the following error when ever i try to run my code to check connection between java code and db.
java.sql.SQLException: No suitable driver found for jdbc:sqlserver://192.168.1.100
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at StoredProcedure.main(StoredProcedure.java:19)
There's not really enough information here to help you. Check out this question for a good example on how to pose your question, and possibly find an answer.
Its' showing No suitable driver found. Check your jdk compatible driver version with sql server.
Check system requirements here
Both jdk 7 and jdk 8 compatible jar file
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 am using H2 database in client-server mode. Server is running with version 1.3.175 and client with 1.3.168.
Everything seems working fine, but I get an exception executing some queries:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.NullPointerException" [50000-175]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
at org.h2.message.DbException.get(DbException.java:161)
at org.h2.message.DbException.convert(DbException.java:284)
at org.h2.server.TcpServerThread.sendError(TcpServerThread.java:218)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:158)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.h2.expression.Function.getCost(Function.java:2391)
at org.h2.expression.CompareLike.getCost(CompareLike.java:417)
at org.h2.expression.ConditionAndOr.optimize(ConditionAndOr.java:133)
at org.h2.command.dml.Select.prepare(Select.java:813)
at org.h2.command.Parser.prepareCommand(Parser.java:240)
at org.h2.engine.Session.prepareLocal(Session.java:436)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:260)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:156)
... 1 more
at org.h2.engine.SessionRemote.done(SessionRemote.java:567)
at org.h2.command.CommandRemote.prepare(CommandRemote.java:67)
at org.h2.command.CommandRemote.<init>(CommandRemote.java:46)
at org.h2.engine.SessionRemote.prepareCommand(SessionRemote.java:439)
at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1109)
at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:74)
at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:264)
Thanks for help.
This is a bug in this version of the database engine, which was fixed in revision 5437 of the trunk.
You can either:
go back to the previous version (1.3.174) which should not have this bug,
use the latest nightly build where it should be fixed,
download the latest source code and built the database yourself, or
wait for the next version of H2.
For those who are willing to read a bit, (skip to end for short version):
I am trying to connect my java app to a remote oracle database. with no luck I am using Mac 10.7.5 with IntelliJ Idea 12, java version "1.6.0_51" 64-bit. I have been trying to get this work all day with no success. I also was not able to use the 'DataSource' view in IntelliJ because of a missing shared dylib missing in java.library.path. I suspect the two issues are related.
I tried installing Oracle Instant Client 64-bit (including the jdbc files), copied the dylibs to /usr/lib/java and this got me close to solving the "DataSource" view issue with a different error:
java.lang.RuntimeException: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
in RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:219)
at com.sun.proxy.$Proxy115.connect(Unknown Source)
in LocalDataSource.getConnection(LocalDataSource.java:158)
Caused by: java.rmi.UnmarshalException: Error unmarshaling return header; nested exception is:
java.io.EOFException
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:209)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at com.sun.proxy.$Proxy114.connect(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
in RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:211)
... 21 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readByte(DataInputStream.java:250)
at sun.rmi.transport.StreamRemoteCall.executeCal
So the journey continued and I tried using the 32bit version of the ojdbc .dylibs and .jars but then I ran into 'wrong architecture'when trying to connect to oracle db using IntelliJ's DataSource view.
I would like to keep everything consistent by using 32-bit since most of my apps use libraries that require 32-bit JVM.
tl;dr 'ers:
-Cannot connect to oracle db through IntelliJ Idea 12 DataSource view nor connect through java app using JDBC
-BackGround Info: Mac OSX 10.7.5, Java 1.6.0_51 64-bit, IntelliJ Idea 12, Remote Oracle 11G DB
-Tried both 32-bit and 64-bit versions of Oracle Instant Client with jdbc files, no luck
Any suggestions will be greatly appreciated!
Thank you
Additional Notes: I cannot connect through sqlplus either; i get the error ORA-21561: OID generation failed. Search results only point to fixing the /etc/hosts file which does not make sense for me since the db server is on a remote server and I am connecting using a TNS entry in /etc/tnsnames.ora
===UPDATE 1===
I made some progress on connecting through the java code. Using this code:
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:#hostname:port/service_name", "user", "password");
but received the error:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
I CAN connect using this exact piece of code on my work machine through eclipse ide but not on my Mac laptop.
For Intellij/DataGrip 2018 DB connection via TNS I got
[08006][17002] IO Error: Invalid connection string format, a valid format is: "host:port:sid"
I find the problem in Oracle driver version: 11.2.0.4
I get "Test Connection > Succesful" using version 12.1.0.2
I can only encourage you to use the oracle thin jdbc client. There must be a very specific reason not to. With that you will likely have NO problems.