JDBC Connection pooling using C3P0

With a pooled data source, the connections in the pool are not actually closed, they just get returned to the pool. However, when the application is shut down, those connections to the database should be properly and actually closed, which is where the final cleanup comes in. Incidentally, the c3p0 project is pretty much dead … Read more

How can I connect to Oracle Database 11g server through ssh tunnel chain (double tunnel, server in company network)?

Yes, it’s possible. E.g. on Linux, run ssh -N -Llocalport:dbserver:dbport yourname@connectionserver where localport is the port on your machine which will be forwarded (can be 1521 if there is no local instance of oracle running) dbserver is the name or IP of the database server dbport is the port of the database (usually 1521) yourname … Read more

getting Lost connection to mysql when using mysqldump even with max_allowed_packet parameter

Try adding the –quick option to your mysqldump command; it works better with large tables. It streams the rows from the resultset to the output rather than slurping the whole table, then writing it out. mysqldump -uroot -h my.host -p’mypassword’ –quick –max_allowed_packet=512M db_name table_name | \ gzip > dump_test.sql.gz You can also try adding the … Read more

How can I set a username and password in sqlite3?

No, sqlite3 databases are very lightweight systems. They need no server and all data is stored in one file. A username/password is not supported by the sqlite/sqlite3 package. In order to achieve simplicity, SQLite has had to sacrifice other characteristics that some people find useful, such as high concurrency, fine-grained access control, a rich set … Read more

Database application.yml for Spring boot from applications.properties

You need to treat each . character in property names as levels in the yaml file: spring: jpa: database: POSTGRESQL show-sql: true hibernate: ddl-auto: create-drop datasource: platform: postgres url: jdbc:postgresql://localhost:5432/mydb username: foo password: bar driverClassName: org.postgresql.Driver EDIT: edits have been suggested, thanks for that. The driverClassName property actually should be under spring.datasource. However, the purpose … Read more

How can I access Oracle from Python?

Here’s what worked for me. My Python and Oracle versions are slightly different from yours, but the same approach should apply. Just make sure the cx_Oracle binary installer version matches your Oracle client and Python versions. My versions: Python 2.7 Oracle Instant Client 11G R2 cx_Oracle 5.0.4 (Unicode, Python 2.7, Oracle 11G) Windows XP SP3 … Read more

Best practices for persistent database connections in Python when using Flask

Turns out there is a straightforward way to achieve what I was after. But as the commenters suggested, if it is at all possible to go the flask sqlalchemy route, then you might want to go that way. My approach to solving the problem is to save the connection object in a module level variable … Read more

Enable tcp\ip remote connections to sql server express already installed database with code or script(query)

I tested below code with SQL Server 2008 R2 Express and I believe we should have solution for all 6 steps you outlined. Let’s take on them one-by-one: 1 – Enable TCP/IP We can enable TCP/IP protocol with WMI: set wmiComputer = GetObject( _ “winmgmts:” _ & “\\.\root\Microsoft\SqlServer\ComputerManagement10”) set tcpProtocols = wmiComputer.ExecQuery( _ “select * … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)