I'm currently upgrading a project from Java 7 to Java 8, thus I switched from using the JDBC-ODBC Bridge to using UCanAccess. The database I want to connect to is registered as a system DSN so I connected to it like this:
Database.forURL("jdbc:odbc:MyDB" + ";DB_CLOSE_DELAY=-1;charSet=Cp1250", driver = "sun.jdbc.odbc.JdbcOdbcDriver")
Now I changed that to
Database.forURL("jdbc:ucanaccess:MyDB" + ";DB_CLOSE_DELAY=-1;charSet=Cp1250", driver = "net.ucanaccess.jdbc.UcanaccessDriver")
but that gives me the error:
Driver net.ucanaccess.jdbc.UcanaccessDriver does not know how to handle URL jdbc:ucanaccess:MyDB;DB_CLOSE_DELAY=-1;charSet=Cp1250
Is there a way to access a DSN via UCanAccess?
Is there a way to access a DSN via UCanAccess?
Not directly. UCanAccess is a JDBC driver that does not use ODBC, so it has no knowledge of ODBC DSNs.
Your UCanAccess connection string needs to include the path to the Access database file, e.g.,
jdbc:ucanaccess://C:/path/to/mydata.accdb
If necessary, you could retrieve that file path from the configuration information for an ODBC DSN. On Windows, the information for a System DSN named MyDB would be in the Windows registry under
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\MyDb
or perhaps
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\MyDb
Related
I'm on a Windows server and I have installed 2 things:
- MariaDB version 10.5.9
- MariaDB ODBC Driver version 3.1.13
Now I'm using the ODBC Data Source Administrator to create an ODBC connection. So I clicked on 'Add', chose MariaDB ODBC driver and got the following screen in front of me:
I really have no clue what to fill under Server Name, Port, User Name and Password. Especially the Server name seems quiet hard because I don't know where to get it from....
I´d like to know if it is possible to connect to my rds database from my local machine (windows) using windows odbc data source. My problem is that I use SSH and i don´t know how can I input the parameters in odbc data source. I need this type of connection because I want to access RDS via vba excel. My database is Postgresql.
If you have a publicly accessible database (not recommended by AWS) and your IP address is allowed, then the normal ODBC connection will work.
By the sound of your setup, you have a private database. In which case, your options are:
Use a different ODBC driver that supports tunnelling.
Devart (https://www.devart.com/odbc/postgresql/) and Cdata (https://cdn.cdata.com/help/FPG/odbc/RSBPostgresql_c_SSH.htm) both have ODBC drivers that support SSH tunnelling.
Neither are free.
Use a VPN and point your driver at localhost
I'm attempting to connect to a Postgres database that requires the client pass the paths to client and server SSL certificates using the ODBC driver for postgres. I'm using psqlodbc v11 x86 on Windows 10. I need to have three options passed to the ODBC driver sslrootcert, sslcert, and sslkey. I know that the paths are not being passed by the odbc driver since when I connect using the following connection string where I specify the pqopts it is able to connect.
Driver={PostgreSQL UNICODE};Server=XXXX;Port=5432;Database=XXXX;Uid=XXXX;Pwd=XXX;sslmode=verify-ca;pqopt={sslrootcert=C:\\ssl\\pgSQL.ca.cert sslcert=C:\\ssl\\pgSQL.cert sslkey=C:\\ssl\\pgSQL.key}
According to the document section
Advanced Options 3/3 Dialog Box->Libpq parameters, I should be able to pass the parameters by typing the values within the braces directly into the text box. It displays the error message saying that it cannot find the certificate because it is looking in the default location and is not using the value that was provided in the Libpq text box. Am I doing something wrong? Any advise on how to connect passing client certificates would be greatly appreciated.
Answering this in case anyone else finds this useful. The problem seems to be that the Test button on the ODBC Driver doesn't take the options set in the libpq parameters into account and just uses the default settings. When I saved the ODBC connection closed the ODBC Data Source Administrator window and used the connection from a different program it was able to connect successfully.
I want to connect Matlab to Sql server.
this is my code:
db = database('ChifcoProd-2013-12-12-11-37', '', '', 'sqljdbc4.jar',...
'jdbc:microsoft:sqlserver://localhost:1433;database=ChifcoProd-2013-12-12-11-37')
error:
JDBC Driver Error: sqljdbc4.jar. Driver Not Found/Loaded
the driver is already installed and I added the path to javaclasspath but it doesn't work.
Try using the Help within MatLab, its very helpful.
You are using the correct database connection:
conn = database(instance,username,password,driver,databaseurl)
The example provided by MatLab looks like this:
Connect to an Oracle database via JDBC driver.
Connect to the database, test_db, using the user name, scott, and password, tiger. Use the JDBC driver, oracle.jdbc.driver.OracleDriver, to make the connection. The URL defined by the driver vendor is jdbc:oracle:oci7:
conn = database('test_db','scott','tiger',...
'oracle.jdbc.driver.OracleDriver','jdbc:oracle:oci7:')
OR
Microsoft SQL Server Authenticated Database Connection
Connect to a Microsoft SQL Server database with integrated Windows Authentication using a JDBC driver.
Close MATLAB if it is running.
Insert the path to the database driver JAR file in the classpath.txt file. The classpath.txt file is located at:
$MATLABROOT\toolbox\local\classpath.txt
The updated path entry should now include the full path to the driver. For example:
C:\DB_Drivers\sqljdbc_2.0\enu\sqljdbc4.jar
Insert the path to the folder containing sqljdbc_auth.dll in the librarypath.txt file. The librarypath.txt file is located at:
$MATLABROOT\toolbox\local\librarypath.txt
The path entry should not include the file name sqljdbc_auth.dll:
C:\DB_Drivers\sqljdbc_2.0\enu\auth\x64
The sqljdbc_auth.dll file is installed in the following location:
<installation>\sqljdbc_<version>\<language>\auth\<arch>
where is the installation directory of the SQL server driver.
If you are running a 32-bit Java Virtual Machine (JVM), then use the
sqljdbc_auth.dll file in the x86 folder, even if the operating system
is the x64 version.
If you are running a 64-bit JVM on a x64 processor, then use the
sqljdbc_auth.dll file in the x64 folder.
If you are running a 64-bit JVM on a IA-64 processor, then use the
sqljdbc_auth.dll file in the IA64 folder.
Start MATLAB.
Use the AuthType parameter to establish a Windows Authentication connection.
conn = database('dbName','','', ...
'Vendor','Microsoft SQL Server','Server','servername',...
'AuthType','Windows')
I am trying to connect to oracle database using os authentication through jdbc.
I have oracle 10g installed on solaris sparc 32 bit.
Following is the code for jdbc connection :-
String url = "jdbc:oracle:thin:#oracleserver.mydomain.com:5521:dbja"
Driver driver = new oracle.jdbc.OracleDriver();
DriverManager.registerDriver(driver);
Properties props = new Properties();
props.setProperty(OracleConnection.CONNECTION_PROPERTY_THIN_VSESSION_OSUSER,"oracle");
Connection conn = DriverManager.getConnection( url, props);
when i run the above code using thin driver, it gives error as "invalid username/password ; logon denied'
using oci driver error is :: "no ocijdbc11 in java.library.path" but i am using oracle 10g and in LD_LIBRARAY_PATH libocijdbc10.so is present. but still looking for libocijdbc11.so.
Please help me to resolve the issue.
Thanks
For using os authentication, please check the oracle documentation
How is the os_authent_prefix?
Does the user oracle exist?
Is REMOTE_OS_AUTHENT = TRUE?
For OCI access, the relevant thing here is the JDBC driver, which must match the oracle client version. To achieve this, add the 10g jdbc driver from your oracle client installation to the class path.