i want what should be given in DriverManager.getConnection() when i want to access all tables from ms-access
Have a look at DriverManager.getConnection(String url, Properties info). What problem doesn't this solve?
I think you want to connect to an MS Access DB without creating a DSN.
In any case this works fine with acess everytime.
DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/data/data.MDB","","");
Change the DBQ argument to your MDB file.
Related
Im trying to connect to the mariadb server in jdbc and call my stored procedure but im getting this error.
Ive also tried:
'''GRANT all ON mysql.proc TO 'Gruppe18'#'i3ED6FBF0.versanet.det';'''
but in mysql i got access denied error.
And the server is from university so I dont have full access on it.
enter image description here
The image shows that you're using named parameters, which means that the JDBC driver needs to query the meta-data of the stored procedure to learn what those parameters are.
Your user is not authorized to query that meta-data.
Solution: Use positional parameters.
I need to make a backup of a certian database (including tables and data on tables) which is stored on phpmyAdmin using java code. Any help? Thanks in advance
phpMyAdmin is used to maintain MySQL Databases via a Web-Browser, implemented in PHP (c.f. https://www.phpmyadmin.net/).
If you want to access a MySQL DB from Java you can try to use JDBC (https://dev.mysql.com/downloads/connector/j/).
If you really, really want to do your backup via phpMyAdmin you could try to write a Selenium-Test testing your phpMyAdmin instance (http://www.seleniumhq.org/). But I guess, there are easier ways to get the job done.
we just started learning about sql statements and such, and right now i am totally confused on how to do this:
I need to access the database of another computer (we are using mysql workbench) using java codes
What i have done so far:
grant all privileges using '%'
i can already connect to the database (mysql) in my own computer (java codes and jdbc)
my problems are:
what are the steps do i need to do to be able to access the database from another computer, there are no direct answers in google...and now i am totally confused on how to do this because every site keep on telling me about cpanel, which i dont know how to have one...then this remote access that requires me to change my sql server configuration, i dont know how to find this...
CAN SOMEONE GIVE ME A STEP BY STEP SETTING/SETUP i need to do, to be able to access the database/connection from another computer? i only need the Normal steps, no need for safety/security setups and descriptive steps, i can do the rest of specific research on Google
SOLUTION
Hey Just configure that system IP in the JDBC connection call then you will be able top connect and retrieve the data in the Java Layer.
String DB_URL = "jdbc:mysql://localhost/EMP";
String USER = "username";
String PASS = "password";
Connection conn = DriverManager.getConnection(DB_URL,USER,PASS);
Instead of "localhost" give your destination MySQL system IP address.
Just run the the mysql in one device then get that device Ip address, then on the other device use the http://IPADDRESS:8081/yourWebsite
for example instead of
instead of http://localhost:8081/yourWebsite = http://271.1.1.10:8081/yourWebsite
it will work from there, not need to configure anything. the other device will be using the same project and same database
note both devices should be on the same network
I need to write a jdbc program to connect with mysql using type2 driver.I spent lot of time
to get the url and driver name for mysql.Please dont say go to google i tried a lot in
google.I did not find any where.I am able to find for Oracle but not for mysql.Please help
me.Thanks in advance....
Apart from a long (2002) dead project there is no Type 2 JDBC driver for MySQL.
I found this video which shows how to connect to access database :
http://www.youtube.com/watch?v=ujJ4H9RpC7c
My question is : Is it possible to create ODBC datasource programatically ?
or from command line or anything like that?
Thank you
It is not possible to create a windows ODBC DSN programmatically with pure Java. It is possible with C++ and other native approaches.
However, you can connect to an Access MDB file directly (via ODBC) using a JDBC URL of the form:
String jdbcUrl = "jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=c:/path/to/myaccessfile.mdb"
This way you do not need to have predefined DSN. You might also want to review the answers to this question:
How can I add a password to this JDBC:ODBC connection string that is trying to connect to an MS Access database
From the command line, you can use an utility named odbcconf.
I guess that if you need to do that programatically, you'll need to use WinAPI somehow.